11 Replies Latest reply on Feb 10, 2012 11:55 AM by zeeman

    Solder with Jetty 8 Configuration

    Uros Majeric Newbie

      Hey,

       

      I am trying to set up a project wtih jetty 8 (8.1.0.v20120127) and Solder 3.1.0.Final with maven (mvn jetty:run). I am wondering if any of you have a simple project running with this configuration.

      I did all configuration needed, my jetty is started, but on pages I can't see any beans that I am registering using CDI. Attached is sample project - just run jetty with mvn jetty:run.

       

      thanks,

      Uros

        • 1. Re: Solder with Jetty 8 Configuration
          bram meijboom Newbie

          i think that you are missing the beanmanager registration in the jndi server

           

          my jetty-env, registers the beanmanager to the jndi service:

           

          <Configure id="webAppCtx" class="org.eclipse.jetty.webapp.WebAppContext">

                    <New id="appManager" class="org.eclipse.jetty.plus.jndi.Resource">

                              <Arg>

                                        <Ref id="webAppCtx" />

                              </Arg>

                              <Arg>BeanManager</Arg>

                              <Arg>

                                        <New class="javax.naming.Reference">

                                                  <Arg>javax.enterprise.inject.spi.BeanManager</Arg>

                                                  <Arg>org.jboss.weld.resources.ManagerObjectFactory</Arg>

                                                  <Arg />

                                        </New>

                              </Arg>

                    </New>

          </Configure>

           

          i use jetty-web for the jetty only web.xml stuff, like the listeners and to disable one seam filter:

           

          <?xml version="1.0"  encoding="ISO-8859-1"?>

          <!DOCTYPE Configure PUBLIC "-//Mort Bay Consulting//DTD Configure//EN" "http://jetty.mortbay.org/configure.dtd">

          <Configure class="org.eclipse.jetty.webapp.WebAppContext">

           

           

              <Call name="addEventListener">

                  <Arg>

                      <New class="org.jboss.weld.environment.servlet.Listener"></New>

                  </Arg>

              </Call>

           

           

              <Call name="addEventListener">

                  <Arg>

                      <New class="com.sun.faces.config.ConfigureListener"></New>

                  </Arg>

              </Call>

           

          <!-- gives a nullpointer if enabled with seam-transactions after version  3.0m5-->

              <Call name="addEventListener">

                  <Arg>

                      <New class="org.jboss.seam.faces.beanManager.BeanManagerServletContextListener"></New>

                  </Arg>

              </Call>

              <Get name="initParams">

                  <Call name="put">

                      <Arg>org.jboss.seam.transaction.disableListener</Arg>

                      <Arg>true</Arg>

                  </Call>

              </Get>

          </Configure>

           

          and in my web.xml i only have the beanmanager resource-ref that is used in jetty and tomcat (works with jboss/glassfish to) :

           

              <resource-env-ref>

                  <description>Object factory for the CDI Bean Manager</description>

                  <resource-env-ref-name>BeanManager</resource-env-ref-name>

                  <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>

              </resource-env-ref>

           

           

          I hopes this helps

          1 of 1 people found this helpful
          • 2. Re: Solder with Jetty 8 Configuration
            Uros Majeric Newbie

            hey,

             

            thanks mate, that worked. even without putting

             

            <resource-env-ref>

                    <description>Object factory for the CDI Bean Manager</description>

                    <resource-env-ref-name>BeanManager</resource-env-ref-name>

                    <resource-env-ref-type>javax.enterprise.inject.spi.BeanManager</resource-env-ref-type>

            </resource-env-ref>

             

            to the web.xml. Remember me to buy you a beer when we meet

             

            next job is to get persistence working - this is probaly this issue you were talking about. I'll get back to you if I'll get stuck

             

            cheers

            • 3. Re: Solder with Jetty 8 Configuration
              bram meijboom Newbie

              Ola,

               

              I just remembered why weld didn't load correctly in my app using jetty8. I have weld and jsf packaged in the war and due to classloading stuff in jetty the 'ServletContextHandler.Decorator' can not be found by weld and injection in listeners and filters is not supported , so no open session in view filter.

               

              Now the problem is that if i set weld to "provided" in my pom(so i can compile the code) and add a dependency to the jetty plugin entry where i configuere weld as "runtime", weld gets loaded by the main jetty classloader and bootstraps correctly. But it then gives all kinds of weird errors loading jsf and seam-faces.

               

              Using the seam-faces module and JSF2 dependencies in the war gives an error "jsf not configuered",  And if i add the JSF2 dependencies to the plugin so it gets also loaded by the main jetty classloader it gives a nice classcast exception "SeamApplicationWrapper$Proxy$_$$_WeldClientProxy cannot be cast to javassist.util.proxy.ProxyObject".     

               

              So i ended up disableling the transaction filter and packaging weld+seam+jsf in the application

               

              regards

              Bram

              • 4. Re: Solder with Jetty 8 Configuration
                zeeman Novice

                Hi,

                 

                Can someone please upload a simple working example with jetty 8 and Seam persisteance?

                 

                What would it take to get Seam 3 booking example working in jetty 8?

                • 5. Re: Solder with Jetty 8 Configuration
                  Uros Majeric Newbie

                  Hey,

                   

                  This is is how far I came: http://dl.dropbox.com/u/17816865/jetty8-demo2.zip - change database config in jetty8-demo/src/jetty/resources/jetty-env.xml file.

                  Exception I get:

                  java.lang.RuntimeException: Exception invoking method [markTransactionRollback] on object [org.jboss.seam.transaction.SimpleTransactionExceptionHandler@1b5b834], using arguments [org.jboss.solder.exception.control.CaughtException@1506701]

                            at org.jboss.solder.reflection.Reflections.invokeMethod(Reflections.java:480)

                            at org.jboss.solder.reflection.Reflections.invokeMethod(Reflections.java:403)

                            at org.jboss.solder.reflection.annotated.InjectableMethod.invoke(InjectableMethod.java:175)

                            at org.jboss.solder.exception.control.HandlerMethodImpl.notify(HandlerMethodImpl.java:182)

                            at org.jboss.solder.exception.control.ExceptionHandlerDispatch.executeHandlers(ExceptionHandlerDispatch.java:92)

                            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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

                            at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

                            at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

                            at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

                            at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

                            at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

                            at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

                            at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

                            at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

                            at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

                            at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569)

                            at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:559)

                            at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:554)

                            at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:74)

                            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)

                            at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)

                            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)

                            at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)

                            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)

                            at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)

                            at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)

                            at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)

                            at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412)

                            at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)

                            at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)

                            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)

                            at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)

                            at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)

                            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)

                            at org.eclipse.jetty.server.Server.handle(Server.java:351)

                            at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:451)

                            at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:916)

                            at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)

                            at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)

                            at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)

                            at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)

                            at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)

                            at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)

                            at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)

                            at java.lang.Thread.run(Thread.java:662)

                  Caused by:  java.lang.RuntimeException: java.lang.NullPointerException

                            at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:111)

                            at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:45)

                            at org.jboss.solder.bean.ImmutableBean.create(ImmutableBean.java:81)

                            at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)

                            at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)

                            at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:104)

                            at org.jboss.weld.proxies.EntityManager$ManagedPersistenceContext$8429914$Proxy$_$$_WeldClientProxy.getTransaction(EntityManager$ManagedPersistenceContext$8429914$Proxy$_$$_WeldClientProxy.java)

                            at org.jboss.seam.transaction.EntityTransaction.getDelegate(EntityTransaction.java:59)

                            at org.jboss.seam.transaction.EntityTransaction.getStatus(EntityTransaction.java:108)

                            at org.jboss.seam.transaction.EntityTransaction$Proxy$_$$_WeldClientProxy.getStatus(EntityTransaction$Proxy$_$$_WeldClientProxy.java)

                            at org.jboss.seam.transaction.SimpleTransactionExceptionHandler.markTransactionRollback(SimpleTransactionExceptionHandler.java:47)

                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                            at java.lang.reflect.Method.invoke(Method.java:597)

                            at org.jboss.solder.reflection.Reflections.invokeMethod(Reflections.java:474)

                            at org.jboss.solder.reflection.Reflections.invokeMethod(Reflections.java:403)

                            at org.jboss.solder.reflection.annotated.InjectableMethod.invoke(InjectableMethod.java:175)

                            at org.jboss.solder.exception.control.HandlerMethodImpl.notify(HandlerMethodImpl.java:182)

                            at org.jboss.solder.exception.control.ExceptionHandlerDispatch.executeHandlers(ExceptionHandlerDispatch.java:92)

                            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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

                            at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

                            at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

                            at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

                            at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

                            at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

                            at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

                            at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

                            at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

                            at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

                            at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569)

                            at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:559)

                            at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:554)

                            at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:74)

                            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)

                            at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)

                            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)

                            at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)

                            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)

                            at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)

                            at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)

                            at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)

                            at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412)

                            at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)

                            at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)

                            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)

                            at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)

                            at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)

                            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)

                            at org.eclipse.jetty.server.Server.handle(Server.java:351)

                            at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:451)

                            at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:916)

                            at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)

                            at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)

                            at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)

                            at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)

                            at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)

                            at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)

                            at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)

                            at java.lang.Thread.run(Thread.java:662)

                  Caused by: java.lang.NullPointerException

                            at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73)

                            at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:115)

                            at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149)

                            at org.hibernate.ejb.AbstractEntityManagerImpl.joinTransaction(AbstractEntityManagerImpl.java:1201)

                            at org.hibernate.ejb.AbstractEntityManagerImpl.postInit(AbstractEntityManagerImpl.java:172)

                            at org.hibernate.ejb.EntityManagerImpl.<init>(EntityManagerImpl.java:90)

                            at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:111)

                            at org.hibernate.ejb.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:106)

                            at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:95)

                            at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:45)

                            at org.jboss.solder.bean.ImmutableBean.create(ImmutableBean.java:81)

                            at org.jboss.weld.context.AbstractContext.get(AbstractContext.java:107)

                            at org.jboss.weld.bean.proxy.ContextBeanInstance.getInstance(ContextBeanInstance.java:90)

                            at org.jboss.weld.bean.proxy.ProxyMethodHandler.invoke(ProxyMethodHandler.java:104)

                            at org.jboss.weld.proxies.EntityManager$ManagedPersistenceContext$8429914$Proxy$_$$_WeldClientProxy.getTransaction(EntityManager$ManagedPersistenceContext$8429914$Proxy$_$$_WeldClientProxy.java)

                            at org.jboss.seam.transaction.EntityTransaction.getDelegate(EntityTransaction.java:59)

                            at org.jboss.seam.transaction.EntityTransaction.getStatus(EntityTransaction.java:108)

                            at org.jboss.seam.transaction.EntityTransaction$Proxy$_$$_WeldClientProxy.getStatus(EntityTransaction$Proxy$_$$_WeldClientProxy.java)

                            at org.jboss.seam.transaction.SimpleTransactionExceptionHandler.markTransactionRollback(SimpleTransactionExceptionHandler.java:47)

                            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

                            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)

                            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)

                            at java.lang.reflect.Method.invoke(Method.java:597)

                            at org.jboss.solder.reflection.Reflections.invokeMethod(Reflections.java:474)

                            at org.jboss.solder.reflection.Reflections.invokeMethod(Reflections.java:403)

                            at org.jboss.solder.reflection.annotated.InjectableMethod.invoke(InjectableMethod.java:175)

                            at org.jboss.solder.exception.control.HandlerMethodImpl.notify(HandlerMethodImpl.java:182)

                            at org.jboss.solder.exception.control.ExceptionHandlerDispatch.executeHandlers(ExceptionHandlerDispatch.java:92)

                            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.weld.util.reflection.SecureReflections$13.work(SecureReflections.java:264)

                            at org.jboss.weld.util.reflection.SecureReflectionAccess.run(SecureReflectionAccess.java:52)

                            at org.jboss.weld.util.reflection.SecureReflectionAccess.runAsInvocation(SecureReflectionAccess.java:137)

                            at org.jboss.weld.util.reflection.SecureReflections.invoke(SecureReflections.java:260)

                            at org.jboss.weld.introspector.jlr.WeldMethodImpl.invokeOnInstance(WeldMethodImpl.java:170)

                            at org.jboss.weld.introspector.ForwardingWeldMethod.invokeOnInstance(ForwardingWeldMethod.java:51)

                            at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:154)

                            at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:241)

                            at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:229)

                            at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:207)

                            at org.jboss.weld.manager.BeanManagerImpl.notifyObservers(BeanManagerImpl.java:569)

                            at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:559)

                            at org.jboss.weld.manager.BeanManagerImpl.fireEvent(BeanManagerImpl.java:554)

                            at org.jboss.solder.servlet.exception.CatchExceptionFilter.doFilter(CatchExceptionFilter.java:74)

                            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)

                            at org.jboss.solder.servlet.event.ServletEventBridgeFilter.doFilter(ServletEventBridgeFilter.java:74)

                            at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1336)

                            at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:483)

                            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:119)

                            at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:521)

                            at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:233)

                            at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1065)

                            at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:412)

                            at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:192)

                            at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:999)

                            at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:117)

                            at org.eclipse.jetty.server.handler.ContextHandlerCollection.handle(ContextHandlerCollection.java:250)

                            at org.eclipse.jetty.server.handler.HandlerCollection.handle(HandlerCollection.java:149)

                            at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:111)

                            at org.eclipse.jetty.server.Server.handle(Server.java:351)

                            at org.eclipse.jetty.server.AbstractHttpConnection.handleRequest(AbstractHttpConnection.java:451)

                            at org.eclipse.jetty.server.AbstractHttpConnection$RequestHandler.headerComplete(AbstractHttpConnection.java:916)

                            at org.eclipse.jetty.http.HttpParser.parseNext(HttpParser.java:634)

                            at org.eclipse.jetty.http.HttpParser.parseAvailable(HttpParser.java:230)

                            at org.eclipse.jetty.server.AsyncHttpConnection.handle(AsyncHttpConnection.java:76)

                            at org.eclipse.jetty.io.nio.SelectChannelEndPoint.handle(SelectChannelEndPoint.java:609)

                            at org.eclipse.jetty.io.nio.SelectChannelEndPoint$1.run(SelectChannelEndPoint.java:45)

                            at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:599)

                            at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:534)

                            at java.lang.Thread.run(Thread.java:662)

                   

                   

                  bram meijboom: is it possible for you to attach a simple app how you configured the project?

                   

                  Thanks,

                  Uros

                   

                  Message was edited by: Uros Majeric

                  • 6. Re: Solder with Jetty 8 Configuration
                    bram meijboom Newbie

                    Caused by: java.lang.NullPointerException

                              at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.getStatus(JtaStatusHelper.java:73)

                              at org.hibernate.engine.transaction.internal.jta.JtaStatusHelper.isActive(JtaStatusHelper.java:115)

                              at org.hibernate.engine.transaction.internal.jta.CMTTransaction.join(CMTTransaction.java:149)

                     

                    looks like you have JTA configuered, your missing the resource local or the EntityTransaction

                     

                    persistence.xml use resource local transactions:

                     


                    <persistence-unit name="sampleDatabase" transaction-type="RESOURCE_LOCAL">

                     

                    beans.xml use transaction interceptor for the @Transactional annotation:

                        <interceptors>

                            <class>org.jboss.seam.transaction.TransactionInterceptor</class>

                        </interceptors>

                     

                    in seam-beans.xml select the EntityTransaction and SeSynchronizations:

                     

                        <t:EntityTransaction>

                            <s:modifies/>

                        </t:EntityTransaction>

                          <t:SeSynchronizations>

                            <s:modifies/>

                        </t:SeSynchronizations>   

                     

                     

                    use some emf producer class so you can use @Inject EntityManager entityManager, I got 2 so one is annotated with @Default, other has some custom identifier, the class itself doesnt need anything:

                     

                    public class EntityManagerProducer {

                     

                        @Produces

                        @ExtensionManaged

                        @RequestScoped

                        @Default

                        @PersistenceUnit(unitName = "sampleDatabase")

                        EntityManagerFactory sampleEmf;

                    }

                     

                    and now annotate your store, delete and so on with @Transactional and your good to go. In jetty8 (dunno when it changed) no transaction filter, so no open transaction in view stuff. So expect lazyinitialization exceptions

                     

                    grtz

                    • 7. Re: Solder with Jetty 8 Configuration
                      Uros Majeric Newbie

                      Finally managed to get it work. Thank you very much bram

                       

                      Very basic working example with Jetty 8 and Seam persistence 3.1.0.Final (zeeman was asking for) can be downloaded here http://dl.dropbox.com/u/17816865/jetty8-demo3.zip

                      change jetty8-demo/src/main/resources/META-INF/persistence.xml credentials to your needs.

                       

                      What would I have to change to use JTA datasource? This way application would be easy portable to any environment (GF, JBoss AS, etc.).

                       

                      cheers

                      • 8. Re: Solder with Jetty 8 Configuration
                        bram meijboom Newbie

                        What would I have to change to use JTA datasource? This way application would be easy portable to any environment (GF, JBoss AS, etc.).

                         

                        you have to configuere a JTA 'driver', i think atomikos has some examples about how to configuere that in jetty, then change the transaction-type in the persistence.xml to JTA and remove the transaction configuration in the seam-beans.xml. I have no clue if that works though (could be that some JEE classes are missing because it could be that jetty+atomikos still is not a complete transaction container).

                         

                        The way i do it is to have 2 profiles in my pom, jetty and jee and they each have different resources(different persistence.xml and seam-beans.xml). the jetty profile also has the jetty-env and jetty-web xml files and my glassfish one also has a glassfish-web.xml. The main difference between them are the dependencies that needs to be packaged, in case of a JEE container almost everything is provided already (weld, hibernate, JEE interfaces, jax-rs and so on) but those need to be packaged into the war if you deploy on jetty, so you end up with 2 profiles anyway...

                         

                        grtz

                        • 9. Re: Solder with Jetty 8 Configuration
                          zeeman Novice

                          Would not using an extended entity manager avoid lazy loaded exceptions and there will be no need for open in view filter?

                          • 10. Re: Solder with Jetty 8 Configuration
                            bram meijboom Newbie

                            The extended entitymanager is for things like automatic transaction enlistment (don't have to call userTransaction.enlist(em) and so on) and some hiding of differences between an container managed entitymanager and a application managed entitymanager.

                             

                            The open session(transaction) in view pattern is so there is a transaction(open entitymanager) in every JSF phase and not just in the "call application" phase. Without it i get those lazy exceptions in the 'validate' and 'bind' phases when a managed collection is changed. eg i add a entity in a 'OneToMany' relation and during the bind phase the collection.add of the managed collection is called that throws the exception cause there is no transaction in progress.

                            • 11. Re: Solder with Jetty 8 Configuration
                              zeeman Novice

                              Correct me if I'm wrong but in Spring you'll have to go with open session in view pattern to avoid lazy exceptions, but with Seam (details in persistence docs) no need for open session in view pattern. Using a conversation will keep the extended entity manager open, no lazy exceptions. What am I missing?

                               

                              In jetty project uploaded above, it uses Seam persistence, if Seam faces is used which uses a transaction for each faces request (assums each request needs to do something with DB), would there be any need for open session in view pattern?