2

I have 2 web interfaces of a JEE application on WildFly 15. Both have different SSL certificates. And they also have different REST methods / URLs. And client shouldn't be able to see / access the respective other methods.

Having different SSL certificates on different ports by adding additional HTTPS listener was no problem at all. But now I'm struggling with the separation of the web applications.

You can use different virtual hosts by defining them in the jboss-web.xml you ship with your web application. But you can't define HTTP and HTTPS listeners on a virtual host in the WildFly configuration (in my case specifically in the standalone-full.xml). You have to add another (web) server for being able to do so. That also works so far.

So I have defined the virtual host of my 2nd (web) server in the jboss-web.xml. But I can't deploy the web application as I always get an error that WildFly can't find the virtual server:

2019-02-12 15:06:07,930 ERROR [org.jboss.as.controller.management-operation] (External Management Request Threads -- 1) WFLYCTL0013: Operation ("deploy") failed - address: ([("deployment" => "myapp-ear-1.0.4.ear")]) - failure description: {
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.server.default-server.myapp-host"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.deployment.subunit.\"myapp-ear-1.0.4.ear\".\"myapp-web-1.0.4.war\".undertow-deployment.UndertowDeploymentInfoService is missing [jboss.undertow.server.default-server.myapp-host]",
        "jboss.deployment.subunit.\"myapp-ear-1.0.4.ear\".\"myapp-web-1.0.4.war\".undertow-deployment is missing [jboss.undertow.server.default-server.myapp-host]"
    ]
}
2019-02-12 15:06:07,931 ERROR [org.jboss.as.server] (External Management Request Threads -- 1) WFLYSRV0021: Deploy of deployment "myapp-ear-1.0.4.ear" was rolled back with the following failure message: 
{
    "WFLYCTL0412: Required services that are not installed:" => ["jboss.undertow.server.default-server.myapp-host"],
    "WFLYCTL0180: Services with missing/unavailable dependencies" => [
        "jboss.deployment.subunit.\"myapp-ear-1.0.4.ear\".\"myapp-web-1.0.4.war\".undertow-deployment.UndertowDeploymentInfoService is missing [jboss.undertow.server.default-server.myapp-host]",
        "jboss.deployment.subunit.\"myapp-ear-1.0.4.ear\".\"myapp-web-1.0.4.war\".undertow-deployment is missing [jboss.undertow.server.default-server.myapp-host]"
    ]
}

Of course there is no "myapp-host" in the "default-server" web server. It is in the "myapp-server". But I can't define that in the jboss-web.xml:

<jboss-web>
    <virtual-host>myapp-host</virtual-host>
</jboss-web>

Does anyone have any idea?

EDIT:

As NikosParaskevopoulos pointed out: There is an additional parameter . So the whole thing (jboss-web.xml) should look like this:

<jboss-web>
    <server-instance>myapp-server</server-instance>
    <virtual-host>myapp-host</virtual-host>
</jboss-web>

I've tested it and it works perfectly. Thanks NikosParaskevopoulos.

BalusC
  • 1,082,665
  • 372
  • 3,610
  • 3,555
Grizzly
  • 45
  • 9
  • what do you mean with 'separation' of the web applications? Why is using 2 separate wildfly instances not applicable for your problem? – Sebastian Feb 13 '19 at 09:55
  • From what I see in the jboss-web.xml documentation, there is a `` element, specified to be *"The server-instance element specifies the which server instance configuration this application belongs to". Maybe you have to add this. i.e.: ` myapp-hostmyapp-server ` – Nikos Paraskevopoulos Feb 13 '19 at 09:56
  • @Sebastian, I don't want to have multiple WildFly instances because someone has to maintain them. In addition only the web interface should be separated, but not the JEE application behind it. – Grizzly Feb 13 '19 at 13:28
  • @NikosParaskevopoulos, thanks, I will check that. It least it sounds promising. Will reply again after I've checked it. – Grizzly Feb 13 '19 at 13:29
  • @NikosParaskevopoulos, okay, now I could check it. And, yes, that was the missing piece in the puzzle. It's working like a charm. Thanks a lot. Unfortunately you wrote your comment as a post and not as an answer, so I can't vote for it. – Grizzly Feb 13 '19 at 13:45

1 Answers1

0

From the JBoss/WildFly documentation, there is the <server-instance> element that:

[...] specifies which server instance configuration this application belongs to

So, change the jboss-web.xml to:

<jboss-web>
    <virtual-host>myapp-host</virtual-host>
    <server-instance>myapp-server</server-instance>
</jboss-web>

By the way, the XSDs and DTDs for ALL WildFly configuration XMLs can be found in the WildFly distribution under docs/schema. They contain enough documentation, I find them very helpful.

Nikos Paraskevopoulos
  • 39,514
  • 12
  • 85
  • 90
  • That was the missing piece in the puzzle. It's working like a charm. Thanks a lot. I had a look at this one here: http://www.jboss.org/j2ee/schema/jboss-web_7_2.xsd But there was only the , but not the . – Grizzly Feb 13 '19 at 20:45