2

以下异常的原因可能是什么?我的 persistence.xml 和 components.xml 看起来不错。环境:Tomcat6、Seam2框架。

Oct 17, 2013 10:37:46 AM org.apache.catalina.core.StandardContext listenerStart
SEVERE: Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
org.jboss.seam.InstantiationException: Could not instantiate Seam component: someComponent  
    at org.jboss.seam.Component.newInstance(Component.java:2170)
    at org.jboss.seam.Component.getInstance(Component.java:2024)
    at org.jboss.seam.Component.getInstance(Component.java:1986)
    at org.jboss.seam.core.Events.raiseEvent(Events.java:77)
    at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:145)
    at org.jboss.seam.init.Initialization.init(Initialization.java:744)
    at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:36)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
    at org.apache.catalina.core.StandardContext.start(StandardContext.java:4342)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
    at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
    at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
    at org.apache.catalina.core.StandardService.start(StandardService.java:516)
    at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:578)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: java.lang.RuntimeException: exception invoking: getTransaction
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:154)
    at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
    at org.jboss.seam.Component.unwrap(Component.java:2301)
    at org.jboss.seam.Component.getInstance(Component.java:2044)
    at org.jboss.seam.Component.getInstance(Component.java:2003)
    at org.jboss.seam.Component.getInstance(Component.java:1997)
    at org.jboss.seam.Component.getInstance(Component.java:1970)
    at org.jboss.seam.Component.getInstance(Component.java:1965)
    at org.jboss.seam.transaction.Transaction.instance(Transaction.java:39)
    at org.jboss.seam.persistence.ManagedPersistenceContext.joinTransaction(ManagedPersistenceContext.java:120)
    at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:112)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
    at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
    at org.jboss.seam.Component.unwrap(Component.java:2301)
    at org.jboss.seam.Component.getInstance(Component.java:2044)
    at org.jboss.seam.Component.getInstance(Component.java:1986)
    at org.jboss.seam.Component.getInstance(Component.java:1980)
    at org.jboss.seam.Component.getInstanceInAllNamespaces(Component.java:2375)
    at org.jboss.seam.Component.getValueToInject(Component.java:2327)
    at org.jboss.seam.Component.injectAttributes(Component.java:1739)
    at org.jboss.seam.Component.inject(Component.java:1557)
    at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:61)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
    at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44)
    at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
    at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
    at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:185)
    at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:103)
    at pg.exess.manager.ExessBusinessUnitManager_$$_javassist_seam_2.create(ExessBusinessUnitManager_$$_javassist_seam_2.java)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
    at org.jboss.seam.Component.callComponentMethod(Component.java:2275)
    at org.jboss.seam.Component.callCreateMethod(Component.java:2198)
    at org.jboss.seam.Component.newInstance(Component.java:2158)
    ... 21 more
Caused by: javax.naming.NamingException: Cannot create resource instance
    at org.apache.naming.factory.TransactionFactory.getObjectInstance(TransactionFactory.java:113)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:793)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:140)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:781)
    at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
    at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at org.jboss.seam.transaction.Transaction.getUserTransaction(Transaction.java:82)
    at org.jboss.seam.transaction.Transaction.createUTTransaction(Transaction.java:74)
    at org.jboss.seam.transaction.Transaction.getTransaction(Transaction.java:47)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.jboss.seam.util.Reflections.invoke(Reflections.java:22)
    at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:144)
    ... 63 more
Oct 17, 2013 10:37:46 AM org.apache.catalina.core.StandardContext start
SEVERE: Error listenerStart
Oct 17, 2013 10:37:46 AM org.apache.catalina.core.StandardContext start
SEVERE: Context [/project] startup failed due to previous errors

谢谢你的帮助!

4

1 回答 1

2

从 components.xml 中的实体事务中删除“名称”属性后,此问题得到解决。

<transaction:entity-transaction name="someName "entity-manager="#{em}" />

<transaction:entity-transaction entity-manager="#{em}" />

于 2013-10-22T14:52:08.317 回答