9 Replies Latest reply on Jul 16, 2009 6:37 AM by Sanjay Bhatt

    Unknown entity when persisting seam managed JPA entity

    Guillaume Jeudy Master

      Hi,


      I am using seam 2.0.1-GA with jboss 4.2.2. I went on migrating all my JPA entities to use native hibernate mappings. The resulting JPA entity becomes a regular POJO with no annotations.


      The mapping info is stored in classname.hbm.xml files packaged in the same jar containing persistence.xml.


      When testing the migration I found that I sometimes get the below exception when persisting a new instance of a transient entity:


      Caused by: java.lang.IllegalArgumentException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
           at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:215)



      Re-adding

      @Entity

      annotation on the JPA entity works as a workaround.


      Here's my persistence.xml:


      <persistence-unit name="ReferenceDataManagerDB">
      
                <jta-data-source>java:/ReferenceDataManagerDS</jta-data-source>
      
                <mapping-file>META-INF/rdm-service-mappings.xml</mapping-file>
      
                <jar-file>../lib/rdm-comm-${pom.version}.jar</jar-file>
      
                <properties>
      
                     <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle9iDialect" />
      
                     <property name="hibernate.show_sql" value="false" />
      
                     <!-- SQL logging setup at log4j level -->
      
                     <property name="hibernate.format_sql" value="false" />
      
                     <property name="hibernate.use_sql_comments" value="true" />
      
                     <property name="hibernate.use_outer_join" value="true" />
      
                     <property name="hibernate.cache.provider_class" value="org.hibernate.cache.NoCacheProvider" />
      
                     <property name="jboss.entity.manager.factory.jndi.name" value="java:/rdmEntityManagerFactory" />
      
                     <property name="jboss.entity.manager.jndi.name" value="java:/rdmEntityManager" />
      
                     <!--       <property name="hibernate.hbm2ddl.auto" value="validate"/> -->
      
                </properties>
      
           </persistence-unit>



      Here's the mapping used:


      <hibernate-mapping package="com.archinsurance.rdm.entity.packages.impl">
      
           <class name="RefReleasePackageItemImpl" table="REF_RELEASE_PKG_ITEM">
      
                <composite-id name="id" class="com.archinsurance.rdm.entity.packages.ReleasePackageItemPK">
      
                     <key-property name="packageId" column="RELEASE_PACKAGE_ID"></key-property>
      
                     <key-property name="domain" column="DOMAIN_OBJECT_ID"></key-property>
      
                </composite-id>
      
                <many-to-one name="refReleasePackage" class="RefReleasePackageImpl" update="false" insert="false"
      
                     column="RELEASE_PACKAGE_ID">
      
                </many-to-one>
      
                <many-to-one name="referenceDomain" class="com.archinsurance.rdm.entity.reference.impl.ReferenceDomainImpl"
      
                     update="false" insert="false" column="RELEASE_PACKAGE_ID">
      
                </many-to-one>
      
                <component name="validityPeriod" class="com.archinsurance.rdm.entity.reference.ValidityPeriod">
      
                     <property name="validFromDate" column="VALID_FROM_DT" />
      
                     <property name="validToDate" column="VALID_TO_DT" />
      
                </component>
      
           </class>
      
      </hibernate-mapping>



      The class code is not included for brievety. There is no annotations on it. Like I stated earlier adding back:


      @Entity
      
      public class RefReleasePackageImpl 



      gets me rid of the exception.


      The exception only happens on JPA entities that happen to be seam-managed components. For this example, I define it in components.xml:


      <component name="relPkg" class="com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl" scope="session" />



      when I refer it in my facelets page, Seam instantiates it.


      <h:inputText id="releasePackageName" value="#{relPkg.releasePackageNm}" required="true" />



      Here's the full stack of the exception:


      2008-05-09 10:07:54,790 FATAL [javax.enterprise.resource.webcontainer.jsf.application] javax.ejb.EJBTransactionRolledbackException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
      javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
      
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
      
           at javax.faces.component.UICommand.broadcast(UICommand.java:383)
      
           at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
      
           at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:291)
      
           at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
      
           at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:461)
      
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
      
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
      
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
      
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
      
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      
           at java.lang.Thread.run(Thread.java:595)
      
      Caused by: javax.ejb.EJBTransactionRolledbackException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
           at org.jboss.ejb3.tx.Ejb3TxPolicy.handleInCallerTx(Ejb3TxPolicy.java:87)
      
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:130)
      
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.stateless.StatelessInstanceInterceptor.invoke(StatelessInstanceInterceptor.java:62)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:240)
      
           at org.jboss.ejb3.stateless.StatelessContainer.localInvoke(StatelessContainer.java:210)
      
           at org.jboss.ejb3.stateless.StatelessLocalProxy.invoke(StatelessLocalProxy.java:84)
      
           at $Proxy244.createReleasePackage(Unknown Source)
      
           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:585)
      
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107)
      
           at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      
           at org.javassist.tmp.java.lang.Object_$$_javassist_6.createReleasePackage(Object_$$_javassist_6.java)
      
           at com.archinsurance.rdmservices.stateful.impl.PackageAdminActionBean.createReleasePackage(PackageAdminActionBean.java:200)
      
           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:585)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      
           at com.archinsurance.rdmservices.interceptors.LoggingInterceptor.intercept(LoggingInterceptor.java:18)
      
           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:585)
      
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      
           at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.ManagedEntityIdentityInterceptor.aroundInvoke(ManagedEntityIdentityInterceptor.java:48)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.ConversationInterceptor.aroundInvoke(ConversationInterceptor.java:65)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
      
           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.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      
           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:585)
      
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      
           at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.entity.ExtendedPersistenceContextPropagationInterceptor.invoke(ExtendedPersistenceContextPropagationInterceptor.java:57)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      
           at org.jboss.aspects.tx.TxInterceptor$Required.invoke(TxInterceptor.java:195)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.aspects.tx.TxPropagationInterceptor.invoke(TxPropagationInterceptor.java:95)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.stateful.StatefulInstanceInterceptor.invoke(StatefulInstanceInterceptor.java:83)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.aspects.security.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:77)
      
           at org.jboss.ejb3.security.Ejb3AuthenticationInterceptor.invoke(Ejb3AuthenticationInterceptor.java:110)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.ENCPropagationInterceptor.invoke(ENCPropagationInterceptor.java:46)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.asynchronous.AsynchronousInterceptor.invoke(AsynchronousInterceptor.java:106)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.stateful.StatefulContainer.localInvoke(StatefulContainer.java:206)
      
           at org.jboss.ejb3.stateful.StatefulLocalProxy.invoke(StatefulLocalProxy.java:119)
      
           at $Proxy141.createReleasePackage(Unknown Source)
      
           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:585)
      
           at org.jboss.seam.util.Reflections.invoke(Reflections.java:21)
      
           at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
      
           at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:76)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.security.SecurityInterceptor.aroundInvoke(SecurityInterceptor.java:40)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.ejb.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:41)
      
           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.ClientSideInterceptor.invoke(ClientSideInterceptor.java:54)
      
           at org.javassist.tmp.java.lang.Object_$$_javassist_5.createReleasePackage(Object_$$_javassist_5.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:585)
      
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:329)
      
           at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:342)
      
           at org.jboss.el.parser.AstPropertySuffix.invoke(AstPropertySuffix.java:58)
      
           at org.jboss.el.parser.AstValue.invoke(AstValue.java:96)
      
           at org.jboss.el.MethodExpressionImpl.invoke(MethodExpressionImpl.java:276)
      
           at com.sun.facelets.el.TagMethodExpression.invoke(TagMethodExpression.java:68)
      
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:77)
      
           ... 50 more
      
      Caused by: java.lang.IllegalArgumentException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
           at org.hibernate.ejb.AbstractEntityManagerImpl.persist(AbstractEntityManagerImpl.java:215)
      
           at org.jboss.seam.persistence.EntityManagerProxy.persist(EntityManagerProxy.java:135)
      
           at com.archinsurance.rdmservices.stateless.impl.ReleasePackageServiceImpl.createReleasePackage(ReleasePackageServiceImpl.java:71)
      
           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:585)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:112)
      
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:166)
      
           at com.archinsurance.rdmservices.interceptors.LoggingInterceptor.intercept(LoggingInterceptor.java:18)
      
           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:585)
      
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      
           at org.jboss.seam.intercept.EJBInvocationContext.proceed(EJBInvocationContext.java:44)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
      
           at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:31)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:42)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.EntityManagerProxyInterceptor.aroundInvoke(EntityManagerProxyInterceptor.java:26)
      
           at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
      
           at org.jboss.seam.persistence.HibernateSessionProxyInterceptor.aroundInvoke(HibernateSessionProxyInterceptor.java:27)
      
           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.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:50)
      
           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:585)
      
           at org.jboss.ejb3.interceptor.InvocationContextImpl.proceed(InvocationContextImpl.java:118)
      
           at org.jboss.ejb3.interceptor.EJB3InterceptorsInterceptor.invoke(EJB3InterceptorsInterceptor.java:63)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.entity.TransactionScopedEntityManagerInterceptor.invoke(TransactionScopedEntityManagerInterceptor.java:54)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.ejb3.AllowedOperationsInterceptor.invoke(AllowedOperationsInterceptor.java:47)
      
           at org.jboss.aop.joinpoint.MethodInvocation.invokeNext(MethodInvocation.java:101)
      
           at org.jboss.aspects.tx.TxPolicy.invokeInCallerTx(TxPolicy.java:126)
      
           ... 165 more
      
      2008-05-09 10:07:54,806 WARN  [javax.enterprise.resource.webcontainer.jsf.lifecycle] #{packageAdminAction.createReleasePackage}: javax.ejb.EJBTransactionRolledbackException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
      javax.faces.FacesException: #{packageAdminAction.createReleasePackage}: javax.ejb.EJBTransactionRolledbackException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:107)
      
           at javax.faces.component.UICommand.broadcast(UICommand.java:383)
      
           at org.ajax4jsf.component.AjaxViewRoot.processEvents(AjaxViewRoot.java:316)
      
           at org.ajax4jsf.component.AjaxViewRoot.broadcastEvents(AjaxViewRoot.java:291)
      
           at org.ajax4jsf.component.AjaxViewRoot.processPhase(AjaxViewRoot.java:248)
      
           at org.ajax4jsf.component.AjaxViewRoot.processApplication(AjaxViewRoot.java:461)
      
           at com.sun.faces.lifecycle.InvokeApplicationPhase.execute(InvokeApplicationPhase.java:97)
      
           at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
      
           at com.sun.faces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:117)
      
           at javax.faces.webapp.FacesServlet.service(FacesServlet.java:244)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
      
           at org.jboss.seam.debug.hot.HotDeployFilter.doFilter(HotDeployFilter.java:68)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:85)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.ajax4jsf.webapp.BaseXMLFilter.doXmlFilter(BaseXMLFilter.java:147)
      
           at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:276)
      
           at org.ajax4jsf.Filter.doFilter(Filter.java:175)
      
           at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:60)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:58)
      
           at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
      
           at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at jcifs.http.NtlmHttpFilter.doFilter(NtlmHttpFilter.java:118)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
      
           at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      
           at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      
           at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:230)
      
           at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
      
           at org.jboss.web.tomcat.security.SecurityAssociationValve.invoke(SecurityAssociationValve.java:179)
      
           at org.jboss.web.tomcat.security.JaccContextValve.invoke(JaccContextValve.java:84)
      
           at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      
           at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      
           at org.jboss.web.tomcat.service.jca.CachedConnectionValve.invoke(CachedConnectionValve.java:157)
      
           at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      
           at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:262)
      
           at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:844)
      
           at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
      
           at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:446)
      
           at java.lang.Thread.run(Thread.java:595)
      
      Caused by: javax.faces.el.EvaluationException: javax.ejb.EJBTransactionRolledbackException: Unknown entity: com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl_$$_javassist_4
      
           at javax.faces.component.MethodBindingMethodExpressionAdapter.invoke(MethodBindingMethodExpressionAdapter.java:91)
      
           at com.sun.faces.application.ActionListenerImpl.processAction(ActionListenerImpl.java:91)
      
           ... 49 more



      Thanks for reading through this long post. Can this be fixed in a future seam release ? I would like to get rid of all annotations on my domain model as the domain model is re-used across applications but the mapping may differ, having to keep @Entity annotation forces one to have persistence API jar in the runtime classpath which is not always desirable.


      Thanks,
      -Guillaume

        • 1. Re: Unknown entity when persisting seam managed JPA entity
          Guillaume Jeudy Master

          Do I need to enter a JIRA for this? I believe I provided enough information to reproduce the problem.


          Any help on this would be greatly appreciated,


          Thank you!
          Guillaume

          • 2. Re: Unknown entity when persisting seam managed JPA entity
            Guillaume Jeudy Master

            Hi,


            I worked around the problem differently this time. Instead of putting

            @Entity

            to fix the problem, I made relPkg entity not a seam component. I removed the bit:



            <component name="relPkg" class="com.archinsurance.rdm.entity.packages.impl.RefReleasePackageImpl" scope="session" />



            and instead used a factory method to instantiate the JPA entity for me.


            
            @Out(required = false, scope = ScopeType.SESSION)
            
                 private RefReleasePackage relPkg;
            
            
            @Factory("relPkg")
            
                 public void initReleasePackageInstance() {
            
                      relPkg = new RefReleasePackageImpl();
            
                 }



            Is this a recommended approach? Or should JPA entities also be Seam managed components ? I dont see any benefits of having a JPA entity seam managed unless I wanted to use bijection of some collaborator into my JPA entity which I would guess is not advisable.

            • 3. Re: Unknown entity when persisting seam managed JPA entity
              Pete Muir Master

              For some reason you are trying to persist a javassist proxy rather than the entity. I would follow your solution of not making entities seam components.

              • 4. Re: Unknown entity when persisting seam managed JPA entity
                Guillaume Jeudy Master

                Thanks for your reply Pete.


                Persisting a javassist proxy works when annotating my JPA entity with @Entity annotation. My application does not explicitely persist a javassist proxy, it is instantiated by seam when making the entity seam managed.


                Even though this is not a recommended practice, it used to work, defining the entity with a traditional hibernate mapping caused the exception to be thrown.


                Is it possible to clarify that fact in Seam documentation or apply a code change to ensure both @Entity and hibernate XML mapping result in the same behavior ? (i.e. throw an exception when attempting to make entities seam managed components)


                Best regards,
                -Guillaume


                • 5. Re: Unknown entity when persisting seam managed JPA entity
                  Pete Muir Master

                  Ok, I see the problem. Please file an issue in JIRA and we can look at fixing it.

                  • 7. Re: Unknown entity when persisting seam managed JPA entity
                    Sanjay Bhatt Newbie
                    I am using Seam 2.1.0SP1. I have annotated entity with @Entity. I do not have any problem while running the application in JBoss 4.2.2 server.

                    The problem starts when I run the TestNG test in Embedded JBoss. I am getting the exception.
                    ERROR [org.jboss.aspects.tx.TxPolicy] javax.ejb.EJBTransactionRolledbackException: Unknown entity: uk.co.tntpost.umbrella.entity.Quotation
                    FAILED: testSaveQuotation

                    Any idea?
                    • 8. Re: Unknown entity when persisting seam managed JPA entity
                      Jean Luc Apprentice

                      It's probably a matter related to the scope of the persistence context. The entity manager is not recognizing the name of the entity, which means it has not scanned that class when the application was started (a JPA implementation scans the classes in the classpath for those annonnated with  @Entity). Check section 6.2 of the JPA spec to understand what is scanned. Possible causes are the lack of a persistence.xml available during tests or different packaging.


                      • 9. Re: Unknown entity when persisting seam managed JPA entity
                        Sanjay Bhatt Newbie
                        Thanks for the reply.

                        I believe Entity is scanned correctly as shown in the log below:

                        INFO  [org.hibernate.cfg.AnnotationBinder] Binding entity from annotated class: uk.co.tntpost.umbrella.entity.Quotation
                        INFO  [org.hibernate.cfg.annotations.EntityBinder] Bind entity uk.co.tntpost.umbrella.entity.Quotation on table QUOTATION

                        Below is my persistence.xml which is planced under src/test/resources/META-INF folder:

                        <?xml version="1.0" encoding="UTF-8"?>
                        <!-- Persistence deployment descriptor for dev profile -->
                        <persistence xmlns="http://java.sun.com/xml/ns/persistence"
                                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                                     xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd"
                                     version="1.0">
                                    
                           <persistence-unit name="UMBRELLA">
                              <provider>org.hibernate.ejb.HibernatePersistence</provider>
                              <jta-data-source>java:umbrellaDatasource</jta-data-source>
                              <properties>
                                 <property name="hibernate.dialect" value="org.hibernate.dialect.Oracle10gDialect"/>
                                 <property name="hibernate.hbm2ddl.auto" value="validate"/>
                                 <property name="hibernate.show_sql" value="true"/>
                                 <property name="hibernate.format_sql" value="true"/>
                                 <property name="jboss.entity.manager.factory.jndi.name" value="java:umbrellaEntityManagerFactory"/>
                                 <property name="hibernate.default_schema" value="UMBRELLA"/>
                              </properties>
                           </persistence-unit>
                           
                        </persistence>