Wildfly 8.2 - Can't deploy two applications to same context
kdorfer Aug 5, 2015 2:45 PMHi,
I've been wrestling with an issue for the past few days and am not sure how to correct it. I'm currently attempting to run a standalone server with multiple SSL certificates and multiple sites. Here is how I have two of the servers setup with the Undertow sybsystem:
<server name="Server1">
<http-listener name="http-listener-server1" socket-binding="http-server1"/>
<https-listener name="https-listener-server1" socket-binding="https-server1" security-realm="WebRealm_Server1"/>
<host name="www.server1.com" alias="server1.com"/>
</server>
<server name="Server2">
<http-listener name="http-listener-server2" socket-binding="http-server2"/>
<https-listener name="https-listener-server2" socket-binding="https-server2" security-realm="WebRealm_Server2"/>
<host name="www.server2.com"/>
</server>
I have each of them setup this way because each of the two sites have their own SSL certificates. When I deploy the WAR file associated with Server1 it deploys without any issues. It is being deployed with the following jboss-web.xml:
<jboss-web>
<context-root>/</context-root>
<virtual-host>www.server1.com</virtual-host>
<server-instance>Server1</server-instance>
</jboss-web>
The problem starts when I attempt to deploy the second application which usess the following jboss-web.xml:
<jboss-web>
<context-root>/</context-root>
<virtual-host>www.server2.com</virtual-host>
<server-instance>Server2</server-instance>
</jboss-web>
The second WAR file deploys without any errors. However, when I attempt to access www.server1.com the following errors start to appear:
2015-08-05 14:27:49,608 ERROR [io.undertow.request] (default task-55) UT005022: Exception generating error page /server1_homepage.html: java.lang.RuntimeException: java.lang.IllegalStateException: UT000048: No request is currently active
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:409) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:322) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:288) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:248) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:77) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:167) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.server.Connectors.executeRootHandler(Connectors.java:199) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:761) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_51]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_51]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_51]
Caused by: java.lang.IllegalStateException: UT000048: No request is currently active
at io.undertow.servlet.handlers.ServletRequestContext.requireCurrent(ServletRequestContext.java:82) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.spec.SecurityActions.requireCurrentServletRequestContext(SecurityActions.java:86) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.spec.RequestDispatcherImpl.forward(RequestDispatcherImpl.java:83) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at com.datapak.web.WebUtil.doForward(WebUtil.java:185) [datapak-oms.jar:]
at com.mainstreet.controller.SiteController.doPost(SiteController.java:566) [classes:]
at com.mainstreet.controller.SiteController.doGet(SiteController.java:126) [classes:]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:687) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at javax.servlet.http.HttpServlet.service(HttpServlet.java:790) [jboss-servlet-api_3.1_spec-1.0.0.Final.jar:1.0.0.Final]
at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:82) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43) [undertow-core-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:250) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToPath(ServletInitialHandler.java:193) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
at io.undertow.servlet.spec.RequestDispatcherImpl.error(RequestDispatcherImpl.java:403) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]
... 10 more
From what I can tell it looks like the first WAR file is attempting to have its resources served up by the second WAR file. If I then remove the second WAR file and disable/enable the first the site comes back up without any issue. Also, if I reverse the deployment, then Server1 works fine and Server2 has the issue. It seems whatever the last WAR file I deploy is the one that works and any of the previous WAR's start generating the above errors.
Can someone please point me in the right direction on how to perhaps fix this? Is it because both are being deployed to the "/" context?
Thanks,
Kurt