Hi all,

I’d like to share an issue I’ve encountered when using Meecrowave
2.0.0-SNAPSHOT with JAXB/activation on recent JDKs.

In our projects we run CXF / JAX-RS with JAXB on Meecrowave. What I’ve
found is that having the following dependencies only in the webapp is not
sufficient:

<dependency>
    <groupId>jakarta.activation</groupId>
    <artifactId>jakarta.activation-api</artifactId>
</dependency>

<dependency>
    <groupId>jakarta.xml.bind</groupId>
    <artifactId>jakarta.xml.bind-api</artifactId>
    <version>4.0.0</version>
</dependency>

<dependency>
    <groupId>org.glassfish.jaxb</groupId>
    <artifactId>jaxb-runtime</artifactId>
    <version>4.0.5</version>
</dependency>

If jakarta.activation-api (and similarly JAXB) is not present directly in
Meecrowave’s own classpath (i.e. where CXF / JAXB are actually running, not
just in the webapp), I get:

java.lang.ClassNotFoundException: jakarta.activation.DataSource
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(Unknown
Source)
    at 
java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(Unknown
Source)
    at java.base/java.lang.ClassLoader.loadClass(Unknown Source)
    at 
org.glassfish.jaxb.runtime.v2.model.impl.RuntimeBuiltinLeafInfoImpl.<clinit>(RuntimeBuiltinLeafInfoImpl.java:463)
    ...
    at jakarta.xml.bind.JAXBContext.newInstance(JAXBContext.java:605)

>From what I can see, CXF/JAXB appears to be loaded by the Meecrowave
(AppClassLoader) and does not see libraries from the webapp classloader.

In the past this wasn’t an issue because JAXB was part of the JDK and
therefore visible to the AppClassLoader by default.

As a workaround I built a custom Meecrowave with the above dependencies
added directly to meecrowave-core’s pom.xml. With that change, the
application works fine.

I sending link our project, that can be used as reproducer (docker img uses
patched MW)
https://github.com/udger/udger-local-api-v4

It runs via Docker:

./buildAndRun.sh

And you can trigger the failing endpoint with:

curl -X POST -H "Content-Type: application/xml" -d '<parseUaV4Request>
  <uaString></uaString>
  <secChUa>" Not;A Brand";v="99", "Google Chrome";v="97",
"Chromium";v="97"</secChUa>
  <secChUaFullVersionList></secChUaFullVersionList>
  <secChUaMobile>?0</secChUaMobile>
  <secChUaFullVersion>"97.0.4692.71"</secChUaFullVersion>
  <secChUaPlatform></secChUaPlatform>
  <secChUaPlatformVersion></secChUaPlatformVersion>
  <secChUaModel></secChUaModel>
</parseUaV4Request>' \
  http://localhost:8080/udger-local-api-v4/parse/ua-v4

Thanks a lot for any guidance, and of course for all the work on Meecrowave
and OWB !

Best regards,
Vladimir Dvorak

Reply via email to