天道酬勤,学无止境

jakarta-ee

AnnotationException 引用的属性不是 (One|Many)ToOne(AnnotationException Referenced property not a (One|Many)ToOne)

问题 我试图建立一对一的关系。 但我得到错误: AnnotationException Referenced property not a (One|Many)ToOne on com.student.information.service.Department.departmentId in mappedBy of com.student.information.service.DepartmentHead.department 两个实体几乎相同。 部门可以在没有部门负责人的情况下存在。 部门.Java @Entity @Table(name="department", catalog="student") public class Department { @Id @GeneratedValue(strategy=GenerationType.AUTO) private Integer departmentId; @Column(name="dept_name") private String departmentName; @OneToMany(mappedBy="department",cascade = CascadeType.ALL) private List<Student> student; @OneToOne(targetEntity=Department

2021-11-29 03:08:16    分类:技术分享    java   spring   hibernate   jakarta-ee

为什么我的 JSF + Spring Web 应用程序输出 JSF 源代码而不是解释的 HTML 页面?(Why does my JSF + Spring web application output JSF source code instead of interpreted HTML page?)

问题 我是 JSF 和 Spring Framework 的新手,我正试图弄清楚如何让它们协同工作。 我当前的问题是应用程序输出我的 JSF 文件而不解释它们。 以下是我认为可能相关的一些代码片段: 调度程序-servlet.xml <bean id="urlMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping"> <property name="mappings"> <props> <prop key="login.htm">loginController</prop> </props> </property> </bean> <bean id="viewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver" p:prefix="/WEB-INF/pages/" p:suffix=".xhtml" /> <bean name="loginController" class="controller.LoginController" /> 登录控制器 public class LoginController extends MultiActionController {

2021-11-29 02:49:43    分类:技术分享    spring   web-applications   xhtml   jsf   jakarta-ee

在 Jboss 6.3.0 EAP 中部署 Java WS 时出错(error when deploying Java WS in Jboss 6.3.0 EAP)

问题 我正在将带有 Java WS 的应用程序从 Jboss 5.1.0 迁移到 Jboss 6.3.0 EAP。 它在 Jboss 5.1.0 上运行良好,但在 Jboss 6.3.0 EAP 中部署它时出现错误。 14:42:10,887 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-2) MSC000001: Failed to start service jboss.deploy ment.unit."my-app.war".INSTALL: org.jboss.msc.service.StartException in service jboss.deployment.unit."dtm-banking. war".INSTALL: JBAS018733: Failed to process phase INSTALL of deployment "dtm-banking.war" at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [jboss-a s-server-7.4.0.Final-redhat-19.jar:7.4.0.Final

2021-11-29 01:58:07    分类:技术分享    web-services   jakarta-ee   soap   jboss7.x   jboss-eap-6

Wildfly:从配置目录读取属性(wildfly: reading properties from configuration directory)

问题 我正在尝试从我的 wildfly 配置文件夹中的属性文件中读取部署特定信息。 我试过这个: @Singleton @Startup public class DeploymentConfiguration { protected Properties props; @PostConstruct public void readConfig() { props = new Properties(); try { props.load(getClass().getClassLoader().getResourceAsStream("my.properties")); } catch (IOException e) { // ... whatever } } 但显然这不起作用,因为配置文件夹不再在类路径中。 现在我找不到一种简单的方法来做到这一点。 我最喜欢的是这样的: @InjectProperties("my.properties") protected Properties props; 到目前为止,我在网上找到的唯一解决方案是制作我自己的 OSGi 模块,但我相信必须有一种更简单的方法来做到这一点(没有 OSGi!)。 谁能告诉我怎么做? 回答1 如果您想从配置目录(例如$WILDFLY_HOME/standalone/configuration或domain

2021-11-29 01:44:57    分类:技术分享    java   jakarta-ee   jboss   cdi   wildfly

How to hot deploy maven project to glassfish?

I have a webapp project generated with m2e maven plugin in eclipse indigo. And i have a embedded glassfish plugin configured in my pom.xml. Right now when i change something i have to mvn clean package, mvn embedded-glassfish:run, see whats up, then press x in console and server shutdowns. Is there any way to make things easier? Ny help would be appreceited.

2021-11-29 01:22:12    分类:问答    java   eclipse   jakarta-ee   maven   glassfish

Using a CommonJ implementation with GlassFish and Spring 3

In my quest to unify deployment among Websphere 7 and GlassFish 3 environments, I decided to try implementing a CommonJ WorkManager and TimerManager in GlassFish. But it isn't quite working as expected. I have done the following: Use the myFOO CommonJ implementation found at: http://commonj.myfoo.de/ and include the libraries into my domain/lib folder (including the Spring libs) Added the following to the <resources> section of the glassfish domain.xml: <custom-resource res-type="commonj.work.WorkManager" jndi-name="wm/default" factory-class="de.myfoo.commonj.work.FooWorkManagerFactory"><

2021-11-29 00:30:27    分类:问答    spring   jakarta-ee   glassfish   commonj   workmanagers

Apache Shiro credentials based security for Rest service

I'm creating a App using Shiro as the security framework. The app have two parts; Web and Rest. The Web is using Shiro's default FormAuthenticationFilter. I'm happy with the session based approach. The stand alone app which is using Rest, I want to limit from using the FormAuthenticationFilter and from creating a session, which I'm able to do via shiro.ini file I need to implement credentials based security on the rest service. Browsing on the web I saw some blogs suggesting that you create your own Realm and filter to handle this scenario. But no details on how to do this. Is it possible to

2021-11-29 00:10:55    分类:问答    rest   jakarta-ee   shiro

How do you find out what Exception caused the CDI Transaction Rollback?

We are using CDI with CMT (container managed transactions) to connect to the database in the web app and mark methods called from the front-end that require a transaction with: @Transactional(value=TxType.REQUIRES_NEW) This will create a new CDI transaction, however now if an exception occurs doing this code block or any other code block called from this method it will throw the error message: javax.transaction.TransactionalException: Managed bean with Transactional annotation and TxType of REQUIRES_NEW encountered exception during commit javax.transaction.RollbackException: Transaction marked

2021-11-28 23:36:19    分类:问答    java   jakarta-ee   transactions   cdi

How effective is executeBatch on a Prepared Statement?

Subject to this question, asks it all:How effective is executeBatch method? Is there a performance benchmark, that says.. 'if you have 1000 records to be inserted, using a executeBatch instead of executeUpdate saves you x amount of database cycles?' Or Is this just a convention? EDIT: Here is what I am working with: a DB2 V 8.1 hosted on Z/OS, a web app that would be inserting 80,000 records at one go in it's worst case scenario execution.

2021-11-28 22:42:25    分类:问答    java   database   performance   jdbc   jakarta-ee

EJB3.1 System Exceptions vs javax.ejb.EJBException

Just a bit of background on EJB3.1 exceptions before bringing up my question - Application exceptions comprise of User defined checked or unchecked exceptions which have @ApplicationException annotation All checked exceptions java.lang.Exception & it's subclass exceptions except java.rmi.RemoteException & it's subclass exceptions System exceptions comprise of java.rmi.RemoteException and it's subclass exceptions All unchecked exceptions java.lang.RuntimeException and it's subclass exceptions java.lang.Error and it's subclass exceptions Below is a statement I have read in this book In EJB

2021-11-28 21:42:33    分类:问答    java   jakarta-ee   exception   java-ee-6   ejb-3.1