Search code examples
xmlwildflyjboss6.xwildfly-8

Configure Https blocking http wildfly 8.2 (i.e without using security-constraint in web.xml)


Migrate Jboss6 to WildFly8.2

Working on https keystone connection in wildlfy8.2. After configuring my application on standalone-full.xml conf using http://blog.eisele.net/2015/01/ssl-with-wildfly-8-and-undertow.html. I was able to access both http and https on my application i have to access https alone blocking http. After adding security-constraint inside web.xml i was able to redirect to https. But i don't want to include anything in web.xml in my new version it affects my old jboss users.

In a situation there are people who use jboss6 application without SSL keystore configuration and people using same applications in Https . Older version of jboss allows both http and https to be configured in server.xml itself. In wildfly we have to edit application war file instead of server config files.

Note : I got this link having same issue got resolved in https://developer.jboss.org/thread/253008?_sscc=t. made the changes as instructed. But it doesn't work, we are using standalone-full.xml instead of standalone.xml.

After making changes i am getting web-service port error :

jboss.deployment.subunit."XXX.ear"."XXXEJB3.jar".INSTALL: JBAS018733: Failed to process phase INSTALL of subdeployment "XXXEJB3.jar" of deployment "XXX.ear"
at org.jboss.as.server.deployment.DeploymentUnitPhaseService.start(DeploymentUnitPhaseService.java:166) [wildfly-server-8.2.0.Final.jar:8.2.0.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(ServiceControllerImpl.java:1948) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1881) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [rt.jar:1.8.0_31]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [rt.jar:1.8.0_31]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.8.0_31]
Caused by: java.lang.IllegalStateException: JBAS017350: Could not find the port number listening for protocol HTTP/1.1
at org.wildfly.extension.undertow.WebServerService.getPort(WebServerService.java:67)
at org.jboss.as.webservices.config.WebServerInfoImpl.getPort(WebServerInfoImpl.java:36)

Solution

  • For Http bloacking and Https enabling make changes to standalone-full.xml(i.e for custom server) or standalone.xml as follows

    1: In messaging - hornetq-server subsystem connectors change http to https

    <http-connector name="http-connector" socket-binding="https">
    <http-connector name="http-connector-throughput" socket-binding="https">
    

    2: In undertow subsystem change

       <http-listener name="default" socket-binding="http"/>
    

    to

    <https-listener name="default-ssl" socket-binding="https" security-realm="UndertowRealm"/> 
    

    Note: https-listener name default-ssl use this name in messaging subsystem http-acceptor and remoting subsystem http-connector

    3: Give messaging - hornetq-server subsystem http-acceptor and remoting subsystem http-connector's connector-ref as https-listener name

    <subsystem xmlns="urn:jboss:domain:messaging:2.0">....
    <http-acceptor http-listener="default-ssl" name="http-acceptor"/>
    <http-acceptor http-listener="default-ssl" name="http-acceptor-throughput">...</subsystem>
    
    <subsystem xmlns="urn:jboss:domain:remoting:2.0">....
    <http-connector name="http-remoting-connector" connector-ref="default-ssl" security-realm="ApplicationRealm"/>....</subsystem>
    

    For error : Added modify-wsdl-address to true and wsdl-port to 80 than https worked blocking http.

    <subsystem xmlns="urn:jboss:domain:webservices:1.2">
            <modify-wsdl-address>true</modify-wsdl-address>
            <wsdl-host>${jboss.bind.address:127.0.0.1}</wsdl-host>
            <wsdl-port>80</wsdl-port>
            <endpoint-config name="Standard-Endpoint-Config"/>
            <endpoint-config name="Recording-Endpoint-Config">
                <pre-handler-chain name="recording-handlers" protocol-bindings="##SOAP11_HTTP ##SOAP11_HTTP_MTOM ##SOAP12_HTTP ##SOAP12_HTTP_MTOM">
                    <handler name="RecordingHandler" class="org.jboss.ws.common.invocation.RecordingServerHandler"/>
                </pre-handler-chain>
            </endpoint-config>
            <client-config name="Standard-Client-Config"/>
        </subsystem>