Unavailable dependency from jboss-deployment-structure.xml

626 views
Skip to first unread message

Miha Štemberger

unread,
Mar 14, 2023, 9:35:21 AM3/14/23
to WildFly
Hello everyone!

I am having issues with CDI after migrating to Wildfly 26.1.3. More specifically, when a jar deployment is deployed with a jboss-deployment-structure.xml:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
    <deployment>
        <module-alias name="deployment.something.jar"/>
    </deployment>
</jboss-deployment-structure>

And then a war deployment depends on that jar with a boss-deployment-structure.xml:
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.3">
    <deployment>
        <dependencies>
            <module name="deployment.something.jar"/>
        </dependencies>
    </deployment>
</jboss-deployment-structure>

Logs do show, that there is something being searched for in the correct module.
```
13:07:42,837 TRACE [org.jboss.modules] (Weld Thread Pool -- 1) Finding class com.mihas.wildfly.examples.unresolved.dependency.special.TestUtil from Module "deployment.jar-deployment-1.0.0-SNAPSHOT.jar" from Service Module Loader
13:07:42,837 TRACE [org.jboss.modules] (Weld Thread Pool -- 1) Finding local class com.mihas.wildfly.examples.unresolved.dependency.special.TestUtil from Module "deployment.jar-deployment-1.0.0-SNAPSHOT.jar" from Service Module Loader
13:07:42,837 TRACE [org.jboss.modules] (Weld Thread Pool -- 1) Loading class com.mihas.wildfly.examples.unresolved.dependency.special.TestUtil locally from Module "deployment.jar-deployment-1.0.0-SNAPSHOT.jar" from Service Module Loader
13:07:42,837 TRACE [org.jboss.modules] (Weld Thread Pool -- 1) Attempting to define class com.mihas.wildfly.examples.unresolved.dependency.special.TestUtil in Module "deployment.jar-deployment-1.0.0-SNAPSHOT.jar" from Service Module Loader
13:07:42,838 TRACE [org.jboss.modules.define] (Weld Thread Pool -- 1) Defined class com.mihas.wildfly.examples.unresolved.dependency.special.TestUtil in Module "deployment.jar-deployment-1.0.0-SNAPSHOT.jar" from Service Module Loader```

but the deployment of the war fails with:
`Caused by: java.lang.ClassNotFoundException: com.mihas.wildfly.examples.unresolved.dependency.special.TestUtil from [Module "deployment.war-deployment-1.0.0-SNAPSHOT.war" from Service Module Loader]`

I am not sure what I am missing here, has something been changed of how the configuration should be made?


Best regards,
Miha


James Perkins

unread,
Mar 14, 2023, 6:10:06 PM3/14/23
to WildFly
Have you installed the jar-deployment as a module or do you deploy it? I'm not able to deploy the example for some reason.

Miha Štemberger

unread,
Mar 14, 2023, 6:54:33 PM3/14/23
to James Perkins, WildFly
jar gets deployed and is not installed as a static module. The example
should work like this: executing mvn wildfly:deploy-only will firstly
deploy the jar(no issues here and is also visible in the WF admin GUI,
under deployments). Next, the war will deploy and fail with an error:
Caused by: java.lang.ClassNotFoundException:
com.mihas.wildfly.examples.unresolved.dependency.special.TestUtil from
[Module "deployment.war-deployment-1.0.0-SNAPSHOT.war" from Service
Module Loader]

V V tor., 14. mar. 2023 ob 23:10 je oseba James Perkins
<jper...@redhat.com> napisala:
> --
> You received this message because you are subscribed to the Google Groups "WildFly" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to wildfly+u...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/wildfly/aa97c836-7053-4199-badc-b4575477f33an%40googlegroups.com.

James Perkins

unread,
Mar 14, 2023, 8:32:12 PM3/14/23
to WildFly
I'm not really seeing what is wrong in your POM, but your WAR is not being created correctly. The webapp/WEB-INF resources are not getting copied into your WAR. Also, there are a bunch of libraries included in your WAR that shouldn't be.

Miha Štemberger

unread,
Mar 15, 2023, 4:44:41 AM3/15/23
to James Perkins, WildFly
Nice find, webapp was wrongly positioned within the war project structure. I have fixed the issue and also added an example of a working deployment in a Wildfly 20.0.1.Final container.
Have a look at the updated README for how to deploy the artifacts to specific containers.

Also, there are a bunch of libraries included in your WAR that shouldn't be.
If so, why does the deployment work within a Wildfly 20.0.1.Final container, is it something to do with migration to Jakarta? The dependencies are added by:
```<dependencies>
<dependency>
   <groupId>org.jboss.spec</groupId>
   <artifactId>jboss-javaee-8.0</artifactId>
   <version>1.0.4.Final</version>
   <type>pom</type>
</dependency>
</dependencies>```

Thanks and best regards,
Miha


V V sre., 15. mar. 2023 ob 01:32 je oseba James Perkins <jper...@redhat.com> napisala:

Miha Štemberger

unread,
Mar 17, 2023, 5:14:17 AM3/17/23
to WildFly
Bumping this, as I am still unable to discover the reason why it is not working after migrating from 20.0.1 to 26.1.3.

sreda, 15. marec 2023 ob 09:44:41 UTC+1 je oseba Miha Štemberger napisala:

James Perkins

unread,
Mar 20, 2023, 2:29:00 PM3/20/23
to WildFly
I would remove the dependency on org.jboss.spec:jboss-javaee-8.0 or at least mark it as provided. I believe that dependency is deprecated.

As far as a fix. In your WAR's jboss-deployment-structure.xml on the module dependency you need to add an attribute meta-inf="import". That should solve your issue since it needs to import the beans.xml from the library.

Miha Štemberger

unread,
Mar 22, 2023, 3:24:48 AM3/22/23
to James Perkins, WildFly
James, thank you for helping out, adding meta-inf="import" to the dependency indeed solved the issue(I am still a bit confused how it works without it in 20.0.1 version).

I would remove the dependency on org.jboss.spec:jboss-javaee-8.0 or at least mark it as provided. I believe that dependency is deprecated.

Thanks again and best regards,
Miha


V V pon., 20. mar. 2023 ob 19:29 je oseba James Perkins <jper...@redhat.com> napisala:

James Perkins

unread,
Mar 23, 2023, 12:20:20 PM3/23/23
to WildFly
There have been a lot of changes between 20.0.1 and 26.1.3 so it would be hard to track down where/why it changed :)

WRT the BOM, I guess it depends. There is a jakarta.platform:jakarta.jakarta-bom:8.0.0 BOM, https://mvnrepository.com/artifact/jakarta.platform/jakarta.jakartaee-bom/8.0.0. If you need WildFly specific dependencies then you could use the org.wildfly.bom:wildfly-jakartaee8:26.1.3.Final BOM https://mvnrepository.com/artifact/org.wildfly.bom/wildfly-jakartaee8.

Reply all
Reply to author
Forward
0 new messages