2 Replies Latest reply on May 23, 2011 9:17 AM by martin.hynar

    Multiple "Service" elements in JBoss Web Server




      In my current project there appeared problem with JBoss Web Server and multiple Service elements in it. I was reading this aged discussion http://community.jboss.org/thread/90107?tstart=0 that made me feel that multiple services is supported concept. However, I used that and the result is that it is not working. It still might be that I configured something wrong but ...


      So, I have server.xml with two service elements - each listening on different port (different Connector configuration) and each using different valves. I need this as I implemented some custom valves that provide me some logic before my application even gets chance to participate (in principle, it does validations and traffic shaping).


      When I deploy server.xml (attached here) with two service, I get this:


      08:07:08,291 INFO [Http11AprProtocol] Initializing Coyote HTTP/1.1 onhttp-localhost%2F127.0.0.1-8080

      08:07:08,291 INFO [Http11AprProtocol] Initializing Coyote HTTP/1.1 onhttp-localhost%2F127.0.0.1-9090

      08:07:08,322 INFO [StandardService] Starting service jboss.web

      08:07:08,322 INFO [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.10

      08:07:08,400 INFO [StandardService] Starting service jboss.web.custom

      08:07:08,400 INFO [StandardEngine] Starting Servlet Engine: JBoss Web/2.1.10

      08:07:08,400 INFO [Catalina] Server startup in 107 ms

      08:07:08,416 INFO [TomcatDeployment] deploy, ctxPath=/web-console

      08:07:09,261 INFO [TomcatDeployment] deploy, ctxPath=/jbossws

      08:07:09,292 INFO [TomcatDeployment] deploy, ctxPath=/invoker

      08:07:14,265INFO  [Http11AprProtocol] Starting CoyoteHTTP/1.1 on http-localhost%2F127.0.0.1-8080


      Note that 2 Coyotes are initialized but finally only one is started. After that, you can access port 9090 but it hangs and no response is ever delivered. Also log is silent about doing anything.


      Now, you can access on port 8080 JMX Console and find MBeans related to 9090 and manually start Coyote. Then log says:


      08:13:06,106 INFO [Http11AprProtocol] Starting Coyote HTTP/1.1 onhttp-localhost%2F127.0.0.1-9090


      Then accessing e.g. http://localhost:9090/jmx-console (or whatever else deployed context name) gives you 404.


      The server.xml attached here is an example configuration with 2 service elements. It uses only valves that are already available, not the ones, I use in my project. However, it still exhibits the "undesired" behavior.


      The version of the server which is used is 5.1.0 EAP (yes it is EAP, but official support was not very helpfull, they practically recommended not to use it ).


      Any help welcome here, thanks Martin

        • 1. Multiple "Service" elements in JBoss Web Server

          That is not going to work... You put a war in server/default/deploy there is no way to on which engine you want to deploy it... Well it goes to the first one so you will never deploy anything on 9090.


          I would try creating 2 VirtualHost and use the rewrite valve to use the port to choose which one to reach.

          • 2. Multiple "Service" elements in JBoss Web Server

            Hi Jean,


            I am not so sure, whether it is not going to work. I hope it will. It surely works on "raw" Tomcat - that is what I have verified myself and as Tomcat is base for JBoss Web Server, I assumed it will work also there. In Tomcat, deployed web application gets bound to both ports.


            I will try some workaround, also the one you've suggested. But, it is only workaround for something that probably shall work without workarounding.