1 2 Previous Next 18 Replies Latest reply on Jul 10, 2011 2:47 PM by Thomas Andraschko

    Seam with OWB

    Thomas Andraschko Newbie

      Hi,


      because of the performance, i would like to use Seam with OWB.
      (http://2.bp.blogspot.com/-hGU51hH2tlQ/TZXOqKpm3uI/AAAAAAAAAbo/PKkIP81iYQw/s1600/benchmark20113103direct.png)


      Did anyone tried to use Seam with OWB?

        • 1. Re: Seam with OWB
          Shane Bryzak Master

          Out of interest, where is the source code for this benchmark?

          • 3. Re: Seam with OWB
            Jason Porter Master

            Interesting. Assuming the code is out there, this is certainly something we'd like to examine.


            WRT the original topic, some modules have been tested with OWB, some have not. Feel free to try it out and let us know what problems exist. Even better would be to fork the project and create Arquillian tests and contribute them back :)

            • 4. Re: Seam with OWB
              Shane Bryzak Master

              There's no source code that I could find on that site for the benchmarks, just a vague description of what they are.  Without source code and/or information describing how to reproduce these tests, I'm afraid that the results have little value.

              • 5. Re: Seam with OWB
                Thomas Andraschko Newbie

                It's not for performance only, there are also some problems if you injecting something in viewscoped beans because Weld's ManagedBean is not serializable. (I saw a comment that it would be fixed with 1.2-betaX but i cant find those betas...)


                Also seam faces does not work with OWB (on Tomcat7):



                07.06.2011 13:25:17 org.apache.myfaces.webapp.AbstractFacesInitializer initFaces
                SCHWERWIEGEND: An error occured while initializing MyFaces: null
                java.util.NoSuchElementException
                     at java.util.HashMap$HashIterator.nextEntry(HashMap.java:796)
                     at java.util.HashMap$KeyIterator.next(HashMap.java:828)
                     at org.jboss.seam.faces.event.AbstractListener.getListeners(AbstractListener.java:25)
                     at org.jboss.seam.faces.event.DelegatingSystemEventListener.getEventListeners(DelegatingSystemEventListener.java:43)
                     at org.jboss.seam.faces.event.DelegatingSystemEventListener.processEvent(DelegatingSystemEventListener.java:34)
                     at javax.faces.event.SystemEvent.processListener(SystemEvent.java:43)
                     at org.apache.myfaces.application.ApplicationImpl._traverseListenerList(ApplicationImpl.java:2105)
                     at org.apache.myfaces.application.ApplicationImpl.access$000(ApplicationImpl.java:118)
                     at org.apache.myfaces.application.ApplicationImpl$SystemListenerEntry.publish(ApplicationImpl.java:2292)
                     at org.apache.myfaces.application.ApplicationImpl.publishEvent(ApplicationImpl.java:537)
                     at javax.faces.application.ApplicationWrapper.publishEvent(ApplicationWrapper.java:329)
                     at org.apache.myfaces.webapp.AbstractFacesInitializer._dispatchApplicationEvent(AbstractFacesInitializer.java:248)
                     at org.apache.myfaces.webapp.AbstractFacesInitializer.initFaces(AbstractFacesInitializer.java:140)
                     at org.apache.myfaces.webapp.StartupServletContextListener.contextInitialized(StartupServletContextListener.java:111)
                     at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4521)
                     at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5004)
                     at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:4999)
                     at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                     at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                     at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                     at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                     at java.lang.Thread.run(Thread.java:662)
                07.06.2011 13:25:17 org.apache.catalina.core.StandardContext startInternal
                SCHWERWIEGEND: Error listenerStart
                07.06.2011 13:25:17 org.apache.catalina.core.StandardContext startInternal
                SCHWERWIEGEND: Context [/my-webapp] startup failed due to previous errors
                07.06.2011 13:25:17 org.apache.webbeans.web.lifecycle.WebContainerLifecycle afterStopApplication
                INFO: OpenWebBeans Container was stopped for context path, [/my-webapp]





                • 6. Re: Seam with OWB
                  Thomas Andraschko Newbie

                  This could be fixed if we check that the iterator is not empty:


                      @SuppressWarnings("unchecked")
                      protected List<T> getListeners(Class<? extends T>... classes) {
                           List<T> listeners = new ArrayList<T>();
                          for (Class<? extends T> clazz : classes) {
                               
                               Iterator<?> iter = getBeanManager().getBeans(clazz).iterator();
                               
                               if (iter.hasNext()) {
                                   Bean<? extends T> bean = (Bean<? extends T>) iter.next();
                                   CreationalContext<? extends T> context = getBeanManager().createCreationalContext(bean);
                                   T listener = (T) getBeanManager().getReference(bean, clazz, context);
                                   listeners.add(listener);
                               }
                          }
                          return listeners;
                      }




                  After some hours (with resolving dependencies and version mismatches!) i finally get this exception:



                  SEVERE: Exception sending context initialized event to listener instance of class org.apache.webbeans.servlet.WebBeansConfigurationListener
                  javax.enterprise.inject.UnproxyableResolutionException: WebBeans with api type with normal scope must be proxiable to inject.
                  javax.el.ExpressionFactory has final methods! CDI doesn't allow that.
                       at org.apache.webbeans.util.InjectionExceptionUtils.throwUnproxyableResolutionException(InjectionExceptionUtils.java:39)
                       at org.apache.webbeans.util.WebBeansUtil.checkUnproxiableApiType(WebBeansUtil.java:1852)
                       at org.apache.webbeans.config.DefinitionUtil.createProducerComponent(DefinitionUtil.java:802)
                       at org.apache.webbeans.config.DefinitionUtil.createProducerComponents(DefinitionUtil.java:764)
                       at org.apache.webbeans.config.DefinitionUtil.defineProducerMethods(DefinitionUtil.java:737)
                       at org.apache.webbeans.component.creation.AbstractInjectedTargetBeanCreator.defineProducerMethods(AbstractInjectedTargetBeanCreator.java:148)
                       at org.apache.webbeans.util.WebBeansUtil.defineManagedBean(WebBeansUtil.java:2597)
                       at org.apache.webbeans.config.BeansDeployer.defineManagedBean(BeansDeployer.java:857)
                       at org.apache.webbeans.config.BeansDeployer.deploySingleAnnotatedType(BeansDeployer.java:538)
                       at org.apache.webbeans.config.BeansDeployer.deployFromClassPath(BeansDeployer.java:483)
                       at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:164)
                       at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:124)
                       at org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:77)
                       at org.apache.webbeans.servlet.WebBeansConfigurationListener.contextInitialized(WebBeansConfigurationListener.java:81)
                       at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
                       at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
                       at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
                       at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                       at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                       at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                       at java.lang.Thread.run(Thread.java:662) 



                  Why does this occur???

                  • 7. Re: Seam with OWB
                    Jason Porter Master

                    Could you paste the code where you're doing the injection? You're trying to inject an ExpressionFactory it looks like, and it seems the one that Tomcat ships with is using final methods, so it can't proxy the class.

                    • 8. Re: Seam with OWB
                      Thomas Andraschko Newbie

                      I do not inject the ExpressionFactory, i think that OWB scan the beans and check that there a final methods.
                      Removing the producder for the ExpressionFactory works fine!


                      I had/have some exceptions because of missing classes. I added seam security and now drools is also required?
                      Is there any difference how OWB scan/load the beans which are not required?

                      • 9. Re: Seam with OWB
                        Thomas Andraschko Newbie

                        After adding more dependencies which are actually not required, following exception occurs:




                        org.apache.webbeans.exception.definition.DuplicateDefinitionException: PassivationCapable bean id is not unique: PRODUCERFIELD#interface java.util.List#@javax.enterprise.inject.Any(),@javax.enterprise.inject.Default(), bean:Name:null,WebBeans Type:PRODUCERFIELD,API Types:[java.util.List,java.lang.Iterable,java.util.Collection,java.lang.Object],Qualifiers:[javax.enterprise.inject.Any,javax.enterprise.inject.Default]
                             at org.apache.webbeans.container.BeanManagerImpl.addPassivationInfo(BeanManagerImpl.java:398)
                             at org.apache.webbeans.container.BeanManagerImpl.addInternalBean(BeanManagerImpl.java:370)
                             at org.apache.webbeans.container.BeanManagerImpl.addBean(BeanManagerImpl.java:357)
                             at org.apache.webbeans.util.WebBeansUtil.defineManagedBean(WebBeansUtil.java:2696)
                             at org.apache.webbeans.config.BeansDeployer.defineManagedBean(BeansDeployer.java:857)
                             at org.apache.webbeans.config.BeansDeployer.deploySingleAnnotatedType(BeansDeployer.java:538)
                             at org.apache.webbeans.config.BeansDeployer.deployFromClassPath(BeansDeployer.java:483)
                             at org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:164)
                             at org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:124)
                             at org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:77)
                             at org.apache.webbeans.servlet.WebBeansConfigurationListener.contextInitialized(WebBeansConfigurationListener.java:81)
                             at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4723)
                             at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5226)
                             at org.apache.catalina.core.StandardContext$1.call(StandardContext.java:5221)
                             at java.util.concurrent.FutureTask$Sync.innerRun(FutureTask.java:303)
                             at java.util.concurrent.FutureTask.run(FutureTask.java:138)
                             at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                             at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                             at java.lang.Thread.run(Thread.java:662)



                        Any ideas?

                        • 10. Re: Seam with OWB
                          Jason Porter Master

                          Sounds like OWB bugs to me.

                          • 11. Re: Seam with OWB
                            Thomas Andraschko Newbie

                            Update:


                            This error is gone (i upgraded to OWB 1.1.1-SNAPSHOT), now.
                            I uploaded a example here:


                            http://www.megaupload.com/?d=0CF4EVCP




                            After changing Tomcat's ExpressionFactory to non final methods, i get following exception:




                            javax.faces.FacesException: java.lang.IllegalStateException: Could not start transaction
                                at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.wrap(ExceptionHandlerImpl.java:241)
                                at org.apache.myfaces.shared_impl.context.ExceptionHandlerImpl.handle(ExceptionHandlerImpl.java:156)
                                at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:191)
                                at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java:118)
                                at javax.faces.webapp.FacesServlet.service(FacesServlet.java:189)
                                at org.apache.myfaces.webapp.MyFacesServlet.service(MyFacesServlet.java:108)
                                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:304)
                                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                                at com.ocpsoft.pretty.PrettyFilter.doFilter(PrettyFilter.java:118)
                                at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
                                at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
                                at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:240)
                                at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:164)
                                at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
                                at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:164)
                                at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:100)
                                at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:563)
                                at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
                                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:399)
                                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:317)
                                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:204)
                                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:182)
                                at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:311)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
                                at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
                                at java.lang.Thread.run(Thread.java:662)
                            Caused by: java.lang.IllegalStateException: Could not start transaction
                                at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:96)
                                at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:86)
                                at org.jboss.seam.faces.transaction.TransactionPhaseListener.handleTransactionsBeforePhase(TransactionPhaseListener.java:67)
                                at org.jboss.seam.faces.transaction.TransactionPhaseListener.beforePhase(TransactionPhaseListener.java:49)
                                at org.jboss.seam.faces.event.DelegatingPhaseListener.beforePhase(DelegatingPhaseListener.java:28)
                                at org.apache.myfaces.lifecycle.PhaseListenerManager.informPhaseListenersBefore(PhaseListenerManager.java:76)
                                at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl.java:159)
                                ... 23 more
                            Caused by: java.lang.RuntimeException: java.lang.NullPointerException
                                at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:126)
                                at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:46)
                                at org.jboss.seam.solder.bean.ImmutableBean.create(ImmutableBean.java:87)
                                at org.apache.webbeans.component.third.ThirdpartyBeanImpl.create(ThirdpartyBeanImpl.java:93)
                                at org.apache.webbeans.context.creational.BeanInstanceBag.create(BeanInstanceBag.java:80)
                                at org.apache.webbeans.context.AbstractContext.getInstance(AbstractContext.java:225)
                                at org.apache.webbeans.context.AbstractContext.get(AbstractContext.java:190)
                                at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.getContextualInstance(NormalScopedBeanInterceptorHandler.java:135)
                                at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:95)
                                at org.javassist.tmp.java.lang.Object_$$_javassist_23.getTransaction(Object_$$_javassist_23.java)
                                at org.jboss.seam.transaction.EntityTransaction.getDelegate(EntityTransaction.java:69)
                                at org.jboss.seam.transaction.EntityTransaction.getStatus(EntityTransaction.java:135)
                                at org.jboss.seam.transaction.AbstractUserTransaction.isActiveOrMarkedRollback(AbstractUserTransaction.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.apache.webbeans.intercept.InterceptorHandler.invoke(InterceptorHandler.java:295)
                                at org.apache.webbeans.intercept.NormalScopedBeanInterceptorHandler.invoke(NormalScopedBeanInterceptorHandler.java:98)
                                at org.jboss.seam.transaction.EntityTransaction_$$_javassist_22.isActiveOrMarkedRollback(EntityTransaction_$$_javassist_22.java)
                                at org.jboss.seam.faces.transaction.TransactionPhaseListener.begin(TransactionPhaseListener.java:91)
                                ... 29 more
                            Caused by: java.lang.NullPointerException
                                at org.apache.webbeans.container.InjectionResolver.getInjectionPointBean(InjectionResolver.java:240)
                                at org.apache.webbeans.container.BeanManagerImpl.getInjectableReference(BeanManagerImpl.java:810)
                                at org.apache.webbeans.container.InjectableBeanManager.getInjectableReference(InjectableBeanManager.java:127)
                                at org.jboss.seam.persistence.util.InstanceResolver.getInstance(InstanceResolver.java:59)
                                at org.jboss.seam.persistence.util.InstanceResolver.getInstance(InstanceResolver.java:51)
                                at org.jboss.seam.persistence.PersistenceContextProxyHandler.<init>(PersistenceContextProxyHandler.java:52)
                                at org.jboss.seam.persistence.ManagedPersistenceContextProxyHandler.<init>(ManagedPersistenceContextProxyHandler.java:71)
                                at org.jboss.seam.persistence.ManagedPersistenceContextBeanLifecycle.create(ManagedPersistenceContextBeanLifecycle.java:116)
                                ... 49 more

                            • 12. Re: Seam with OWB
                              Thomas Andraschko Newbie

                              Any idea? I dont know the architecture of seam persistence :/ 
                              It occurs in the constructor of ManagedPersistenceContextProxyHandler in this line:


                              this.userTransactionInstance = InstanceResolver.getInstance(SeamTransaction.class, beanManager, DefaultTransactionLiteral.INSTANCE);
                              



                              What could be wrong?

                              • 13. Re: Seam with OWB
                                Jason Porter Master

                                Please try a snapshot version of Persistence. We've made some changes recently.

                                • 14. Re: Seam with OWB
                                  Thomas Andraschko Newbie

                                  I tried 3.0.1-SNAPSHOT via maven but this does not fix this exception. Any idea?

                                  1 2 Previous Next