0

For learning Spring, I created a very small project and I built successfully using Gradle. I was then able to run the resulting .war successfully using java -jar UserSettingController.war, getting the Spring message:

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::  (v2.1.0.BUILD-SNAPSHOT)

Next, I wanted to move this from Tomcat to Websphere Liberty. So, naively, I copied the .war file from my project/build/libs/ to the appropriate dropins folder, then started up the Liberty server. At that point, what I see in the Liberty console.log is not the Spring logo, but rather the following:

[WARNING ] CWWKC0044W: An exception occurred while scanning class and annotation data. The exception was java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at [internal classes]
.
[WARNING ] CWWKC0044W: An exception occurred while scanning class and annotation data. The exception was java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at [internal classes]
.
[WARNING ] CWWKC0044W: An exception occurred while scanning class and annotation data. The exception was java.lang.IllegalArgumentException
    at org.objectweb.asm.ClassReader.<init>(Unknown Source)
    at [internal classes]
.
[AUDIT   ] CWWKT0016I: Web application available (default_host): http://ui15-lin.utopusinsights.com:9080/UserSettingController/
[AUDIT   ] CWWKZ0001I: Application UserSettingController started in 4.829 seconds.
[AUDIT   ] CWWKF0012I: The server installed the following features: [jsp-2.2, servlet-3.1, ssl-1.0, jndi-1.0, websocket-1.0, json-1.0, localConnector-1.0, adminCenter-1.0, distributedMap-1.0, jaxrs-1.1, restConnector-1.0].
[AUDIT   ] CWWKF0011I: The server defaultServer is ready to run a smarter planet.

My question is: Do those [Warning]s matter; if so, what's the problem? Or is the application actually listening via the Web server, and if so, to which port is it listening (8080?)?

Andy Guibert
  • 41,446
  • 8
  • 38
  • 61
Mark Lavin
  • 1,002
  • 1
  • 15
  • 30
  • Sometimes the warnings can be ignored, typically these are caused by annotations not being found or a bytecode level mismatch. A few questions: what version of Liberty are you using? what version of java are you compiling at and running at? – Andy Guibert Apr 24 '18 at 14:12
  • Also the full stack trace will be in the messages.log and that might help to work out what the issue was. – Alasdair Apr 24 '18 at 14:13
  • also, to your "which port" question, the answer is 9080, which is indicated by this AUDIT message in logs: `[AUDIT ] CWWKT0016I: Web application available (default_host): http://ui15-lin.utopusinsights.com:9080/UserSettingController/` – Andy Guibert Apr 24 '18 at 14:14
  • Andy, I'm using WAS Liberty 8.5.5.9 and java 8. Alasdair, the messages.log shows detailed stack traces that don't inform more than the Warnings above. – Mark Lavin Apr 24 '18 at 14:46
  • I would recommend upgrading to a newer WAS Liberty release -- you can get the latest (18.0.0.1) for free from wasdev.net, and it may save you some troubleshooting as Liberty has been including better Spring support in the newer releases. – Andy Guibert Apr 24 '18 at 15:53

1 Answers1

1

Very probably, the application has included a jar file which has a java9 feature.

Most trivially, there is a normal class which has been compiled to java9.

More probably, the application has pulled in a utility jar, for example log4j, which has a "module-info" class, or which contains a multi-release directory (currently, only "META-INF/versions/9" is possible).

(See https://www.javaworld.com/article/3184029/java-language/java-9s-other-new-enhancements-part-4-multi-release-jar-files.html, for more information about multi-release jars.)

A "module-info" class file will always be compiled to java9 or higher. Classes in a multi-release directory will be compiled to the java version which is provided as the directory name.

In all cases, if the class reaches annotations processing using ASM, an IllegalArgumentException will occur. (An attempt to load the class will also result in an exception.)

The problem occurs, in part, because current WebSphere Liberty annotation processing uses a simple test to discover "class-type" resources, the test being to test whether the class resource name (file or jar entry) ends with ".class". Prior to the introduction of module-info type classes and prior to the placement of classes under the META-INF folder, this test was sufficient.

As an update, a code change is being made which will prevent problem classes (the class "module-info" or any class under "META-INF") from being processed. See the open-liberty issue 1635: https://github.com/OpenLiberty/open-liberty/issues/1635 for more information.

In regards to the project update which resolves the problem: My best sense is that that project update impacts what jars are put into the application, with the result that jars with java9 features are no longer being put in.

Thomas Bitonti
  • 1,179
  • 7
  • 14
  • I'm building this project with Gradle rather than "manually", therefore I need some way to control which jars (in particular, logging jars) get included in the build. How can I do this? – Mark Lavin Apr 26 '18 at 17:09