1 2 3 4 Previous Next 48 Replies Latest reply on Jun 26, 2008 1:33 AM by ropalka Go to original post
      • 30. Re: HOWTO deploy webapp dynamically

        Nice colours. ;-)

        I don't see how this is a deployment or classloader issue?

        If it is going in the wrong tomcat context then you've obviously not setup your
        JBossWebMetaData correctly.

        But since you don't show that, and it would be an issue for the Web/Tomcat developers
        forum if you don't understand its metadata, I can't really help (again).

        And like I said before. Passing the thread context classloader is almost certainly wrong
        (but not related to your problem).
        That is a wrapper classloader created by Tomcat for other purposes, e.g.
        determining which ENC to use in jndi java:comp/env lookups.
        You need to drill down through its parents to find the RealClassLoader.

        • 31. Re: HOWTO deploy webapp dynamically
          ropalka

           

          "scott.stark@jboss.org" wrote:
          You need to make a copy of the JBossWebMetaData and use setContextRoot("jaxws-endpoint").

          Yes we do. We create new JBossWebMetaData from scratch and set context root to "jaxws-endpoint". However it doesn't work :(
          "scott.stark@jboss.org" wrote:
          We also need this usecase in the jbossas testsuite as an illustration of proper dynamic deployment creation.

          Yes, we will add this test to JBossAS testsuite soon.


          • 32. Re: HOWTO deploy webapp dynamically
            anil.saldhana

            There is some JBWS309UnitTestCase sitting in the AS test suite that can be used. It is originally part of the JACC test run. But it does not work correctly as I have seen the webapp deployed by JBossWS having no metadata created etc.

            http://www.jboss.com/index.html?module=bb&op=viewtopic&t=137352

            • 33. Re: HOWTO deploy webapp dynamically
              starksm64

              Is this affecting our current tck regressions? Even though the predetermined object bucket is not the right one to be using, I don't think it should prevent the this code from working provided the context root is set correctly.

              The org.jboss.wsf.spi.deployment.Deployment spi does not make the distinction between predetermined vs transient attachments so it does not look like an spi issue that should be fixed for CR1.

              • 34. Re: HOWTO deploy webapp dynamically

                 

                "scott.stark@jboss.org" wrote:
                Even though the predetermined object bucket is not the right one to be using,


                Yes it is.

                That's exactly what it is for. It says I have predetermined what the
                metadata is, so don't override it with whatever else you find, e.g. by parsing xml

                • 35. Re: HOWTO deploy webapp dynamically

                  If you want it to parse xml then pass in a StructureMetaData that says
                  where that should come from.

                  • 36. Re: HOWTO deploy webapp dynamically
                    starksm64

                     

                    "adrian@jboss.org" wrote:

                    That's exactly what it is for. It says I have predetermined what the
                    metadata is, so don't override it with whatever else you find, e.g. by parsing xml

                    Agreed, but my point is that its not clear the webservices deployment layer is in the position to make this distinction.

                    • 37. Re: HOWTO deploy webapp dynamically
                      ropalka

                       

                      "adrian@jboss.org" wrote:

                      If it is going in the wrong tomcat context then you've obviously not setup your
                      JBossWebMetaData correctly.

                      We call JBossWebMetaData.setContextRoot("jaxws-endpoint") for sure :(
                      "adrian@jboss.org" wrote:

                      And like I said before. Passing the thread context classloader is almost certainly wrong

                      Could you review this piece of code, please?
                      jbossas/trunk/webservices/src/main/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransport.java
                      and provide us constructive feedback e.g. what's fundamentally wrong there? BTW, how would you deal with the classloader issue Adrian?

                      • 38. Re: HOWTO deploy webapp dynamically

                         

                        "scott.stark@jboss.org" wrote:
                        "adrian@jboss.org" wrote:

                        That's exactly what it is for. It says I have predetermined what the
                        metadata is, so don't override it with whatever else you find, e.g. by parsing xml

                        Agreed, but my point is that its not clear the webservices deployment layer is in the position to make this distinction.


                        I don't understand what distinction you're talking about?
                        It's knows its own metadata and it knows it wants to create a deployment.

                        If it doesn't know how to construct the metadata then that's not an issue
                        for the deployers its an issue for whoever owns that metadata to make
                        it useable and supportable as an integration api.

                        • 39. Re: HOWTO deploy webapp dynamically
                          starksm64

                          Its taking JBossWebMetaData from an existing deployment according to the code shown, so I'm trying to understand how this is a separate deployment, especially if in the past it was simply updating web.xml/jboss-web.xml descriptors.

                          • 40. Re: HOWTO deploy webapp dynamically

                             

                            "richard.opalka@jboss.com" wrote:
                            BTW, how would you deal with the classloader issue Adrian?


                            The hunt the real classloader game. ;-)
                            ClassLoader cl = ...;
                            ClassLoader parent = cl.getParent();
                            while (cl instanceof org.jboss.classloading.spi.RealClassLoader == false && parent != null)
                             cl = parent;
                            


                            • 41. Re: HOWTO deploy webapp dynamically

                               

                              "richard.opalka@jboss.com" wrote:
                              "adrian@jboss.org" wrote:

                              If it is going in the wrong tomcat context then you've obviously not setup your
                              JBossWebMetaData correctly.

                              We call JBossWebMetaData.setContextRoot("jaxws-endpoint") for sure :(
                              "adrian@jboss.org" wrote:

                              And like I said before. Passing the thread context classloader is almost certainly wrong

                              Could you review this piece of code, please?
                              jbossas/trunk/webservices/src/main/org/jboss/wsf/container/jboss50/transport/EndpointAPIHttpTransport.java
                              and provide us constructive feedback e.g. what's fundamentally wrong there?


                              Starting from that class I get to:

                               // Get the context root for this deployment
                               String contextRoot = dep.getService().getContextRoot();
                              


                              which is lost in some interfaces.

                              The only way for me to figure out what is going on is to open up a debugger
                              (or add logging) to verify the values are as you say in that code
                              and if they are, figuring out where in Tomcat (or one of the deployers
                              that processes JBossWebMetaData) they get changed or overridden.

                              This is a task that you can do just as well as I can.

                              I hope you can see why we don't feel overly eagre to help you
                              when all the work is assumed to be in one direction, especially
                              when none of the code (jbossws, web metadata or tomcat)
                              is actually an issue for the deployers framework or its forum.

                              • 42. Re: HOWTO deploy webapp dynamically
                                ropalka

                                 

                                "scott.stark@jboss.org" wrote:
                                Its taking JBossWebMetaData from an existing deployment according to the code shown, so I'm trying to understand how this is a separate deployment, especially if in the past it was simply updating web.xml/jboss-web.xml descriptors.

                                No, it isn't existing JBossWebMetaData from an existing deployment. We're creating new one, see: JBossAS/trunk/webservices/src/main/org/jboss/wsf/container/jboss50/transport/WebAppGenerator.java method generateWebDeployment(). We have Webservices specific metadata and we're using them to generate our custom web dynamic deployments.

                                • 43. Re: HOWTO deploy webapp dynamically

                                  A quick look at the web deployers leads to a likely candidate
                                  (since you're creating the endpoint from a servlet init).

                                  package org.jboss.web.tomcat.service.deployers;
                                  
                                  public class JBossContextConfig extends ContextConfig
                                  {
                                   public static ThreadLocal<JBossWebMetaData> metaDataLocal = new ThreadLocal<JBossWebMetaData>();
                                   public static ThreadLocal<JBossWebMetaData> metaDataShared = new ThreadLocal<JBossWebMetaData>();
                                  
                                  ...
                                  


                                  I haven't determined the exact mechanism, but my guess is that
                                  parameters of the webapp that is doing the init() are interfering with
                                  the new deployment via this ThreadLocal.

                                  It should be relatively easy to validate this guess, by getting your test
                                  code to fork a thread to do the deployment.

                                  • 44. Re: HOWTO deploy webapp dynamically
                                    ropalka

                                     

                                    "adrian@jboss.org" wrote:
                                    This is a task that you can do just as well as I can.

                                    Of course you're absolutely right.