Getting Unsupported major.minor version 51.0 while running ESB

Solution Verified - Updated -

Environment

  • JBoss Enterprise Application Platform (EAP)
    • 5.x
    • 6.x
  • JBoss Enterprise SOA Platform (SOA-P)
    • 5.x

Issue

  • When trying to build and deploy the helloworld quickstart I received the following error:
DEPLOYMENTS IN ERROR:
  Deployment "jboss.esb.vfszip:/home/testuser/jboss-soa-p-5/jboss-as/server/default/deploy/Quickstart_helloworld.esb/" is in error due to the following reason(s): java.lang.UnsupportedClassVersionError: org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction : Unsupported major.minor version 51.0

Resolution

  • The following error is the cause of the failure:
java.lang.UnsupportedClassVersionError: org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction : Unsupported major.minor version 51.0

  • The above error indicates that you might have build your "Quickstart_helloworld.esb" project on JDK 1.7 and while deploying it on your JBoss , the JBoss/SOA is running on JDK 1.6 .

  • So try to build your "Quickstart_helloworld.esb" project using 1.6 JDK and then deploy it on JBoss.

Root Cause

  • Incorrect java version was used in order to build the application.

Diagnostic Steps

  • If you will extract your "Quickstart_helloworld.esb" file and then if you will try to run the following command inside the directory "Quickstart_helloworld.esb/org/jboss/soa/esb/samples/quickstart/helloworld"
cd Quickstart_helloworld.esb/org/jboss/soa/esb/samples/quickstart/helloworld

javap -v MyJMSListenerAction.class 


Classfile /NotBackedUp/Downloads/Quickstart_helloworld.esb_FILES/org/jboss/soa/esb/samples/quickstart/helloworld/MyJMSListenerAction.class
  Last modified Oct 1, 2012; size 1438 bytes
  MD5 checksum 8133afd788ea16924e25a4863c3beec4
  Compiled from "MyJMSListenerAction.java"
public class org.jboss.soa.esb.samples.quickstart.helloworld.MyJMSListenerAction extends org.jboss.soa.esb.actions.AbstractActionLifecycle
  SourceFile: "MyJMSListenerAction.java"
  minor version: 0
  major version: 51
  • So in the above output of the "javap -v" command you will notice that the classes are actually compiled on JDK 1.7 that's why the generated classes are showing the class version as "51". So looks like there is some mis-configuration while setting the JAVA_HOME. Can you try the following step in order to make sure that JAVA_HOME is set properly.

Step1). Go to "%ANT_HOME%/bin" directory and then edit the "ant.bat" file and add the Correct JAVA_HOME as following somewhere at the top of this file as :

set JAVA_HOME="C:\Program Files\Java\jdk1.6.0_13"

Step2). Now rebuild your ESB Project and then deploy it on JBoss. (while building the demo project in a command prompt just run the following command to make sure that your PATH variable is having the "jdk1.6.0_13\bin" in it)

java -version

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.