各位老大
我用MYECLIPSE5.5开发了个测试的EJB3.0实体BEAN,发布后,做了个测试类调用,老抛出异常,都郁闷了,实在找不到问题所在,特来求教,以下是异常的节选
javax.ejb.EJBException: java.lang.RuntimeException: java.lang.ExceptionInInitializerError; nested exception is: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)....
aused by: java.lang.ExceptionInInitializerError
at com.ejb.UmsgFacade.findById(UmsgFacade.java:66)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
....
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)....
Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
at org.hibernate.impl.SessionFactoryImpl. <init> (SessionFactoryImpl.java:329).....
javax.ejb.EJBException: java.lang.RuntimeException: java.lang.ExceptionInInitializerError; nested exception is: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at org.jboss.ejb3.tx.Ejb3TxPolicy.handleExceptionInOurTx(Ejb3TxPolicy.java:63).....
Caused by: java.lang.RuntimeException: java.lang.ExceptionInInitializerError
at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:174)......
Caused by: java.lang.ExceptionInInitializerError
at com.ejb.UmsgFacade.findById(UmsgFacade.java:66).....
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:720)......
Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
at org.hibernate.impl.SessionFactoryImpl. <init> (SessionFactoryImpl.java:329).......
------解决方法--------------------------------------------------------
查看一下本地接口中的findById()方法
------解决方法--------------------------------------------------------
Caused by: javax.persistence.PersistenceException: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
你的事务管理有问题?
------解决方法--------------------------------------------------------
你的测试类是在调用的SessionBean而你的SessionBean是在调用EntityBean,这个方式调用的是本地调用里面的数据是无法被远程调用出来的,可以在外部写个JavaBean然后在EntityBean中将数据放在这个javabean中,在将javabean放在一个ArrayList或Vector中,在远程返回的时候就返回这个集合就可以了 ,你可以试下