1 2 Previous Next 19 Replies Latest reply on Feb 17, 2014 9:58 AM by Tomaz Cerar

    NPE on Undertow Server.loopupSecurePort

    Frank Cornelis Apprentice

      Testing out the latest WildFly from github and got the following exception:

      java.lang.NullPointerException
          at org.wildfly.extension.undertow.Server.lookupSecurePort(Server.java:112)
      

      Same works perfectly on JBoss EAP 6.

       

      The NPE occurs on a JAX-RS stateless EJB session bean living within a @SecurityDomain.

        • 1. Re: NPE on Undertow Server.loopupSecurePort
          Tomaz Cerar Master

          What does your undertow subsystem configuration look like?

          • 2. Re: NPE on Undertow Server.loopupSecurePort
            Frank Cornelis Apprentice

            I'm using the AJP connector.

            • 3. Re: NPE on Undertow Server.loopupSecurePort
              Tomaz Cerar Master

              Do you have redirect-socket attribute on ajp-listener set to anything?

              • 4. Re: Re: NPE on Undertow Server.loopupSecurePort
                Frank Cornelis Apprentice

                I only added the following AJP configuration:

                <ajp-listener name="ajp" socket-binding="ajp"/>
                

                And I'm running the application over SSL.

                • 5. Re: Re: NPE on Undertow Server.loopupSecurePort
                  Tomaz Cerar Master

                  so you have ssl endpointed on apache and ajp connection to wildfly.

                   

                  if you add scheme="https" does it change anything?

                   

                  also can you post whole stacktrace, as looking in the code this should now have happened

                  • 6. Re: Re: NPE on Undertow Server.loopupSecurePort
                    Tomaz Cerar Master

                    Ping?

                     

                    any changes with latest nightly builds?

                    • 7. Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                      Frank Cornelis Apprentice

                      I still receive:

                      java.lang.NullPointerException
                      org.wildfly.extension.undertow.Server.lookupSecurePort(Server.java:112)
                      org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$2.getConfidentialPort(UndertowDeploymentInfoService.java:445)
                      io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.getRedirectURI(ServletConfidentialityConstraintHandler.java:75)
                      io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:48)
                      io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61)
                      io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56)
                      io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70)
                      io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76)
                      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
                      org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
                      io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25)
                      io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:101)
                      io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240)
                      io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
                      io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
                      io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
                      io.undertow.server.Connectors.executeRootHandler(Connectors.java:168)
                      io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687)
                      java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
                      java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
                      java.lang.Thread.run(Thread.java:744)
                      

                      This happens when I visit my web application over HTTP, while the web.xml has:

                       <security-constraint>
                              <web-resource-collection>
                                  <web-resource-name>webapp</web-resource-name>
                                  <url-pattern>/*</url-pattern>
                              </web-resource-collection>
                              <user-data-constraint>
                                  <transport-guarantee>CONFIDENTIAL</transport-guarantee>
                              </user-data-constraint>
                          </security-constraint>
                      

                      and thus tries to redirect to HTTPS.

                      I'm using AJP and a front-end Apache that does the SSL termination. AJP configuration in standalone-full.xml:

                      <ajp-listener name="ajp" socket-binding="ajp"/>
                      
                      • 8. Re: Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                        Frank Cornelis Apprentice

                        When using:

                        <ajp-listener name="ajp" socket-binding="ajp" scheme="https"/>
                        

                        the HTTP to HTTPS redirect simply does not happen.

                        • 9. Re: Re: Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                          Frank Cornelis Apprentice

                          FYI... my /etc/httpd/conf.d/whatever.conf contains:

                          <Location "/whatever">
                               ProxyPass ajp://localhost:8009/whatever
                          </Location>
                          
                          • 10. Re: Re: Re: Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                            Tomaz Cerar Master

                            Hey Frank,

                             

                            any chance you can try if it works with patched subsystem in attachment?

                             

                            To make it work you should latest nightly build and then copy attached jar to WILDFLY_HOME/modules/system/layers/base/org/wildfly/extension/undertow/main

                             

                            If it works i will make sure this comes to final we are tagging really really soon. but need feedback first.

                             

                             

                            tnx

                            tomaz

                            • 11. Re: Re: Re: Re: Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                              Frank Cornelis Apprentice

                              Hi Tomaz,

                               

                              Unfortunately I still receive the NPE with the patched JAR on the latest Wildfly tree.

                              java.lang.NullPointerException
                                  at org.wildfly.extension.undertow.Server.lookupSecurePort(Server.java:113)
                                  at org.wildfly.extension.undertow.deployment.UndertowDeploymentInfoService$2.getConfidentialPort(UndertowDeploymentInfoService.java:445)
                                  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.getRedirectURI(ServletConfidentialityConstraintHandler.java:75) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.security.handlers.AbstractConfidentialityHandler.handleRequest(AbstractConfidentialityHandler.java:48) [undertow-core-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.security.ServletConfidentialityConstraintHandler.handleRequest(ServletConfidentialityConstraintHandler.java:61) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.security.ServletSecurityConstraintHandler.handleRequest(ServletSecurityConstraintHandler.java:56) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.security.CachedAuthenticatedSessionHandler.handleRequest(CachedAuthenticatedSessionHandler.java:70) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.security.handlers.SecurityInitialHandler.handleRequest(SecurityInitialHandler.java:76) [undertow-core-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.CR4.jar:1.0.0.CR4]
                                  at org.wildfly.extension.undertow.security.jacc.JACCContextIdHandler.handleRequest(JACCContextIdHandler.java:61)
                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.server.handlers.PredicateHandler.handleRequest(PredicateHandler.java:25) [undertow-core-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.SessionRestoringHandler.handleRequest(SessionRestoringHandler.java:101) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:240) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146) [undertow-servlet-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.server.Connectors.executeRootHandler(Connectors.java:168) [undertow-core-1.0.0.CR4.jar:1.0.0.CR4]
                                  at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:687) [undertow-core-1.0.0.CR4.jar:1.0.0.CR4]
                                  at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
                                  at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
                                  at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
                              
                              • 12. Re: Re: Re: Re: Re: Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                                Tomaz Cerar Master

                                Hey,

                                 

                                I added some more logging to the whole thing.

                                 

                                can you try with attached jar and tell me what does it print just before the exception happens.

                                 

                                thank you for your help,

                                 

                                Tomaz

                                • 13. Re: Re: Re: Re: Re: Re: Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                                  Frank Cornelis Apprentice
                                  2014-02-06 21:03:35,409 INFO  [org.wildfly.extension.undertow] (default task-1) Host port
                                  2014-02-06 21:03:35,410 INFO  [org.wildfly.extension.undertow] (default task-1) Destionation port
                                  2014-02-06 21:03:35,412 ERROR [io.undertow.request] (default task-1) UT005023: Exception handling request to /dss/index.xhtml: java.lang.NullPointerException
                                  
                                  

                                  Should I add a specific logging config for this?

                                  • 14. Re: Re: Re: Re: Re: Re: Re: Re: Re: Re: NPE on Undertow Server.loopupSecurePort
                                    Frank Cornelis Apprentice

                                    mmm... the logging itself throws an exception:

                                    LogManager error of type FORMAT_FAILURE: Formatting error
                                    java.util.UnknownFormatConversionException: Conversion = '%'
                                        at java.util.Formatter.checkText(Formatter.java:2547)
                                        at java.util.Formatter.parse(Formatter.java:2533)
                                        at java.util.Formatter.format(Formatter.java:2469)
                                        at java.util.Formatter.format(Formatter.java:2423)
                                        at java.lang.String.format(String.java:2797)
                                        at org.jboss.logmanager.ExtLogRecord.formatRecord(ExtLogRecord.java:434)
                                        at org.jboss.logmanager.ExtLogRecord.getFormattedMessage(ExtLogRecord.java:397)
                                        at org.jboss.logmanager.formatters.Formatters$10.renderRaw(Formatters.java:568)
                                        at org.jboss.logmanager.formatters.Formatters$JustifyingFormatStep.render(Formatters.java:225)
                                        at org.jboss.logmanager.formatters.MultistepFormatter.format(MultistepFormatter.java:86)
                                        at org.jboss.logmanager.ExtFormatter.format(ExtFormatter.java:35)
                                        at org.jboss.logmanager.handlers.WriterHandler.doPublish(WriterHandler.java:49)
                                        at org.jboss.logmanager.ExtHandler.publish(ExtHandler.java:79)
                                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:296)
                                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:304)
                                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:304)
                                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:304)
                                        at org.jboss.logmanager.LoggerNode.publish(LoggerNode.java:304)
                                        at org.jboss.logmanager.Logger.logRaw(Logger.java:721)
                                        at org.jboss.logmanager.Logger.log(Logger.java:672)
                                        at org.jboss.logging.JBossLogManagerLogger.doLogf(JBossLogManagerLogger.java:50)
                                        at org.jboss.logging.Logger.logf(Logger.java:2112)
                                        at org.jboss.logging.DelegatingBasicLogger.warnf(DelegatingBasicLogger.java:439)
                                        at org.wildfly.extension.undertow.Server.lookupSecurePort(Server.java:113)
                                    
                                    1 2 Previous Next