Version 1.13.1 not working on Weblogic 12.1.3
Bug Description
Looks like the classloader of the Weblogic application server fails to load the application. When the version of the library is downgraded to 1.0.11, Weblogic is able to load the application. Although both versions support java 1.8, the newer version is generating issues.
Example code (or command)
No response
Stacktrace
<Feb 22, 2024 11:25:31 AM EST> <Error> <Deployer> <BEA-149205> <Failed to initialize the application "REDACTED" due to error weblogic.application.ModuleException: null
null
weblogic.application.ModuleException: null
null
at weblogic.servlet.internal.WebAppModule.createModuleException(WebAppModule.java:1824)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:270)
at weblogic.servlet.internal.WebAppModule.init(WebAppModule.java:682)
at weblogic.application.internal.flow.ScopedModuleDriver.init(ScopedModuleDriver.java:162)
at weblogic.application.internal.ExtensibleModuleWrapper.init(ExtensibleModuleWrapper.java:98)
Truncated. see log file for complete stacktrace
Caused By: java.lang.IllegalArgumentException
at com.bea.objectweb.asm.ClassReader.<init>(Unknown Source)
at com.bea.objectweb.asm.ClassReader.<init>(Unknown Source)
at weblogic.application.utils.annotation.ClassInfoImpl.<init>(ClassInfoImpl.java:41)
at weblogic.application.utils.annotation.ClassfinderClassInfos.polulateOneClassInfo(ClassfinderClassInfos.java:240)
at weblogic.application.utils.annotation.ClassfinderClassInfos.populateClassInfos(ClassfinderClassInfos.java:193)
Steps to reproduce?
- Added the dependency of the connector to an existing application using maven.
- Build the war artifact
- Deploy the artifact in the application server
Environment
- OS type and version: Windows 10 Enterprise 21H2
- Java SDK version: jdk1.8.0_281
- Application server: Weblogic 12.1.3
- Cloud SQL Java Socket Factory version: 1.13.1
- Maven: 3.2.1
- HikariCP: 4.0.2
- Postgresql driver: 42.6.0
Additional Details
No response
There are several reports about this specific kind of weblogic error. They all share this stack trace from the log:
Caused By: java.lang.IllegalArgumentException
at com.bea.objectweb.asm.ClassReader.<init>(Unknown Source)
at com.bea.objectweb.asm.ClassReader.<init>(Unknown Source)
at weblogic.application.utils.annotation.ClassInfoImpl.<init>(ClassInfoImpl.java:41)
It seems like the cause is usually that there are class files in your WAR file that are compiled by a version of Java newer than Java 1.8.
I looked through dependencies of the Cloud SQL JDBC Socket Factory for Postgres and found a few of dependencies are compiled with a newer version of Java:
- org.ow2.asm:asm:9.6 (java 21)
- org.ow2.asm:asm-commons:9.2 (java 21)
- org.ow2.asm:asm-analysis:9.6 (java 21)
- org.ow2.asm:asm-tree:9.6 (java 21)
These are transitive dependencies of the unix socket library: com.github.jnr:jnr-unixsocket:0.38.22.
If you are not using the unix socket feature of the Java connector, you can safely exclude these dependencies from your project.
We will consult as a team about how to solve this permanently.
Other similar issues:
- https://github.com/jOOQ/jOOQ/issues/7649
- https://lists.apache.org/thread/jmj9t3mmz39xwjh2xpc9bdm49k26ysq1
- https://devwebcl.blogspot.com/2019/01/weblogic-log4j2-asm.html
We tried removing the java 21 transitive dependencies as suggested, but the error kept appearing. We even removed another java 21 library we found in our war artifact: org.ow2.asm.asm-util:9.6. However, the deployment was still failing.
It looks like it is something very specific to the weblogic version 12.1.3. When we deploy the same artifact on weblogic 12.2.1.4. the error does not appear.