6 Replies Latest reply on Dec 6, 2007 9:05 PM by Mirko Adari

    Seam-managed persistence contexts and Glassfish

    Gianni Newbie

      Has anyone had any success using SMPCs and Glassfish?
      All the Glassfish examples I have come accross use a standard JPA persistence context rather than seam-managed i.e.

      @PersistenceContext
      EntityManager entityManager;

      instead of..
      @In
      EntityManager entityManager;


      In the Seam documentation for SMPC it says to make sure the EntityManagerFactory is bound into JNDI, which under JBoss is done with a persistence unit property.
      <property name="jboss.entity.manager.factory.jndi.name" value="java:comp/env/persistence/My-PU"/>


      I can't seem to find any way to do this globally under Glassfish and the only solutions I have come accross is to bind the EntityManagerFactory on an individual ejb basis in ejb-jar.xml

      <enterprise-beans>
       <session>
       <ejb-name>MyBean</ejb-name>
       <persistence-unit-ref>
       <persistence-unit-ref-name>persistence/My-PU</persistence-unit-ref-name>
       <persistence-unit-name>My-PU</persistence-unit-name>
       </persistence-unit-ref>
       </session>
      </enterprise-beans>


      This approach works fine fine for session beans but doesn't cater for non-ejb components such as the seam EntityConverter. When I try to use <s:convertEntity /> in a select list it fails to find the Persistence Unit in JNDI.

      Caused by: javax.naming.NameNotFoundException: No object bound to name java:comp/env/persistence/My-PU
      at com.sun.enterprise.naming.NamingManagerImpl.lookup(NamingManagerImpl.java:751)
      at com.sun.enterprise.naming.java.javaURLContext.lookup(javaURLContext.java:156)
      at com.sun.enterprise.naming.SerialContext.lookup(SerialContext.java:307)
      at javax.naming.InitialContext.lookup(InitialContext.java:392)
      at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:160)
      ... 65 more

      Any suggestions as to how to overcome this problem would be much appreciated.

        • 1. Re: Seam-managed persistence contexts and Glassfish
          Gavin King Master

          The jpa and hibernate2 examples depoy on GlassFish with a SMPC.

          • 2. Re: Seam-managed persistence contexts and Glassfish
            Gianni Newbie

            Thanks
            I'm modifying the jpa example to work with my app but I now get an exception at startup.

            org.hibernate.dialect.PostgreSQLDialect cannot be cast to org.hibernate.dialect.Dialect


            persistence.xml
            <?xml version="1.0" encoding="UTF-8"?>
            <persistence version="1.0" 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">
             <persistence-unit name="My-PU" transaction-type="JTA">
             <provider>org.hibernate.ejb.HibernatePersistence</provider>
             <jta-data-source>jdbc/orpello</jta-data-source>
             <properties>
             <property name="hibernate.cache.use_second_level_cache" value="true" />
             <property name="hibernate.cache.provider_class" value="org.hibernate.cache.EhCacheProvider"/>
             <property name="net.sf.ehcache.configurationResourceName" value="/ehcache.xml" />
             <property name="hibernate.dialect" value="org.hibernate.dialect.PostgreSQLDialect" />
             <property name="hibernate.show_sql" value="true" />
             <property name="hibernate.transaction.manager_lookup_class"
             value="org.hibernate.transaction.SunONETransactionManagerLookup"/>
             </properties>
             </persistence-unit>
            </persistence>


            components.xml
            <?xml version="1.0" encoding="UTF-8"?>
            <components xmlns="http://jboss.com/products/seam/components"
             xmlns:core="http://jboss.com/products/seam/core"
             xmlns:security="http://jboss.com/products/seam/security"
             xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
             xsi:schemaLocation=
             "http://jboss.com/products/seam/core http://jboss.com/products/seam/core-1.2.xsd
             http://jboss.com/products/seam/security http://jboss.com/products/seam/security-1.2.xsd
             http://jboss.com/products/seam/components http://jboss.com/products/seam/components-1.2.xsd">
            
             <core:init jndi-pattern="java:comp/env/orpello-ejb/#{ejbName}/local" debug="true"/>
            
             <core:entity-manager-factory name="My-PU"/>
            
             <core:managed-persistence-context name="entityManager"
             auto-create="true"
             entity-manager-factory="#{My-PU}"/>
            </components>


            [#|2007-03-13T06:45:53.771+0100|SEVERE|sun-appserver-pe9.0|javax.enterprise.system.container.web|_ThreadID=11;_ThreadName=httpWorkerThread-4848-0;_RequestID=eccb6a64-1a7e-4cf6-a27f-155f4ccab5e7;|WebModule[/Orpello-war]Exception sending context initialized event to listener instance of class org.jboss.seam.servlet.SeamListener
            javax.persistence.PersistenceException: org.hibernate.HibernateException: Could not instantiate dialect class
            at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:217)
            at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:114)
            at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
            at org.jboss.seam.core.EntityManagerFactory.startup(EntityManagerFactory.java:74)
            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:589)
            at org.jboss.seam.util.Reflections.invoke(Reflections.java:20)
            at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
            at org.jboss.seam.Component.callComponentMethod(Component.java:1842)
            at org.jboss.seam.Component.callCreateMethod(Component.java:1757)
            at org.jboss.seam.Component.newInstance(Component.java:1746)
            at org.jboss.seam.contexts.Lifecycle.startup(Lifecycle.java:175)
            at org.jboss.seam.contexts.Lifecycle.endInitialization(Lifecycle.java:145)
            at org.jboss.seam.init.Initialization.init(Initialization.java:506)
            at org.jboss.seam.servlet.SeamListener.contextInitialized(SeamListener.java:33)
            at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4236)
            at org.apache.catalina.core.StandardContext.start(StandardContext.java:4760)
            at com.sun.enterprise.web.WebModule.start(WebModule.java:292)
            at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:833)
            at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:817)
            at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:659)
            at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1468)
            at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1133)
            at com.sun.enterprise.web.WebContainer.loadJ2EEApplicationWebModules(WebContainer.java:1058)
            at com.sun.enterprise.server.TomcatApplicationLoader.load(TomcatApplicationLoader.java:128)
            at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:322)
            at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:196)
            at com.sun.enterprise.server.ApplicationManager.applicationDeployed(ApplicationManager.java:633)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.invokeApplicationDeployEventListener(AdminEventMulticaster.java:908)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.handleApplicationDeployEvent(AdminEventMulticaster.java:892)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.processEvent(AdminEventMulticaster.java:445)
            at com.sun.enterprise.admin.event.AdminEventMulticaster.multicastEvent(AdminEventMulticaster.java:160)
            at com.sun.enterprise.admin.server.core.DeploymentNotificationHelper.multicastEvent(DeploymentNotificationHelper.java:296)
            at com.sun.enterprise.deployment.phasing.DeploymentServiceUtils.multicastEvent(DeploymentServiceUtils.java:203)
            at com.sun.enterprise.deployment.phasing.ServerDeploymentTarget.sendStartEvent(ServerDeploymentTarget.java:285)
            at com.sun.enterprise.deployment.phasing.ApplicationStartPhase.runPhase(ApplicationStartPhase.java:119)
            at com.sun.enterprise.deployment.phasing.DeploymentPhase.executePhase(DeploymentPhase.java:95)
            at com.sun.enterprise.deployment.phasing.PEDeploymentService.executePhases(PEDeploymentService.java:871)
            at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:541)
            at com.sun.enterprise.deployment.phasing.PEDeploymentService.start(PEDeploymentService.java:585)
            at com.sun.enterprise.admin.mbeans.ApplicationsConfigMBean.start(ApplicationsConfigMBean.java:719)
            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:589)
            at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:353)
            at com.sun.enterprise.admin.MBeanHelper.invokeOperationInBean(MBeanHelper.java:336)
            at com.sun.enterprise.admin.config.BaseConfigMBean.invoke(BaseConfigMBean.java:448)
            at com.sun.jmx.interceptor.DefaultMBeanServerInterceptor.invoke(DefaultMBeanServerInterceptor.java:836)
            at com.sun.jmx.mbeanserver.JmxMBeanServer.invoke(JmxMBeanServer.java:761)
            at sun.reflect.GeneratedMethodAccessor16.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:589)
            at com.sun.enterprise.admin.util.proxy.ProxyClass.invoke(ProxyClass.java:77)
            at $Proxy1.invoke(Unknown Source)
            at com.sun.enterprise.admin.server.core.jmx.SunoneInterceptor.invoke(SunoneInterceptor.java:297)
            at com.sun.enterprise.admin.jmx.remote.server.callers.InvokeCaller.call(InvokeCaller.java:56)
            at com.sun.enterprise.admin.jmx.remote.server.MBeanServerRequestHandler.handle(MBeanServerRequestHandler.java:142)
            at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.processRequest(RemoteJmxConnectorServlet.java:109)
            at com.sun.enterprise.admin.jmx.remote.server.servlet.RemoteJmxConnectorServlet.doPost(RemoteJmxConnectorServlet.java:180)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:820)
            at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:278)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
            at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
            at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
            at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
            at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
            at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processNonBlocked(ProcessorTask.java:574)
            at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:844)
            at com.sun.enterprise.web.connector.grizzly.ReadTask.executeProcessorTask(ReadTask.java:287)
            at com.sun.enterprise.web.connector.grizzly.ReadTask.doTask(ReadTask.java:212)
            at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
            at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
            Caused by: org.hibernate.HibernateException: Could not instantiate dialect class
            at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:84)
            at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:42)
            at org.hibernate.cfg.SettingsFactory.determineDialect(SettingsFactory.java:397)
            at org.hibernate.cfg.SettingsFactory.buildSettings(SettingsFactory.java:111)
            at org.hibernate.cfg.Configuration.buildSettings(Configuration.java:1928)
            at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1211)
            at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:631)
            at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:760)
            at org.hibernate.ejb.Ejb3Configuration.createFactory(Ejb3Configuration.java:151)
            at org.hibernate.ejb.Ejb3Configuration.createEntityManagerFactory(Ejb3Configuration.java:205)
            ... 87 more
            Caused by: java.lang.ClassCastException: org.hibernate.dialect.PostgreSQLDialect cannot be cast to org.hibernate.dialect.Dialect
            at org.hibernate.dialect.DialectFactory.buildDialect(DialectFactory.java:78)
            ... 96 more


            Am I missing something to get this to work with PostgreSQL?

            • 3. Re: Seam-managed persistence contexts and Glassfish
              Gianni Newbie

              Still unable to get SMPCs working with an enterprise app and PostgreSQL, although the jpa example app works fine.

              Anyone got any ideas why I'm receiving the following ClassCastException?

              Caused by: java.lang.ClassCastException: java.lang.Long
              at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:169)



              [#|2007-03-16T14:43:58.503+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=17;_ThreadName=httpWorkerThread-8181-1;CommonLookupBean;|EJB5018: An exception was thrown during an ejb invocation on [CommonLookupBean]|#]

              [#|2007-03-16T14:43:58.504+0100|INFO|sun-appserver-pe9.0|javax.enterprise.system.container.ejb|_ThreadID=17;_ThreadName=httpWorkerThread-8181-1;|
              javax.ejb.EJBException
              at com.sun.ejb.containers.BaseContainer.processSystemException(BaseContainer.java:3730)
              at com.sun.ejb.containers.BaseContainer.completeNewTx(BaseContainer.java:3630)
              at com.sun.ejb.containers.BaseContainer.postInvokeTx(BaseContainer.java:3431)
              at com.sun.ejb.containers.StatefulSessionContainer.postInvokeTx(StatefulSessionContainer.java:1292)
              at com.sun.ejb.containers.BaseContainer.postInvoke(BaseContainer.java:1247)
              at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:192)
              at com.sun.ejb.containers.EJBLocalObjectInvocationHandlerDelegate.invoke(EJBLocalObjectInvocationHandlerDelegate.java:71)
              at $Proxy70.loadPersonTitles(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:20)
              at org.jboss.seam.intercept.RootInvocationContext.proceed(RootInvocationContext.java:31)
              at org.jboss.seam.intercept.ClientSideInterceptor$1.proceed(ClientSideInterceptor.java:72)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:57)
              at org.jboss.seam.interceptors.RemoveInterceptor.aroundInvoke(RemoveInterceptor.java:40)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
              at org.jboss.seam.interceptors.SynchronizationInterceptor.aroundInvoke(SynchronizationInterceptor.java:31)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
              at org.jboss.seam.intercept.ClientSideInterceptor.invoke(ClientSideInterceptor.java:50)
              at org.javassist.tmp.java.lang.Object_$$_javassist_0.loadPersonTitles(Object_$$_javassist_0.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:20)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
              at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
              at org.jboss.seam.Component.getInstanceFromFactory(Component.java:1696)
              at org.jboss.seam.Component.getInstance(Component.java:1633)
              at org.jboss.seam.Component.getInstance(Component.java:1610)
              at org.jboss.seam.Component.getInstance(Component.java:1604)
              at org.jboss.seam.jsf.SeamELResolver.getValue(SeamELResolver.java:49)
              at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
              at com.sun.faces.el.FacesCompositeELResolver.getValue(FacesCompositeELResolver.java:58)
              at com.sun.el.parser.AstIdentifier.getValue(AstIdentifier.java:65)
              at com.sun.el.ValueExpressionImpl.getValue(ValueExpressionImpl.java:192)
              at com.sun.facelets.el.TagValueExpression.getValue(TagValueExpression.java:71)
              at javax.faces.component.UISelectItems.getValue(UISelectItems.java:132)
              at org.jboss.seam.ui.UISelectItems.getValue(UISelectItems.java:188)
              at com.sun.faces.renderkit.RenderKitUtils.getSelectItems(RenderKitUtils.java:308)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.getOptionNumber(MenuRenderer.java:506)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.renderSelect(MenuRenderer.java:482)
              at com.sun.faces.renderkit.html_basic.MenuRenderer.encodeEnd(MenuRenderer.java:447)
              at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:847)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:893)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
              at javax.faces.render.Renderer.encodeChildren(Renderer.java:137)
              at javax.faces.component.UIComponentBase.encodeChildren(UIComponentBase.java:827)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:883)
              at javax.faces.component.UIComponent.encodeAll(UIComponent.java:889)
              at com.sun.facelets.FaceletViewHandler.renderView(FaceletViewHandler.java:578)
              at com.sun.faces.lifecycle.RenderResponsePhase.execute(RenderResponsePhase.java:108)
              at com.sun.faces.lifecycle.LifecycleImpl.phase(LifecycleImpl.java:266)
              at com.sun.faces.lifecycle.LifecycleImpl.render(LifecycleImpl.java:159)
              at javax.faces.webapp.FacesServlet.service(FacesServlet.java:245)
              at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:397)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
              at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:57)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
              at org.jboss.seam.web.RedirectFilter.doFilter(RedirectFilter.java:45)
              at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:216)
              at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:184)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:276)
              at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
              at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
              at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:240)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:179)
              at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
              at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:73)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:182)
              at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
              at com.sun.enterprise.web.VirtualServerPipeline.invoke(VirtualServerPipeline.java:120)
              at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
              at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:137)
              at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:566)
              at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:536)
              at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:939)
              at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:231)
              at com.sun.enterprise.web.connector.grizzly.ProcessorTask.invokeAdapter(ProcessorTask.java:667)
              at com.sun.enterprise.web.connector.grizzly.ProcessorTask.processBlocked(ProcessorTask.java:607)
              at com.sun.enterprise.web.connector.grizzly.ProcessorTask.process(ProcessorTask.java:842)
              at com.sun.enterprise.web.connector.grizzly.ProcessorTask.doTask(ProcessorTask.java:436)
              at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:252)
              at com.sun.enterprise.web.connector.grizzly.WorkerThread.run(WorkerThread.java:75)
              Caused by: java.lang.ClassCastException: java.lang.Long
              at org.jboss.seam.core.ManagedPersistenceContext.getEntityManagerFactoryFromJndiOrValueBinding(ManagedPersistenceContext.java:169)
              at org.jboss.seam.core.ManagedPersistenceContext.initEntityManager(ManagedPersistenceContext.java:77)
              at org.jboss.seam.core.ManagedPersistenceContext.getEntityManager(ManagedPersistenceContext.java:105)
              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:20)
              at org.jboss.seam.util.Reflections.invokeAndWrap(Reflections.java:123)
              at org.jboss.seam.Component.callComponentMethod(Component.java:1834)
              at org.jboss.seam.Component.unwrap(Component.java:1860)
              at org.jboss.seam.Component.getInstance(Component.java:1657)
              at org.jboss.seam.Component.getInstance(Component.java:1610)
              at org.jboss.seam.Component.getValueToInject(Component.java:1885)
              at org.jboss.seam.Component.injectAttributes(Component.java:1368)
              at org.jboss.seam.Component.inject(Component.java:1195)
              at org.jboss.seam.interceptors.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:46)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
              at org.jboss.seam.interceptors.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:27)
              at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:69)
              at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:103)
              at org.jboss.seam.intercept.SessionBeanInterceptor.aroundInvoke(SessionBeanInterceptor.java:53)
              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 com.sun.ejb.containers.interceptors.AroundInvokeInterceptor$1.run(InterceptorManager.java:485)
              at java.security.AccessController.doPrivileged(Native Method)
              at com.sun.ejb.containers.interceptors.AroundInvokeInterceptor.intercept(InterceptorManager.java:479)
              at com.sun.ejb.containers.interceptors.AroundInvokeChainImpl.invokeNext(InterceptorManager.java:414)
              at com.sun.ejb.containers.interceptors.InterceptorManager.intercept(InterceptorManager.java:188)
              at com.sun.ejb.containers.BaseContainer.intercept(BaseContainer.java:3839)
              at com.sun.ejb.containers.EJBLocalObjectInvocationHandler.invoke(EJBLocalObjectInvocationHandler.java:184)
              ... 83 more
              |#]


              • 4. Re: Seam-managed persistence contexts and Glassfish
                Mirko Adari Novice

                No solution here as well? The examples ship with war deployment. Every EAR deployment has been a failure and no answers anywhere. It`s easy to point to JPA example, but I have a question then - why is JBoss an EAR deployment while glassfish WAR deployment?

                • 5. Re: Seam-managed persistence contexts and Glassfish
                  Pete Muir Master

                  Did you look at the jee example? Thats an EJB3/Ear app that runs ootb on glassfish.

                  • 6. Re: Seam-managed persistence contexts and Glassfish
                    Mirko Adari Novice

                    That does not use seam managed persistence.