The root of the problem: Compilation with an incompatible JDK
The
java.lang.UnsupportedClassVersionError error occurs when an application's bytecode was compiled with a JDK version higher than the one supported by the WebLogic runtime environment. Common example: compiling with JDK 11 and attempting to deploy on a server configured with JDK 8.
Step 1: Checking active versions
1.1. In the administration console
Go to
Environment > Servers and select your server. On the
Configuration > Server Start tab, review the
JAVA_HOME values.
1.2. Via command line
Run on each node:
java -version
And for WebLogic specifically:
${DOMAIN_HOME}/bin/setDomainEnv.sh | grep "JAVA_VENDOR|JAVA_HOME"Step 2: Modifying environment variables
2.1. Editing startup scripts
Locate and edit according to your operating system:
- Unix/Linux:
${DOMAIN_HOME}/bin/setDomainEnv.sh - Windows:
%DOMAIN_HOME%binsetDomainEnv.cmd
Modify or add:
export JAVA_HOME=/ruta/nueva/jdk1.8.0_291
export PATH=${JAVA_HOME}/bin:${PATH}2.2. Node-specific configuration
For managed nodes, edit
startManagedWebLogic.sh or its equivalent, ensuring consistency with the AdminServer.
Step 3: Clean server restart
- Stop all servers in the domain:
${DOMAIN_HOME}/bin/stopWebLogic.sh - Delete temporary files in
${DOMAIN_HOME}/servers/{SERVER_NAME}/tmp - Start the AdminServer:
${DOMAIN_HOME}/bin/startWebLogic.sh - Verify the change with:
ps -ef | grep java (Linux/Unix)
FAQs: Frequently asked questions
Can I configure different JDKs per application?
Yes, through the
weblogic-application.xml file using
<package-name> and specific directives. See the
official documentation.
How can I check the compilation version of a .war/.ear file?
Use the command:
javap -verbose MyClass.class | grep "major"
Does WebLogic 12.2.1.4 support JDK 11?
Only partially for development. For production, WebLogic 14.1.1+ with an LTS JDK is required. Check the
compatibility matrix.