Of course it's also a drop in replacement if you switch from WebLogic to TomEE.
Just the parts you drop in get a bit bigger :) LieGrue, strub >________________________________ > From: Ludovic Pénet <[email protected]> >To: Mark Struberg <[email protected]>; Mark Struberg <[email protected]>; >"[email protected]" <[email protected]> >Cc: Niki Dokovski <[email protected]> >Sent: Saturday, 9 November 2013, 16:51 >Subject: Re: OWB on Tomcat 7 > > > >Well, it is a drop-in change... If you change something else. ;) > >I will try this and provide more useful input tuesday. Thx ! > > > >Mark Struberg <[email protected]> a écrit : >of course between owb-1.1.x and 1.2.x we switched from javassist to >xbean-asm4-shaded. That jar would need to get exchanged. >>Otherwise it's just a drop in upgrade. >> >>LieGrue, >>strub >> >> >> >> >> >> >>>________________________________ >>> From: Romain Manni-Bucau <[email protected]> >>>To: Ludovic Pénet <[email protected]> >>>Cc: "[email protected]" <[email protected]>; Mark >>>Struberg <[email protected]>; Niki Dokovski <[email protected]> >>>Sent: Saturday, 9 November 2013, 16:30 >>>Subject: Re: OWB on Tomcat 7 >>> >>> >>> >>>from owb side (only, not in tomee) drop and replace would work >>> >>> >>>in tomee we work with lib internals so we deeply depend on some versions. I >>>did the upgrade on trunk (soon released) >>> >>> >>>Romain Manni-Bucau >>>Twitter: @rmannibucau >>>Blog: http://rmannibucau.wordpress.com/ >>>LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>Github: https://github.com/rmannibucau >>> >>> >>> >>> >>>2013/11/9 Ludovic Pénet <[email protected]> >>> >>>Maybe it is a lack of docs... >>>> >>>>I already use most of tomee components, but the "glue" (pom.xml, web.xml, >>>>etc.) is hard to find at first... >>>> >>>>I recently tried to use OWB 1.2 instead of 1.1.6 and the upgrade track is >>>>not very clear. It is not a drop-in replacement... >>>>My project uses latest myfaces 2.1, latest corresponding CODI and Tomcat 7. >>>> >>>>Well, maybe it is a curse of those great java projects. Great features, >>>>great performance, but steep learning curve... >>>> >>>> >>>>Best regards, >>>> >>>>Ludovic >>>> >>>> >>>> >>>>Romain Manni-Bucau <[email protected]> a écrit : >>>>tomee is a webapp and I know some tomcat users doing an overlay to deploy >>>>in a plain tomcat...works just fine too. >>>>> >>>>> >>>>>SCI is fine if you don't expect to be spec compliant (that's the case when >>>>>doing a tomcat + OWB) >>>>> >>>>> >>>>>Romain Manni-Bucau >>>>>Twitter: @rmannibucau >>>>>Blog: http://rmannibucau.wordpress.com/ >>>>>LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>Github: https://github.com/rmannibucau >>>>> >>>>> >>>>> >>>>> >>>>>2013/11/9 Ludovic Pénet <[email protected]> >>>>> >>>>>Well, users of "standalone" tomcat, for good or bad reasons (corporate >>>>>policy,...) do not thank you... ;) >>>>>> >>>>>>Best regards, >>>>>> >>>>>>Ludovic >>>>>> >>>>>> >>>>>> >>>>>>Romain Manni-Bucau <[email protected]> a écrit : >>>>>>we could hack a ServletContainerInitializer but not sure the gain >>>>>>>compared to using tomee which will always be far more integrated "by >>>>>>>design" >>>>>>>Romain Manni-Bucau >>>>>>>Twitter: @rmannibucau >>>>>>>Blog: http://rmannibucau.wordpress.com/ >>>>>>>LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>>>Github: https://github.com/rmannibucau >>>>>>> >>>>>>> >>>>>>> >>>>>>>2013/11/9 Mark Struberg <[email protected]>: >>>>>>> >>>>>>>Hi Niki! >>>>>>>> >>>>>>>>Karl and I did already work on improving our documentation at least ;) >>>>>>>> >>>>>>>>http://openwebbeans.apache.org/owbsetup_ee.html >>>>>>>> >>>>>>>>Please ping us if you find a failure! >>>>>>>> >>>>>>>>LieGrue, >>>>>>>>strub >>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>________________________________ >>>>>>>> >>>>>>>>From: Niki Dokovski <[email protected]> >>>>>>>>To: [email protected]; 'Mark Struberg' <[email protected]> >>>>>>>>Sent: Saturday, 9 November 2013, 15:01 >>>>>>>>Subject: RE: OWB on Tomcat 7 >>>>>>>> >>>>>>>>Hi Mark, >>>>>>>> >>>>>>>>From: Mark Struberg [mailto:[email protected]] >>>>>>>>Sent: Saturday, November 9, 2013 3:25 PM >>>>>>>>To: [email protected] >>>>>>>>Subject: Re: OWB on Tomcat 7 >>>>>>>> >>>>>>>>Hi folks! >>>>>>>> >>>>>>>>There are 2 different ways to work with OpenWebBeans and tomcat. >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>A, your app is using CDI but you do not need the container to understand >>>>>>>>CDI. >>>>>>>>In that case just add owb-core jar + spi + xbean-asm4-shaded + owb-web >>>>>>>>into >>>>>>>>your WEB-INF/lib and add WebBeansConfigurationListener to your web.xml >>>>>>>>as >>>>>>>><listener> >>>>>>>> >>>>>>>>This works perfect, but be aware that there is no CDI injection in >>>>>>>>Servlets >>>>>>>>themself. You can of course use DeltaSpike BeanProvider to pick up >>>>>>>> >>>>>>>>B.) you need it fully integrated with all other EE technologies. In that >>>>>>>>case I suggest you use TomEE. This is basically tomcat7 + latest OWB + >>>>>>>>latest MyFaces + + +. And all that in a perfectly integrated and ready >>>>>>>>to >>>>>>>>use configuration. >>>>>>>> >>>>>>>>IMHO, there might be cases where you don’t need my faces or you just >>>>>>>>want to >>>>>>>>test the latest web container with the latest CDI. Current owb >>>>>>>>documentation >>>>>>>>is a bit confusing indeed and you need to look into the source code to >>>>>>>>understand what you need to configure and where. Which might be good >>>>>>>>exercise anyway. I like the “plugins” architecture of OWB but the >>>>>>>>integration with tomcat can be improved. The CDI RI did a bit better >>>>>>>>with >>>>>>>>the integration with Tomcat for now. (Yes you still need the servlet >>>>>>>>listener to bootstrap the CDI container) >>>>>>>> >>>>>>>>Do you folks have plans to reconsider current integrations points with >>>>>>>>tomcat? Are there any particular ideas for what can be imp roved on tomcat >>>>>>>>side to make the integration better? >>>>>>>> >>>>>>>>Cheers >>>>>>>>Niki >>>>>>>> >>>>>>>> >>>>>>>>LieGrue, >>>>>>>>strub >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>>>>>>>>>>________________________________ >>>>>>>> >>>>>>>>From: aljesco <[email protected]> >>>>>>>>To: [email protected] >>>>>>>>Sent: Saturday, 9 November 2013, 14:04 >>>>>>>>Subject: Re: OWB on Tomcat 7 >>>>>>>> >>>>>>>>Now web.xml contain only >>>>>>>><web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" >>>>>>>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>>>>>>xsi:schemaLocation="http://java.sun.com/xml/ns/javaee >>>>>>>>http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> >>>>>>>><display-name>Archetype Created Web Application</display-name> >>>>>>>></web-app> >>>>>>>> >>>>>>>>Ans that exception is still thrown. >>>>>>>> >>>>>>>>Here is lines from WebContainerLifecycle.java: >>>>>>>>124:ELAdaptor elAdaptor = >>>>>>>>getWebBeansContext().getService(ELAdaptor.class); >>>>>>>>125:ELResolver resolver = elAdaptor.getOwbELResolver(); >>>>>>>>NPE is being thrown on elAdaptor.getOwbELResolver(); , but why? >>>>>>>>ELAdaptor.class is in openwebbeans-spi-1.2.0.jar which is placed under >>>>>>>>lib >>>>>>>>in tomcat. I don't know what to do with all of this. >>>>>>>> >>>>>>>>2013/11/9 Romain Manni-Bucau <[email protected]> >>>>>>>> >>>>>>>>Hmm >>>>>>>>Here im not sure but maybe remove it from your web.xml >>>>>>>>Le 9 nov. 2013 13:52, "aljesco" <[email protected]> a écrit : >>>>>>>> >>>>>>>> >>>>>>>>Nov 09, 2013 2:49:31 PM org.apache.catalina.core.StandardContext >>>>>>>>listenerStart >>>>>>>>SEVERE: Exception sending context initialized event to listener >>>>>>>>instance of >>>>>>>>class org.apache.webbeans.servlet.WebBeansConfigurationListener >>>>>>>>java.lang.NullPointerException >>>>>>>>at >>>>>>>>org.apache.webbeans.web.lifecycle.WebContainerLifecycle.afterStartApplication(WebContainerLifecycle.java:125) >>>>>>>>at >>>>>>>>org.apache.webbeans.lifecycle.AbstractLifeCycle.startApplication(AbstractLifeCycle.java:132) >>>>>>>>at >>>>>>>>org.apache.webbeans.web.lifecycle.WebContainerLifecycle.startApplication(WebContainerLifecycle.java:89) >>>>>>>>at >>>>>>>>org.apache.webbeans.servlet.WebBeansConfigurationListener.contextInitialized(WebBeansConfigurationListener.java:85) >>>>>>>>at >>>>>>>>org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4939) >>>>>>>>at >>>>>>>>org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) >>>>>>>>at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) >>>>>>>>at >>>>>>>>org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:901) >>>>>>>>at >>>>>>>>org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:877) >>>>>>>>at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:633) >>>>>>>>at< br />org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:1120) >>>>>>>> >>>>>>>>at >>>>>>>>org.apache.catalina.startup.HostConfig$DeployDirectory.run(HostConfig.java:1678) >>>>>>>>at >>>>>>>>java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) >>>>>>>>at java.util.concurrent.FutureTask.run(FutureTask.java:262) >>>>>>>>at >>>>>>>>java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) >>>>>>>>at >>>>>>>>java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) >>>>>>>>at java.lang.Thread.run(Thread.java:744) >>>>>>>> >>>>>>>> >>>>>>>>2013/11/9 Romain Manni-Bucau <[email protected]> >>>>>>>> >>>>>>>>So remove openwebbeans jar from the webapp to put them in tomcat libs >>>>>>>>Le 9 nov. 2013 13:43, "aljesco" <[email protected]> a écrit : >>>>>>>> >>>>>>>> >>>>>>>>Yes >>>>>>>> >>>>>>>>2013/11/9 Romain Manni-Bucau <[email protected]> >>>>>>>> >>>>>>>>You kept owb in web-inf/lib? >>>>>>>>Le 9 nov. 2013 13:22, "aljesco" <[email protected]> a écrit : >>>>>>>> >>>>>>>> >>>>>>>>I added >>>>>>>><Listener >>>>>>>>className="org.apache.webbeans.web.tomcat.ContextLifecycleListener" /> >>>>>>>>into server.xml files. >>>>>>>>After that Tomcat throwed several ClassNotFoundExceptions because it >>>>>>>>couldn't find OWB libs. I put openwebbeans-impl-1.2.0.jar, >>>>>>>>openwebbeans-spi-1.2.0.jar, openwebbeans-tomcat7-1.2.0.jar and >>>>>>>>openwebbeans-web-1.2.0.jar into lib folder. Now Tomcat fails to start >>>>>>>>with >>>>>>>>exception >>>>>>>>==== >>>>>>>>Caused by: java.lang.RuntimeException: java.lang.ClassCastException: >>>>>>>>Cannot >>>>>>>>cast org.apache.webbeans.service.DefaultLoaderService to >>>>>>>>org.apache.webbeans.spi.LoaderService >>>>>>>>at >>>>>>>>org.apache.webbeans.web.tomcat.ContextLifecycleListener.containerEvent(ContextLifecycleListener.java:200) >>>>>>>>at >>>>>>>>org.apache.catalina.core.ContainerBase.fireContainerEvent(ContainerBase.java:1398) >>>>>>>>at >>>>>>>>org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4944) >>>>>>>>at >>>>>>>>org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5434) >>>>>>>>at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) >>>>>>>>... 10 more >>>>>>>>Caused by: java.lang.ClassCastException: Cannot cast >>>>>>>>org.apache.webbeans.service.DefaultLoaderService to >>>>>>>>org.apache.webbeans.spi.LoaderService >>>>>>>>at java.lang.Class.cast(Class.java:3094) >>>>>>>>at >>>>>>>>org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:121) >>>>>>>>at >>>>>>>>org.apache.webbeans.config.WebBeansContext.<init>(WebBeansContext.java:98) >>>>>>>>at >>>>>>>>org.apache.webbeans.corespi.DefaultSingletonService.get(DefaultSingletonService.java:54) >>>>>>>>at >>>>>>>>org.apache.webbeans.corespi.DefaultSingletonService.get(DefaultSingletonService.java:28) >>>>>>>>at >>>>>>>>org.apache.webbeans.config.WebBeansFinder.getSingletonInstance(WebBeansFinder.java:51) >>>>>>>>at >>>>>>>>org.apache.webbeans.config.WebBeansContext.getInstance(WebBeansContext.java:164) >>>>>>>>at >>>>>>>>org.apache.webbeans.config.WebBeansContext.currentInstance(WebBeansContext.java:182) >>>>>>>>at org.apache.webbeans.web.tomcat.TomcatUtil.inject(TomcatUtil.java:38) >>>>>>>>at >>>>>>>>org.apache.webbeans.web.tomcat.ContextLifecycleListener.containerEvent(ContextLifecycleListener.java:182) >>>>>>>>... 14 more >>>>>>>>==== >>>>>>>>What I'm doing wrong? >>>>>>>> >>>>>>>>2013/11/9 Romain Manni-Bucau <[email protected]> >>>>>>>> >>>>>>>>this one as tomcat listener >>>>>>>>https://github.com/apache/openwebbeans/blob/trunk/webbeans-tomcat7/src/main/java/org/apache/webbeans/web/tomcat/ContextLifecycleListener.java >>>>>>>>Le 9 nov. 2013 12:36, "aljesco" <[email protected]> a écrit : >>>>>>>> >>>>>>>> >>>>>>>>No, I didn't set it. What class should I set up as a listener? >>>>>>>> >>>>>>>>Do I need this lines in web.xml? >>>>>>>> >>>>>>>><listener> >>>>>>>> >>>>>>>><listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class> >>>>>>>></listener> >>>>>>>><resource-env-ref> >>>>>>>><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> >>>>>>>> >>>>>>>>2013/11/9 Romain Manni-Bucau <[email protected]> >>>>>>>> >>>>>>>>Hi >>>>>>>>Api jars are geronimo*spec ones (jcdi and atinject IIRC) >>>>>>>>In tomcat you need tomcat owb listener to get servlet injection, did >>>>>>>>you set >>>>>>>>it? >>>>>>>>Le 9 nov. 2013 12:13, "aljesco" <[email protected]> a écrit : >>>>>>>> >>>>>>>> >>>>>>>>Hello everyone, >>>>>>>> >>>>>>>>I've tried to get OWB working for about several hours on Tomcat 7 and >>>>>>>>afterall I got really confused. >>>>>>>>I'd be very thankful if someone can clarify some points with OWB. >>>>>>>> >>>>>>>>So, I'm developing a test project with just one servlet >>>>>>>> >>>>>>>>==== >>>>>>>>@WebServlet(urlPatterns="/test") >>>>>>>>public class extends HttpServlet { >>>>>>>> >>>>>>>>private @Inject MyService s; >>>>>>>>@Override >>>>>>>>protected void doGet(HttpServletRequest req, HttpServletResponse resp) >>>>>>>>throws ServletException, IOException { >>>>>>>> >>>>>>>>WebBeansContext currentInstance = WebBeansContext.currentInstance(); >>>>>>>>MyService s2 = currentInstance.get(MyService.class); >>>>>>>>resp.getWriter().println(s); >>>>>>>>resp.getWriter().println("s2: " + s2.getHash()); >>>>>>>>} >>>>>>>>} >>>>>>>>==== >>>>>>>> >>>>>>>>it tries get injected MyService instance which is POJO: >>>>>>>> >>>>>>>>==== >>>>>>>>public class MyService { >>>>>>>>public MyService() { >>>>>>>>} >>>>>>>>public String getHash() { >>>>>>>>return new Random().nextInt() + ""; >>>>>>>>} >>>>>>>>} >>>>>>>>==== >>>>>>>> >>>>>>>>here is WEB-INF/web.xml: >>>>>>>> >>>>>>>>==== >>>>>>>><web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" >>>>>>>>xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >>>>>>>>xsi:schemaLocation="http://java.sun.com/xml/ns/javaee >>>>>>>>http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd"> >>>>>>>><display-name>Archetype Created Web Application</display-name> >>>>>>>><listener> >>>>>>>> >>>>>>>><listener-class>org.apache.webbeans.servlet.WebBeansConfigurationListener</listener-class> >>>>>>>></listener> >>>>>>>><resource-env-ref> >>>>>>>><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> >>>>>>>></web-app> >>>>>>>>==== >>>>>>>> >>>>>>>>libs in WEB-INF/libs: >>>>>>>> >>>>>>>>openwebbeans-ee-common-1.2.0.jar >>>>>>>>openwebbeans-el22-1.2.0.jar >>>>>>>>openwebbeans-impl-1.2.0.jar >>>>>>>>openwebbeans-resource-1.2.0.jar >>>>>>>>openwebbeans-spi-1.2.0.jar >>>>>>>>openwebbeans-tomcat7-1.2.0.jar >>>>>>>>openwebbeans-web-1.2.0.jar >>>>>>>>xbean-asm-shaded-3.13.jar >>>>>>>>xbean-finder-shaded-3.13.jar >>>>>>>> >>>>>>>>The first question is about CDI implementation library. >>>>>>>>If I try to deploy webapp as it is, the Tomcat will fail with next >>>>>>>>exception: java.lang.NoClassDefFoundError: >>>>>>>>javax/enterprise/context/spi/Contextual >>>>>>>>I couldn't find OWB library which provides such class. I only grabbed >>>>>>>>javaee-api-6.0-5-tomcat.jar from TomEE and placed in under Tomcat 7 lib/ >>>>>>>>folder. >>>>>>>>What is a proper way to solve this problem? Where should I get >>>>>>>>javax.enterprise.context.* library? >>>>>>>> >>>>>>>>The second question is about CDI itself. >>>>>>>>After successful deploying (with javaee-api-6.0-5-tomcat.jar in lib/) I >>>>>>>>accessed my servlet by http://localhost:8080/testproject/test and got >>>>>>>>this >>>>>>>>responce: >>>>>>>>==== >>>>>>>> >>>>>>>>null >>>>>>>> >>>>>>>>s2: 1064451662 >>>>>>>> >>>>>>>>==== >>>>>>>> >>>>>>>>Why WebBeansContext.currentInstance().get(MyService.class) returns a >>>>>>>>proper >>>>>>>>instance of MyService class and fails to inject it into private @Inject >>>>>>>>MyService s? >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>-- >>>>>>Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté. >>>>>>| | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT. | >>>>> >>>>-- >>>>Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté. >>>>| | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT. | >>> >>> >>> >-- >Envoyé de mon téléphone Android avec K-9 Mail. Excusez la brièveté. >| | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT. | > >
