5 Replies Latest reply on Jan 23, 2012 8:36 PM by Kyle Le

    Restarting https connector in Jboss 7?

    Kyle Le Newbie

      Hi All,

       

      Does anyone know how to restart the https connector in Jboss 7?  I have worked with Jboss 4.2.2 in the past and have used the MBeanServer that belongs to "jboss.web:type=Connector" to restart the https connector but this MBeanServer seems to no longer exist in Jboss 7.  I am using Jboss 7.0.0. The reason why I would like to restart the https connector is to reload the truststore that Jboss keeps in memory for SSL client authentication once a new client certificate has been added to the truststore.  Does anyone have any insights as to how this can be accomplished?  Thanks for the help in advance.

        • 1. Re: Restarting https connector in Jboss 7?
          Nicklas Karlsson Master

          Haven't tried what it actually does but I noticed that if you use the CLI you can remove the connector and re-create this and the outcomes are "success" without "reload required" so perhaps it might to the job(?)

          1 of 1 people found this helpful
          • 2. Re: Restarting https connector in Jboss 7?
            Kyle Le Newbie

            Hi Nicklas,

             

            Thanks for the reply.  I have been playing around with the CLI to understand the possibilities and it seems like I would need to recreate the connector and all of its properties everytime I do a remove, is this correct?  This would be tedious as I would have to re-specify the keystore, truststore, etc. everytime I do the create.  I'm wondering if it's possible to just reload the connector?  Also, I would like to do this programmatically if possible.

            • 3. Re: Restarting https connector in Jboss 7?
              Radoslav Husar Master

              Yeah, looks like there is no reload only on the conenctor. I wonder if its typical usecase having to reload that data. If it is, it might be considered to add that functionality.

               

              Actually, have you considered using :reload operation? I think thats would come in handy for you:

               

              [standalone@localhost:9999 /] :read-operation-description(name=reload)

              {

                  "outcome" => "success",

                  "result" => {

                      "operation-name" => "reload",

                      "description" => "Reloads the server by shutting down all its services and starting again. The JVM itself is not restarted.",

               

              Otherwise, writing a script to remove and add again is not that bad, you can do a CLI batch and run it from shell (or use from Java or REST).

              [standalone@localhost:9999 connector=http] :read-operation-names

              {

                  "outcome" => "success",

                  "result" => [

                      "add",

                      "read-attribute",

                      "read-children-names",

                      "read-children-resources",

                      "read-children-types",

                      "read-operation-description",

                      "read-operation-names",

                      "read-resource",

                      "read-resource-description",

                      "remove",

                      "undefine-attribute",

                      "validate-address",

                      "write-attribute"

                  ]

              }

              HTH,

              Rado

              • 4. Re: Restarting https connector in Jboss 7?
                Kyle Le Newbie

                Hi Rado,

                 

                Thanks for the reply but I don't really want to do a reload operation as this will actually try to reload the whole JBoss AS.  I was able to make some progress using the DMR ModelControllerClient to remove and re-add the connector but now I'm facing a different issue.  Here's the sequence that I'm seeing:

                 

                1.  Web client calls a certificate registration method to register a certificate into the truststore.

                2.  Web service registers the new certificate into truststore and then use ModelControllerClient to remove and re-add https connector.  Control is then returned back to web client.

                3.  Web client goes on to call next request and this results in NPE thrown in Jboss.  In the Jboss console log I get this:

                 

                16:46:24,079 ERROR [org.apache.catalina.connector.CoyoteAdapter] (http--0.0.0.0-8444-1) An exception or error occurred in the container during the request processing: java.lang.NullPointerException
                at org.apache.catalina.connector.CoyoteAdapter.postParseRequest(CoyoteAdapter.java:524) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
                at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:359) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
                at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:877) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
                at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:667) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
                at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:951) [jbossweb-7.0.0.CR4.jar:7.0.0.Final]
                at java.lang.Thread.run(Thread.java:662) [:1.6.0_27]

                 

                On the web service client side I get this:

                 

                javax.xml.ws.WebServiceException: No Content-type in the header!
                at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.process(HttpTransportPipe.java:172)
                at com.sun.xml.internal.ws.transport.http.client.HttpTransportPipe.processRequest(HttpTransportPipe.java:83)
                at com.sun.xml.internal.ws.transport.DeferredTransportPipe.processRequest(DeferredTransportPipe.java:78)
                at com.sun.xml.internal.ws.api.pipe.Fiber.__doRun(Fiber.java:587)
                at com.sun.xml.internal.ws.api.pipe.Fiber._doRun(Fiber.java:546)
                at com.sun.xml.internal.ws.api.pipe.Fiber.doRun(Fiber.java:531)
                at com.sun.xml.internal.ws.api.pipe.Fiber.runSync(Fiber.java:428)
                at com.sun.xml.internal.ws.client.Stub.process(Stub.java:211)
                at com.sun.xml.internal.ws.client.sei.SEIStub.doProcess(SEIStub.java:124)
                at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:98)
                at com.sun.xml.internal.ws.client.sei.SyncMethodHandler.invoke(SyncMethodHandler.java:78)
                at com.sun.xml.internal.ws.client.sei.SEIStub.invoke(SEIStub.java:107)
                at $Proxy31.setContext(Unknown Source)

                 

                Strange thing is, if I make my web client wait 5 seconds between the call to register the certificate and the next request then everything works fine.  If the web client immediately calls a request after the registration then I get the exception above.  Anyone have any idea what's going on here?  Seems like removing and re-adding the connector had some impact on the web client.  In a production environment we can not force the web client to wait some time between requests.  While looking for alternative means to restart the connector I happen to see an Http11Connector object that has the start/stop methods.  I'm wondering if anyone knows how to get a reference to the Http11Connector objects?  Thanks for the help.

                • 5. Re: Restarting https connector in Jboss 7?
                  Kyle Le Newbie

                  Hi All,

                   

                  Hope this is of some use.  I actually found a way to tell Jboss 7.0.0 to register the connector MBeans so that you can reload the connectors.  To enable the MBean registration you will need to include the system argument org.apache.tomcat.util.ENABLE_MODELER and set this to true when starting up Jboss.  This can be done by adding the property "<property name="org.apache.tomcat.util.ENABLE_MODELER" value="true"/>" in the system-properties of the standalone.xml configuration file.  After this is set the connector MBeans will be registered and you can use the MBeanServer to query for the appropriate connector and reload it.  Not sure if this has changed in later Jboss versions.