On Wed, Nov 27, 2013 at 5:24 PM, Niki Dokovski <[email protected]> wrote:
> Hi, > > > On Mon, Nov 18, 2013 at 5:33 PM, Gerhard Petracek < > [email protected]> wrote: > >> as mentioned at [1] we have to think about a better approach. >> >> > just to let you know that I managed to get the tomcat7-sample running using > mvn tomcat7:run and tomcat7-maven-plugin version 2.2 on tomcat 7.0.47. > Here it is what it took: > in openwebbeans-tomcat7 project: > 1. modified the pom to get tomcat 7.0.47 > 2 updated TomcatInstanceManager to reflect the update in tomcat > 3. add openwebbeasns.properties to > 3.1 switch to default JNDI service (the binding of BeanManager failed with > current implementation). I haven't looked further into this but probably > should > 3.2 switch SecurityService to TomcatSecuritySerivece > 4. Modified TomcatSecurityService to go to a new TomcatAuthenticatorValve > 5. Added TomcatAuthenticatorValve to put the principle in a ThreadLocal . > Using the same pattern as in TomcatSecurityListener > > in tomcat7-sample > modified pom to add the plugin and cleaned up the dependencies > > The exercise actually opened more questions than answers and here is the > patch if you want to take a look [1] > Comments and feedback are welcome https:// > drive.google.com/file/d/0B8bSvf-7fqZTSVJSS0lKd1l5S3c/edit?usp=sharing > What do you think? > > [1] > https://drive.google.com/file/d/0B8bSvf-7fqZTSVJSS0lKd1l5S3c/edit?usp=sharing > The patch above does not include changes in tomcat7-sample. Here are the new patches against OWB trunk: * owb_openwebbeans-tomcat7.patch<https://drive.google.com/file/d/0B8bSvf-7fqZTUVlUZ2txblpqeVk/edit?usp=sharing> * owb_tomcat7-sample.patch<https://drive.google.com/file/d/0B8bSvf-7fqZTbUdoa1k0dnVJa1U/edit?usp=sharing> Thoughts? > > > > > > >> regards, >> gerhard >> >> [1] https://issues.apache.org/jira/browse/OWB-915 >> >> >> >> 2013/11/12 Niki Dokovski <[email protected]> >> >>> >>> >>> >>> On Tue, Nov 12, 2013 at 2:37 PM, Romain Manni-Bucau < >>> [email protected]> wrote: >>> >>>> Hi >>>> >>>> 1) if you have time it would be great ;) >>>> >>> >>> OK I'll give it a try with tomcat7-sample, including a proposal for the >>> SecurityListener case >>> >>> 2) +1 >>>> 3) yes, it never really worked in fact with servlet >= 3.0 containers. >>>> in TomEE we are integrated far deeper to get a consistent behavior on that >>>> point (we automatically wrap the tomcat realm with >>>> http://svn.apache.org/repos/asf/tomee/tomee/trunk/tomee/tomee-catalina/src/main/java/org/apache/tomee/catalina/TomEERealm.java >>>> ) >>>> >>>> *Romain Manni-Bucau* >>>> *Twitter: @rmannibucau <https://twitter.com/rmannibucau>* >>>> *Blog: >>>> **http://rmannibucau.wordpress.com/*<http://rmannibucau.wordpress.com/> >>>> *LinkedIn: **http://fr.linkedin.com/in/rmannibucau >>>> <http://fr.linkedin.com/in/rmannibucau>* >>>> *Github: https://github.com/rmannibucau >>>> <https://github.com/rmannibucau>* >>>> >>>> >>>> >>>> 2013/11/12 Niki Dokovski <[email protected]> >>>> >>>>> ops sorry hit send too early. here is the rest >>>>> >>>>> >>>>> On Tue, Nov 12, 2013 at 2:20 PM, Niki Dokovski <[email protected]>wrote: >>>>> >>>>>> >>>>>> >>>>>> Hi folks, >>>>>> >>>>>> On Tue, Nov 12, 2013 at 1:48 PM, Mark Struberg <[email protected]>wrote: >>>>>> >>>>>>> hi ludovic! >>>>>>> >>>>>>> Nope, you don't need it in there. What we do in a few apps is to >>>>>>> package those apps into an EAR, then unpack the whole EAR into the >>>>>>> ./webapps folder in tomcat and add the /lib folder as shared.loader in >>>>>>> ./conf/catalina.properties. >>>>>>> That gives you a shared ClassLoader which sits inbetween tomcat and >>>>>>> your single webapps. Those WARs will be child-classloaders of the shared >>>>>>> loader. >>>>>>> >>>>>>> Of course you can also move all the stuff into tomcats lib folder as >>>>>>> well... >>>>>>> >>>>>> >>>>>> I did the exercise of running out of the box the tomcat7-sample >>>>>> application located at ${owb-trunk}/samples/tomcat7-sample project. >>>>>> My goal is to do simple mvn clean package tomcat7:run and have the >>>>>> sample hosted on the embedded tomcat. >>>>>> Here are my findings and would like to ask for clarifications: >>>>>> 1. the project uses old tomcat-maven-plugin version 1.1 therefore i >>>>>> switched to 2.2. That gets as dependency tomcat 7.0.47. Which from its >>>>>> side >>>>>> has modified TomcatInstance interface. The latter should be implemented >>>>>> by >>>>>> openwebbeans-tomcat7. QuickFix does the trick. >>>>>> >>>>> 2. To get the filter injected as in the sample, we need to supply >>>>> the tomcat ContextLifecycleListener. The latter has to be put in a jar >>>>> located under tomcat/lib folder. No other locations for this jar are >>>>> valid. >>>>> Of course that simply means that all the dependencies should be located >>>>> under tomcat/lib as well. >>>>> 3. After setting the dependencies and having proper configuration >>>>> for both the tomcat (context listener) and the application >>>>> (webcontextlistener)The container throws NPE after a successful >>>>> authentication. The NPE is a result of an assumption in owb that the >>>>> TomcatSercurityListener is invoked when all properties of the request are >>>>> initialized including the user principle. Actually the user principle is >>>>> set later by the basic authenticator valve. This is proper container >>>>> behavior, the RI behaves in the exact same way in relation to the >>>>> initialization of a servlet request listeners. >>>>> >>>>> Basically my questions are: >>>>> 1. Do you think we could invest in bringing all of the samples running >>>>> out of the box, serving their main purpose? >>>>> 2. What about updating the dependencies towards specific components to >>>>> much recent versions >>>>> 3. Is there a bug in openwebbean-tomcat7 TomcatSecurityListener? >>>>> >>>>> >>>>> cheers >>>>> Niki >>>>> >>>>> >>>>>> >>>>>> >>>>>> >>>>>>> >>>>>>> LieGrue, >>>>>>> strub >>>>>>> >>>>>>> >>>>>>> ------------------------------ >>>>>>> *From:* "[email protected]" <[email protected]> >>>>>>> *To:* [email protected] >>>>>>> *Sent:* Tuesday, 12 November 2013, 9:19 >>>>>>> >>>>>>> *Subject:* Re: OWB on Tomcat 7 >>>>>>> >>>>>>> On 09/11/2013 14:24, Mark Struberg wrote: >>>>>>> >>>>>>> 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> >>>>>>> >>>>>>> Is it required that openwebbeans is in tomcat WEB-INF/lib ? In my >>>>>>> environment, we can have tens of webapps on a single tomcat server. >>>>>>> In this contexte, requiring all of them to use the same version of >>>>>>> OWB is not a sensible option. >>>>>>> >>>>>>> Best regards, >>>>>>> >>>>>>> Ludovic >>>>>>> >>>>>>> | >>>>>>> | AVANT D'IMPRIMER, PENSEZ A L'ENVIRONNEMENT. >>>>>>> | >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>> >>>>> >>>> >>> >> >
