3

Packaging a hello world application generated by the wildfly swarm generator and built with Java9 crashes when deploying the application. It seems that the reason is the swarm/undertow dependency to the org.ow2.asm:asm-all:5.0.4 which is not Java9 ready.

Is there a known workaround, or a known date when swarm will be ready for Java9?

The stacktrace is:

Caused by: java.lang.IllegalArgumentException
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.objectweb.asm.ClassReader.<init>(Unknown Source)
at org.wildfly.swarm.jaxrs.internal.JAXRSArchiveImpl.isJAXRS(JAXRSArchiveImpl.java:117)
at org.wildfly.swarm.jaxrs.internal.JAXRSArchiveImpl.isJAXRS(JAXRSArchiveImpl.java:96)
at org.wildfly.swarm.jaxrs.JAXRSArchive.isJAXRS(JAXRSArchive.java:55)
at org.wildfly.swarm.jaxrs.internal.DefaultJAXRSWarDeploymentFactory.create(DefaultJAXRSWarDeploymentFactory.java:46)
at org.wildfly.swarm.jaxrs.internal.DefaultJAXRSWarDeploymentFactory$Proxy$_$$_WeldClientProxy.create(Unknown Source)
org.wildfly.swarm.container.runtime.deployments.DefaultDeploymentCreator.createDefaultDeployment(DefaultDeploymentCreator.java:69)
Naman
  • 27,789
  • 26
  • 218
  • 353
MichaelJ
  • 113
  • 6
  • 1
    WF Swarm currently is tied to JDK 8. Once WF is updated to support JDK 9, we will look to follow suit – Ken Sep 27 '17 at 16:09

2 Answers2

2

The class files in JDK 9 are v53.0 so you need ASM 6. ASM has always thrown IAE when encountering class files that are newer that it supports.

Alan Bateman
  • 5,283
  • 1
  • 20
  • 25
  • Thank you, also the [comment from Ken](https://stackoverflow.com/questions/46449735/wildfly-swarm-deployment-crash-with-java-9#comment79860790_46449735) made everything clear to me. – MichaelJ Sep 28 '17 at 07:10
2

The IllegalArgumentException can be possibly caused by different class version when scanning the bytecode which in your case which is done by org.ow2.asm:asm-all:5.0.4.

We faced similar issue faced in jetty.project#1758 which I'd to try and solve by building the jetty.project by myself but to eventually realize that org.ow2.asm would chain me back still.


The latest available version of asm on maven is :

<dependency>
   <groupId>org.ow2.asm</groupId>
   <artifactId>asm-all</artifactId>
   <version>6.0_BETA</version>
</dependency>

In case of jetty (and probably swarm as well) they were not able to integrate this as 6.0_BETA is not a valid OSGI version number:

Caused by: java.lang.IllegalArgumentException: invalid range "[6.0_BETA,6.0_BETA]": invalid version "6.0_BETA": non-numeric "0_BETA"

Related to the above a read to how jetty tried solving it.

There is already a tracker to the ow2.asm invalid version bug which you can follow.

Naman
  • 27,789
  • 26
  • 218
  • 353