Unsupported Class Version Error

Rohit Elayathu picture Rohit Elayathu · Feb 1, 2012 · Viewed 38.7k times · Source

While trying to call an EJB made using NETbeans (using jdk1.7) from a client made using Eclipse IDE (using jdk1.6), I am getting following error-

Exception in thread "main" java.lang.UnsupportedClassVersionError: stateless/TestEjbRemote : Unsupported major.minor version 51.0
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClassCond(ClassLoader.java:631)
    at java.lang.ClassLoader.defineClass(ClassLoader.java:615)
    at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:141)
    at java.net.URLClassLoader.defineClass(URLClassLoader.java:283)
    at java.net.URLClassLoader.access$000(URLClassLoader.java:58)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:197)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
    at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
    at com.sun.ejb.EJBUtils.getBusinessIntfClassLoader(EJBUtils.java:688)
    at com.sun.ejb.EJBUtils.loadGeneratedRemoteBusinessClasses(EJBUtils.java:463)
    at com.sun.ejb.EJBUtils.lookupRemote30BusinessObject(EJBUtils.java:414)
    at com.sun.ejb.containers.RemoteBusinessObjectFactory.getObjectInstance(RemoteBusinessObjectFactory.java:75)
    at javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
    at com.sun.enterprise.naming.impl.SerialContext.getObjectInstance(SerialContext.java:556)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:514)
    at com.sun.enterprise.naming.impl.SerialContext.lookup(SerialContext.java:455)
    at javax.naming.InitialContext.lookup(InitialContext.java:392)
    at Main.main(Main.java:19)

Any solution to this problem ?

Answer

Ravindra Gullapalli picture Ravindra Gullapalli · Feb 1, 2012

Try to change the Target JRE version to 1.6 in Build Configuration.