4 Replies Latest reply on Mar 15, 2009 6:28 PM by Pete Muir

    Web beans and Tomcat

    Ryan Cuprak Newbie

      Hello,

      I am trying to get a simple Web Beans app up and running with Tomcat and JSF 2.0. Without looking at the documentation or other forum postings I plowed ahead with a small project but got stumped when my app refused to startup due to a javax.naming.NamingException: Context is read only. Googling I came across the following link:

      Appendix A. Integrating the Web Beans RI into other environmentsk


      However, that appears documentation appears to be for an older version of Web Beans as I didn't see a NamingContext class in my classpath. In the BETA1 spi JAR I came across BeanStore which I guess is similar to the NamingContext example in the link?


      Of course, I then started digging through the web beans discussion forum and came across this link:
      http://www.seamframework.org/Community/SupportForTomcatJetty


      I then dug into the current documentation and discovered that only JBoss 5 was supported. Coming from Seam I didn't expect this limitation - right now I am locked into tomcat on a production server. If someone points me in the right direction I'll gladly write whatever glue is necessary for Tomcat or my second favorite which is Glassfish (which would be easier to move to on the production side for me). 


      -Ryan 


        • 1. Re: Web beans and Tomcat
          Pete Muir Master

          Ryan Cuprak wrote on Mar 10, 2009 04:05:


          Hello,

          I am trying to get a simple Web Beans app up and running with Tomcat and JSF 2.0. Without looking at the documentation or other forum postings I plowed ahead with a small project but got stumped when my app refused to startup due to a javax.naming.NamingException: Context is read only. Googling I came across the following link:

          Appendix A. Integrating the Web Beans RI into other environmentsk

          However, that appears documentation appears to be for an older version of Web Beans as I didn't see a NamingContext class in my classpath. In the BETA1 spi JAR I came across BeanStore which I guess is similar to the NamingContext example in the link?


          Look for org.jboss.webbeans.resources.spi.NamingContext in the webbeans-spi.jar - to get this bit working you would need to plugin a NamingContext impl that does a no-op for binding due to the readonly JNDI in Tomcat.


          Of course, I then started digging through the web beans discussion forum and came across this link:
          http://www.seamframework.org/Community/SupportForTomcatJetty

          I then dug into the current documentation and discovered that only JBoss 5 was supported. Coming from Seam I didn't expect this limitation - right now I am locked into tomcat on a production server. If someone points me in the right direction I'll gladly write whatever glue is necessary for Tomcat or my second favorite which is Glassfish (which would be easier to move to on the production side for me). 



          Both Glassfish and Tomcat should be supported very soon. If you want to help with the glassfish integration, I suggest contacting Roger Kitain (roger dot kitain at sun dot com) as he is leading this effort. If you want to help with the Tomcat integration, take a look at https://jira.jboss.org/jira/browse/WBRI-176 - specifically, help implementing the WebBeanDiscovery and bootstrap would be great. I would suggest doing the discovery using the scanner code from Seam, and doing the bootstrap using a ServletContextListener.contextInitialized() callback.

          • 2. Re: Web beans and Tomcat
            Peter Royle Newbie

            Pete Muir wrote on Mar 12, 2009 18:25:

            I would suggest doing the discovery using the scanner code from Seam


            Pete,


            Do you think the simplified version of URLScanner used in WebBeans SE would be suitable, or will Tomcat require more of the redeployment detection stuff from the original Seam version?


            Cheers,


            Pete.

            • 3. Re: Web beans and Tomcat
              Pete Muir Master

              Peter Royle wrote on Mar 13, 2009 11:59:


              Do you think the simplified version of URLScanner used in WebBeans SE would be suitable, or will Tomcat require more of the redeployment detection stuff from the original Seam version?



              Yes, I think this should be sufficient. We will need to look at how Tomcat can handle our classloader isolation requirement.


              I think we will need a general strategy for the redeploy stuff - this is really something that should be available in the AS, not in WB...

              • 4. Re: Web beans and Tomcat
                Pete Muir Master

                I've fixed the bootstrap to allow you to simply do bootstrap.setEnvironment(SERVLET);, which will cause Web Beans to run without TX services and EJB services required.


                Next, we need to write a slighly modified lifecycle that can boot Web Beans in response to the context initialized event, and package it into a webbeans-tomcat.jar that includes all the dependencies so that people can just drop it in.