6 Replies Latest reply on Aug 16, 2009 12:54 PM by sasanplus

    How to detect deployment failure

    sasanplus

      Hi,

      I copied a faulty .war file and tried detecting a deployment failure, but I still get

      org.jboss.deployment.SubDeployer.creat
      and
      org.jboss.deployment.SubDeployer.start

      more interesting part is the war file (which contains a bunch of WS(s)) also show in JMX console.

      My solution was to try reading the war MBean attrs through JMX and see if has any WS(s) if not then .war is corrupt, but to be honest I expected to get a failure notification right at the begining.

      so the question is, what is the correct way of detecting of deployment has gone wrong?

      Note: I did not get "org.jboss.deployment.SubDeployer.destroy"

      any suggestions are much appreciated.

      Thanks,
      Sasan

        • 1. Re: How to detect deployment failure
          jaikiran

           

          more interesting part is the war file (which contains a bunch of WS(s)) also show in JMX console.

          My solution was to try reading the war MBean attrs through JMX and see if has any WS(s) if not then .war is corrupt,


          What does WS(s) mean?

          Can you post the deployment failure exception stacktrace/error message that you see on the console? And which exact version of JBoss AS do you use?

          While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.

          • 2. Re: How to detect deployment failure
            sasanplus

            Hi,

            Thanks for the reply.

            WS = Web Service

            basically I created a valid war file with a few WS in it (Web Service) and then I corrupted the content by removing i.e. web.xml and few other stuff to make sure this is not a valid .war and not going to be deployed. The actualy binary can be opened but the content is not a .war any more i.e. no web.xml and a couple of classes are removed.

            I expected the deployment to fail. In app server console I get following which is fair enough:

            10:44:37,309 INFO [TomcatDeployer] deploy, ctxPath=/TestWebApplication, warUrl=.../tmp/deploy/tmp8688159346501002326TestWebApplication-exp.war/
            10:44:37,418 WARN [config] Unable to process deployment descriptor for context '/TestWebApplication'

            but when I listen to the events (NotificationListener) I only get the following events:

            org.jboss.deployment.SubDeployer.create
            and
            org.jboss.deployment.SubDeployer.start

            I do not get any failure events

            I added listener to jboss.system:service=MainDeployer and any deployers beneath it. (basically everything)

            Also the app server is 4.2.3 (GA)

            Note that this application shows up in JMX. So my solution was to query JMX and if I can not find any WS then the application is not deployed. But I prefer to get a failure message as oppose to the JMX query thing.

            • 3. Re: How to detect deployment failure
              jaikiran

               

              "sasanplus" wrote:
              and then I corrupted the content by removing i.e. web.xml and few other stuff to make sure this is not a valid .war and not going to be deployed. The actualy binary can be opened but the content is not a .war any more i.e. no web.xml and a couple of classes are removed.


              The absence of a web.xml does *not* stop the war from being deployed. And it won't be considered as a corrupt deployment. Even the absence of some classes which are needed at runtime of the war and not deployment time, too will not cause the deployment failure.

              If you want to test the deployment failure then you can try by adding a web.xml with a non-existent servlet class. That should fail the deployment.


              While posting logs or xml content or code, please remember to wrap it in a code block by using the Code button in the message editor window. Please use the Preview button to ensure that your post is correctly formatted.


              • 4. Re: How to detect deployment failure
                sasanplus

                Nope,

                I kept the web.xml with reference to WS that does not exist and I got:

                17:25:56,899 ERROR [[/TestWebApplication]] Servlet /TestWebApplication threw load() exception
                javax.xml.ws.WebServiceException: Cannot obtain endpoint for: jboss.ws:context=TestWebApplication,endpoint=SecondWebService
                 at org.jboss.wsf.stack.cxf.CXFServletExt.initServiceEndpoint(CXFServletExt.java:175)
                 at org.jboss.wsf.stack.cxf.CXFServletExt.init(CXFServletExt.java:80)
                 at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1161)
                 at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:981)
                 at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4071)
                 at org.apache.catalina.core.StandardContext.start(StandardContext.java:4375)
                

                in console, but no event to indicate the failure.

                org.jboss.deployment.SubDeployer.creat
                and
                org.jboss.deployment.SubDeployer.start







                • 5. Re: How to detect deployment failure
                  jaikiran

                  I see what you are saying. An exception when the module has started does not set the deployment as failed. The state still shows as STARTED. Infact you can access the application (pages) from the browser even with the failures that you reported.

                  So maybe this is not a good way of checking whether the application is corrupt. What exactly are you trying to achieve? Maybe we can point you to something else.

                  • 6. Re: How to detect deployment failure
                    sasanplus

                    The fact is even if the war is corrupt, it still shows up in JMX console. But since its layout does not comply with a web appl, it can not be access, etc.

                    So basically I am trying to do the same thing app server is doing and catch the exception "WebServiceException" or any relevant exceptions when deploying a web application that is no all correct.

                    By all correct I mean , it either missing web.xml, or some classes, some references libraries, pointing to WS that is not there in the war, etc.

                    Since app server is throwing that exception, I want to get / sense that exception too. either by a notification, or any other possible ways. So maybe the question is, how does app server do it?