9 Replies Latest reply on Mar 5, 2010 2:02 PM by Anthony Ogier

    Tomcat 6 embedded JBoss EntityManagerFactory problem

    Coen Damen Novice

      Hi,


      I want to run my Seam (2.1.0.SP1) application from within Eclipse. I have Tomcat 6 embedded Jboss configured to do this.


      I have followed the steps from the Apache site to setup the datasource. I see in the Tomcat log that the datasource is set up:


      
      INFO  [org.jboss.resource.connectionmanager.ConnectionFactoryBindingService] Bound ConnectionManager 'jboss.jca:service=DataSourceBinding,name=umbrellaDatasource' to JNDI name 'java:umbrellaDatasource'
      
      



      My persistence.xml and components.xml are OK, because I can successfully deploy to JBoss 4.2.2.


      Components.xml entry


      
      <persistence:managed-persistence-context name="entityManager"
                      auto-create="true"
                      persistence-unit-jndi-name="java:comp/env/umbrellaEntityManagerFactory" />
      
      





      persistence.xml (this file is in the META-INF directory of the EJB project.



      
      <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:comp/env/umbrellaEntityManagerFactory"/>
               <property name="hibernate.default_schema" value="UMBRELLA"/>
            </properties>
         </persistence-unit>
      
      



      What the BLEEP am I missing here? I've been searching the web for two days now :S


      Thanks for your reply,
      Coen



      context.xml on tomcat


      
      <Resource name="umbrellaDatasource" auth="Container"
                    type="javax.sql.DataSource" driverClassName="oracle.jdbc.OracleDriver"
                    url="jdbc:oracle:thin:@NL-L3G2716:1521:XE"
                    username="UMBRELLA" password="XXXXX" maxActive="20" maxIdle="10"
                    maxWait="-1"/> 
      
      






        • 1. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
          Coen Damen Novice

          of course here is the StackTrace


          
          ERROR [facelets.viewhandler] Error Rendering View[/home.xhtml]
          org.jboss.seam.InstantiationException: Could not instantiate Seam component: roundDistributorList
               at org.jboss.seam.Component.newInstance(Component.java:2096)
               at org.jboss.seam.Component.getInstance(Component.java:1978)
               at org.jboss.seam.Component.getInstance(Component.java:1940)
               at org.jboss.seam.Component.getInstance(Component.java:1934)
               at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:55)
               at org.jboss.seam.Namespace.getComponentInstance(Namespace.java:50)
               at org.jboss.seam.el.SeamELResolver.resolveBase(SeamELResolver.java:166)
               at org.jboss.seam.el.SeamELResolver.getValue(SeamELResolver.java:53)
               at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:53)
               at org.jboss.el.parser.AstIdentifier.getValue(AstIdentifier.java:44)
               at org.jboss.el.parser.AstValue.getValue(AstValue.java:63)
               at org.jboss.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:186)
               at org.jboss.seam.core.Expressions$1.getValue(Expressions.java:112)
               at org.jboss.seam.navigation.Param.getStringValueFromModel(Param.java:133)
               at org.jboss.seam.navigation.Pages.getStringValuesFromModel(Pages.java:765)
               at org.jboss.seam.ui.component.UISeamCommandBase.getUrl(UISeamCommandBase.java:62)
               at org.jboss.seam.ui.renderkit.LinkRendererBase.doEncodeBegin(LinkRendererBase.java:26)
               at org.jboss.seam.ui.util.cdk.RendererBase.encodeBegin(RendererBase.java:79)
               at javax.faces.component.UIComponentBase.encodeBegin(UIComponentBase.java:808)
               at org.ajax4jsf.renderkit.RendererBase.renderChild(RendererBase.java:280)
               at org.richfaces.renderkit.html.ToolBarRendererBase.encodeChildren(ToolBarRendererBase.java:103)
               at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:832)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:936)
               at javax.faces.component.UIComponent.encodeAll(UIComponent.java:942)
               at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:592)
               at org.ajax4jsf.application.ViewHandlerWrapper.renderView(ViewHandlerWrapper.java:108)
               at org.ajax4jsf.application.AjaxViewHandler.renderView(AjaxViewHandler.java:196)
               at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:106)
               at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:251)
               at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:144)
               at javax.faces.webapp.FacesServlet.service(FacesServlet.java:266)
               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:51)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:38)
               at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
               at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
               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:177)
               at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:267)
               at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:380)
               at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:507)
               at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
               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 org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
               at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
               at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:433)
               at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
               at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
               at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
               at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
               at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
               at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
               at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
               at java.lang.Thread.run(Thread.java:595)
          Caused by: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:comp/env/umbrellaEntityManagerFactory
               at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:231)
               at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:78)
               at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:107)
               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:22)
               at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:138)
               at org.jboss.seam.Component.callComponentMethod(Component.java:2201)
               at org.jboss.seam.Component.unwrap(Component.java:2227)
               at org.jboss.seam.Component.getInstance(Component.java:1994)
               at org.jboss.seam.Component.getInstance(Component.java:1940)
               at org.jboss.seam.Component.getInstance(Component.java:1934)
               at org.jboss.seam.Component.getInstance(Component.java:1929)
               at org.jboss.seam.framework.Controller.getComponentInstance(Controller.java:272)
               at org.jboss.seam.framework.PersistenceController.getPersistenceContext(PersistenceController.java:20)
               at org.jboss.seam.framework.EntityQuery.getEntityManager(EntityQuery.java:153)
               at org.jboss.seam.framework.EntityQuery.validate(EntityQuery.java:37)
               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:22)
               at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:56)
               at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28)
               at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68)
               at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:40)
               at org.jboss.seam.util.Work.workInTransaction(Work.java:47)
               at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:34)
               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:166)
               at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:102)
               at co.uk.tntpost.umbrella.session.RoundDistributorList_$$_javassist_1.validate(RoundDistributorList_$$_javassist_1.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.seam.util.Reflections.invoke(Reflections.java:22)
               at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:138)
               at org.jboss.seam.Component.callComponentMethod(Component.java:2201)
               at org.jboss.seam.Component.callCreateMethod(Component.java:2124)
               at org.jboss.seam.Component.newInstance(Component.java:2084)
               ... 65 more
          Caused by: javax.naming.NameNotFoundException: Name java:comp is not bound in this Context
               at org.apache.naming.NamingContext.lookup(NamingContext.java:770)
               at org.apache.naming.NamingContext.lookup(NamingContext.java:153)
               at org.apache.naming.SelectorContext.lookup(SelectorContext.java:137)
               at org.jboss.embedded.tomcat.jndi.ENCFactory.getObjectInstance(ENCFactory.java:74)
               at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
               at javax.naming.spi.NamingManager.getContext(NamingManager.java:422)
               at javax.naming.spi.ContinuationContext.getTargetContext(ContinuationContext.java:38)
               at javax.naming.spi.NamingManager.getContinuationContext(NamingManager.java:770)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:775)
               at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
               at javax.naming.InitialContext.lookup(InitialContext.java:351)
               at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:227)
               ... 111 more
          
          



          • 2. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
            Coen Damen Novice

            One note though, I want to run this application FROM WITHIN ECLIPSE !!


            If I run tomcat with the WAR structure, all works well.


            So is it even possible to run a Seam application using a Runtime Embedded Jboss from within Eclipse????


            • 3. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
              Coen Damen Novice

              Ok I found the issue, after two days of config file hell.


              Now I am facing another problem, my Seam components do not get initialized.....


              
              Exception during request processing: 
              Caused by javax.el.PropertyNotFoundException with message: "Target Unreachable, identifier 'authenticator' resolved to null" 
              
              



              So this raises the next question:
              how to get my Seam components to start up from Embedded Jboss??


              Hope I get an answer on this on ;-)

              • 4. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
                Pedro Sena Newbie

                Post your entire components.xml file plz

                • 5. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
                  Michał Gibowski Newbie

                  Coen,



                  Ok I found the issue, after two days of config file hell.

                  Could you please post what you found?
                  I have the same problem, although i'm not using Eclipse.

                  • 7. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
                    Anthony Ogier Newbie

                    Coen Damen wrote on Jan 12, 2009 15:00:


                    Ok I found the issue, after two days of config file hell.




                    I would be interested in your solution ... I'm facing similar problem here when trying to test a Seam application and checked the EmbeddedAndJavaSE documentation :




                    WARN  [org.jboss.seam.security.jaas.SeamLoginModule] Error invoking login method
                    javax.el.ELException: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/seamBlankEntityManagerFactory
                         at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:339)
                         at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                         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 org.jboss.seam.core.Expressions$2.invoke(Expressions.java:175)
                         at org.jboss.seam.security.jaas.SeamLoginModule.login(SeamLoginModule.java:109)
                         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 javax.security.auth.login.LoginContext.invoke(LoginContext.java:769)
                         at javax.security.auth.login.LoginContext.access$000(LoginContext.java:186)
                         at javax.security.auth.login.LoginContext$5.run(LoginContext.java:706)
                         at java.security.AccessController.doPrivileged(Native Method)
                         at javax.security.auth.login.LoginContext.invokeCreatorPriv(LoginContext.java:703)
                         at javax.security.auth.login.LoginContext.login(LoginContext.java:575)
                         at org.jboss.seam.security.Identity.authenticate(Identity.java:344)
                         at org.jboss.seam.security.Identity.authenticate(Identity.java:332)
                         at org.jboss.seam.security.Identity.login(Identity.java:259)
                         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.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                         at org.jboss.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:348)
                         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 org.jboss.seam.mock.AbstractSeamTest$Request.invokeMethod(AbstractSeamTest.java:463)
                         at org.jboss.seam.mock.AbstractSeamTest$Request.invokeAction(AbstractSeamTest.java:472)
                         at com.iorga.seam.blank.tests.LoginIntegrationTest$3.invokeApplication(LoginIntegrationTest.java:56)
                         at org.jboss.seam.mock.AbstractSeamTest$Request.invokeApplicationPhase(AbstractSeamTest.java:646)
                         at org.jboss.seam.mock.AbstractSeamTest$Request.emulateJsfLifecycle(AbstractSeamTest.java:595)
                         at org.jboss.seam.mock.AbstractSeamTest$Request.access$100(AbstractSeamTest.java:177)
                         at org.jboss.seam.mock.AbstractSeamTest$Request$2.doFilter(AbstractSeamTest.java:497)
                         at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83)
                         at org.jboss.seam.web.IdentityFilter.doFilter(IdentityFilter.java:40)
                         at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                         at org.jboss.seam.web.MultipartFilter.doFilter(MultipartFilter.java:90)
                         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:178)
                         at org.ajax4jsf.webapp.BaseFilter.handleRequest(BaseFilter.java:290)
                         at org.ajax4jsf.webapp.BaseFilter.processUploadsAndHandleRequest(BaseFilter.java:388)
                         at org.ajax4jsf.webapp.BaseFilter.doFilter(BaseFilter.java:515)
                         at org.jboss.seam.web.Ajax4jsfFilter.doFilter(Ajax4jsfFilter.java:56)
                         at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                         at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60)
                         at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69)
                         at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158)
                         at org.jboss.seam.mock.AbstractSeamTest$Request.run(AbstractSeamTest.java:491)
                         at com.iorga.seam.blank.tests.LoginIntegrationTest.testLogin(LoginIntegrationTest.java:66)
                         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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:643)
                         at org.testng.internal.Invoker.invokeMethod(Invoker.java:558)
                         at org.testng.internal.Invoker.invokeTestMethod(Invoker.java:722)
                         at org.testng.internal.Invoker.invokeTestMethods(Invoker.java:1023)
                         at org.testng.internal.TestMethodWorker.invokeTestMethods(TestMethodWorker.java:137)
                         at org.testng.internal.TestMethodWorker.run(TestMethodWorker.java:121)
                         at org.testng.TestRunner.runWorkers(TestRunner.java:891)
                         at org.testng.TestRunner.privateRun(TestRunner.java:615)
                         at org.testng.TestRunner.run(TestRunner.java:496)
                         at org.testng.SuiteRunner.runTest(SuiteRunner.java:323)
                         at org.testng.SuiteRunner.runSequentially(SuiteRunner.java:318)
                         at org.testng.SuiteRunner.privateRun(SuiteRunner.java:290)
                         at org.testng.SuiteRunner.run(SuiteRunner.java:195)
                         at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:904)
                         at org.testng.TestNG.runSuitesLocally(TestNG.java:871)
                         at org.testng.TestNG.run(TestNG.java:779)
                         at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75)
                         at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)
                    Caused by: java.lang.IllegalArgumentException: EntityManagerFactory not found in JNDI : java:/seamBlankEntityManagerFactory
                         at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:245)
                         at org.jboss.seam.persistence.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:78)
                         at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:107)
                         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:2249)
                         at org.jboss.seam.Component.unwrap(Component.java:2275)
                         at org.jboss.seam.Component.getInstance(Component.java:2041)
                         at org.jboss.seam.Component.getInstance(Component.java:1983)
                         at org.jboss.seam.Component.getInstance(Component.java:1977)
                         at org.jboss.seam.Component.getInstance(Component.java:1972)
                         at com.iorga.isi.EntityService.getEntityManager(EntityService.java:12)
                         at com.iorga.seam.blank.service.UtilisateurService.findWithLoginAndPassword(UtilisateurService.java:21)
                         at com.iorga.seam.blank.action.security.AuthenticatorAction.authenticate(AuthenticatorAction.java:34)
                         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.el.util.ReflectionUtil.invokeMethod(ReflectionUtil.java:335)
                         ... 77 more
                    Caused by: javax.naming.NameNotFoundException: seamBlankEntityManagerFactory not bound
                         at org.jnp.server.NamingServer.getBinding(NamingServer.java:542)
                         at org.jnp.server.NamingServer.getBinding(NamingServer.java:550)
                         at org.jnp.server.NamingServer.getObject(NamingServer.java:556)
                         at org.jnp.server.NamingServer.lookup(NamingServer.java:296)
                         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:669)
                         at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:629)
                         at javax.naming.InitialContext.lookup(InitialContext.java:392)
                         at org.jboss.seam.persistence.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:241)
                         ... 99 more



                    • 8. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
                      Anthony Ogier Newbie

                      That stack was with this configuration in components.xml file :


                      <persistence:managed-persistence-context name="entityManager" auto-create="true"
                        persistence-unit-jndi-name="java:seamBlankEntityManagerFactory"/>



                      Then, I tried this configuration :


                      <persistence:managed-persistence-context name="entityManager" auto-create="true"
                        entity-manager-factory="#{seamBlankEntityManagerFactory}"/>
                      
                      <persistence:entity-manager-factory name="seamBlankEntityManagerFactory"
                        persistence-unit-name="seamBlank"/>



                      And now I've got that stack trace :


                      org.jboss.seam.InstantiationException: Could not instantiate Seam component: seamBlankEntityManagerFactory
                           at org.jboss.seam.Component.newInstance(Component.java:2144)
                           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:304)
                           at org.jboss.seam.contexts.Contexts.startup(Contexts.java:278)
                           at org.jboss.seam.contexts.ServletLifecycle.endInitialization(ServletLifecycle.java:116)
                           at org.jboss.seam.init.Initialization.init(Initialization.java:740)
                           at org.jboss.seam.mock.AbstractSeamTest.startSeam(AbstractSeamTest.java:919)
                           at org.jboss.seam.mock.SeamTest.startSeam(SeamTest.java:58)
                           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.testng.internal.MethodHelper.invokeMethod(MethodHelper.java:643)
                           at org.testng.internal.Invoker.invokeConfigurationMethod(Invoker.java:445)
                           at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:162)
                           at org.testng.internal.Invoker.invokeConfigurations(Invoker.java:92)
                           at org.testng.SuiteRunner.privateRun(SuiteRunner.java:275)
                           at org.testng.SuiteRunner.run(SuiteRunner.java:195)
                           at org.testng.TestNG.createAndRunSuiteRunners(TestNG.java:904)
                           at org.testng.TestNG.runSuitesLocally(TestNG.java:871)
                           at org.testng.TestNG.run(TestNG.java:779)
                           at org.testng.remote.RemoteTestNG.run(RemoteTestNG.java:75)
                           at org.testng.remote.RemoteTestNG.main(RemoteTestNG.java:127)
                      Caused by: javax.persistence.PersistenceException: [PersistenceUnit: seamBlank] Unable to build EntityManagerFactory
                           at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
                           at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
                           at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
                           at org.jboss.seam.persistence.EntityManagerFactory.createEntityManagerFactory(EntityManagerFactory.java:85)
                           at org.jboss.seam.persistence.EntityManagerFactory.startup(EntityManagerFactory.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: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:2257)
                           at org.jboss.seam.Component.callCreateMethod(Component.java:2172)
                           at org.jboss.seam.Component.newInstance(Component.java:2132)
                           ... 21 more
                      Caused by: org.hibernate.HibernateException: The chosen transaction strategy requires access to the JTA TransactionManager
                           at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:361)
                           at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1327)
                           at org.hibernate.cfg.AnnotationConfiguration.buildSessionFactory(AnnotationConfiguration.java:874)
                           at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:669)
                           ... 34 more
                      



                      Here is my persistence.xml file :


                      <?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="seamBlank">
                          <provider>org.hibernate.ejb.HibernatePersistence</provider>
                          <jta-data-source>java:/seamBlankDatasource</jta-data-source>
                          <properties>
                            <property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
                            <property name="hibernate.hbm2ddl.auto" value="update"/>
                            <property name="hibernate.show_sql" value="true"/>
                            <property name="hibernate.format_sql" value="true"/>
                            <property name="jboss.entity.manager.factory.jndi.name" value="java:/seamBlankEntityManagerFactory"/>
                            <property name="hibernate.cache.provider_class" value="net.sf.ehcache.hibernate.EhCacheProvider" />
                            <property name="hibernate.cache.use_second_level_cache" value="true" />
                            <property name="hibernate.cache.use_query_cache" value="true" />
                            <property name="hibernate.default_batch_fetch_size" value="8" />
                            <property name="hibernate.order_updates" value="true" />
                            <property name="hibernate.order_inserts" value="true" />
                            <property name="hibernate.jdbc.batch_size" value="50" />
                          </properties>
                        </persistence-unit>
                      
                      </persistence>

                      • 9. Re: Tomcat 6 embedded JBoss EntityManagerFactory problem
                        Anthony Ogier Newbie

                        At last, it's finally working.


                        Here are the 2 properties I added to the persistence.xml file :


                        <property name="hibernate.transaction.factory_class" value="org.hibernate.transaction.JTATransactionFactory"/>
                        <property name="hibernate.transaction.manager_lookup_class" value="org.hibernate.transaction.JBossTransactionManagerLookup"/>