6 Replies Latest reply on Aug 26, 2015 6:50 PM by deleze

    Wildfly 8.2 - Can't deploy two applications to same context

    kdorfer Newbie

      Hi,

       

      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

        • 1. Re: Wildfly 8.2 - Can't deploy two applications to same context
          Tomaz Cerar Master

          what does:

                  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:]

          do? redirect to SSL?

           

          i think you are missing redirect-socket configuration

          <http-listener name="http-listener-server1" socket-binding="http-server1" redirect-socket="https-server1"/>

          and in same similar for the server2

          • 2. Re: Wildfly 8.2 - Can't deploy two applications to same context
            kdorfer Newbie

            Hi Tomaz,

             

            That function is just forwarding to the JSP:

             

            public static void doForward(HttpServletRequest request, HttpServletResponse response, String uri) throws ServletException, IOException {

              RequestDispatcher rd = request.getRequestDispatcher(uri);

              rd.forward(request, response);

              }

             

            Even if there is no SSL in use, it looks like I get the error whenever I deploy to WAR's to the same server or different server instance that are assigned to two different IP addresses.  Whatever WAR file is deployed last is accessible but all previous WAR files generate the 'no request active' error.  If I change each 'context-path' in jboss-web.xml to something unique all applications work without any issues.  However, I need for them to all be '/'.

             

            Thanks,

            Kurt

            • 3. Re: Wildfly 8.2 - Can't deploy two applications to same context
              kdorfer Newbie

              Well, I finally figured out how to fix this.  It looks like for whatever reason the issue was being caused by c:import tags.  We used to have the settings like this, which worked in older versions of JBoss:

               

              <c:import url="/includes/somepage.jsp" context="/"/>

               

              Once we took out the 'context' portion of the tag all the sites started working again:

               

              <c:import url="/includes/somepage.jsp"/>


              I'm not exactly sure what may have been causing this to throw the 'No request is currently active' error but at least things are working.

              • 4. Re: Wildfly 8.2 - Can't deploy two applications to same context
                Tomaz Cerar Master

                that is really really odd cause of the problem.

                 

                can you by any chance try WildFly 10 builds, latest being alpha6 https://repository.jboss.org/nexus/content/groups/public-jboss/org/wildfly/wildfly-dist/10.0.0.Alpha6/

                 

                I am just curious as 10 uses much newer Jastow (jsp container) that could fix this issue.

                but it is hard to tell without trying.

                 

                you could just take standalone.xml from 9 and copy it over to 10 distro and run.

                • 5. Re: Wildfly 8.2 - Can't deploy two applications to same context
                  deleze Newbie

                  Hi kdorfer,

                   

                  I have the same problem with WildFly 8.2.1, but not with WildFly 8.2.0. It seems also coming from an include tag of a JSP page. In my case, it's Liferay.

                   

                  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.include(RequestDispatcherImpl.java:202) [undertow-servlet-1.1.8.Final.jar:1.1.8.Final]

                    at com.liferay.portal.servlet.DirectServletPathRegisterDispatcher.include(DirectServletPathRegisterDispatcher.java:55) [portal-impl.jar:]

                    at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78) [portal-impl.jar:]

                    at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53) [portal-impl.jar:]

                    at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:295) [util-taglib.jar:]

                    at com.liferay.taglib.util.IncludeTag.doInclude(IncludeTag.java:192) [util-taglib.jar:]

                    at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:83) [util-taglib.jar:]

                    at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1597)

                    at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:69) [jastow-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 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:366) [jastow-1.0.0.Final.jar:1.0.0.Final]

                    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [jastow-1.0.0.Final.jar:1.0.0.Final]

                    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259) [jastow-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]

                   

                  This may help...

                  • 6. Re: Wildfly 8.2 - Can't deploy two applications to same context
                    deleze Newbie

                    I try with Wildfly 9.0.1. It does nearly the same behaviour but it seem to switch in a "mock" mode ? It is like if the current servlet request context has been cleared. (undertow/RequestDispatcherImpl.java at 1.2.9.Final · undertow-io/undertow · GitHub)

                     

                    It seems that between these two "bold" block, there is probably something that call SecurityActions.clearCurrentServletAttachments() ;

                      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                      at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:282)

                      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:261)

                      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchMockRequest(ServletInitialHandler.java:248)

                      at io.undertow.servlet.spec.RequestDispatcherImpl.mock(RequestDispatcherImpl.java:491)

                      at io.undertow.servlet.spec.RequestDispatcherImpl.includeImpl(RequestDispatcherImpl.java:266)

                      at io.undertow.servlet.spec.RequestDispatcherImpl.include(RequestDispatcherImpl.java:258)

                      at com.liferay.portal.servlet.DirectServletPathRegisterDispatcher.include(DirectServletPathRegisterDispatcher.java:55)

                      at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)

                      at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)

                      at com.liferay.taglib.util.IncludeTag.include(IncludeTag.java:295)

                      at com.liferay.taglib.util.IncludeTag.doInclude(IncludeTag.java:192)

                      at com.liferay.taglib.util.IncludeTag.doEndTag(IncludeTag.java:83)

                      at org.apache.jsp.html.portal.render_005fportlet_jsp._jspService(render_005fportlet_jsp.java:1597)

                      at org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:69)

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

                      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:366)

                      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326)

                      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:259)

                      at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)

                      at io.undertow.servlet.handlers.ServletHandler.handleRequest(ServletHandler.java:86)

                      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:130)

                      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilterChain.doFilter(InvokerFilterChain.java:116)

                      at com.liferay.portal.kernel.servlet.filters.invoker.InvokerFilter.doFilter(InvokerFilter.java:96)

                      at io.undertow.servlet.core.ManagedFilter.doFilter(ManagedFilter.java:60)

                      at io.undertow.servlet.handlers.FilterHandler$FilterChainImpl.doFilter(FilterHandler.java:132)

                      at io.undertow.servlet.handlers.FilterHandler.handleRequest(FilterHandler.java:85)

                      at io.undertow.servlet.handlers.security.ServletSecurityRoleHandler.handleRequest(ServletSecurityRoleHandler.java:62)

                      at io.undertow.jsp.JspFileHandler.handleRequest(JspFileHandler.java:32)

                      at io.undertow.servlet.handlers.ServletDispatchingHandler.handleRequest(ServletDispatchingHandler.java:36)

                      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                      at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:43)

                      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:263)

                      at io.undertow.servlet.handlers.ServletInitialHandler.dispatchToServlet(ServletInitialHandler.java:208)

                      at io.undertow.servlet.spec.RequestDispatcherImpl.includeImpl(RequestDispatcherImpl.java:345)

                      at io.undertow.servlet.spec.RequestDispatcherImpl.include(RequestDispatcherImpl.java:258)

                      at com.liferay.portal.servlet.DirectServletPathRegisterDispatcher.include(DirectServletPathRegisterDispatcher.java:55)

                      at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.doDispatch(ClassLoaderRequestDispatcherWrapper.java:78)

                      at com.liferay.portal.servlet.ClassLoaderRequestDispatcherWrapper.include(ClassLoaderRequestDispatcherWrapper.java:53)

                     

                     

                    If I have time I will try the version 10.0.0.Beta2....