• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

Porting my existing java project on Netbeans to another machine gives UnsupportedClassVersionError.

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I started coding for a client-server machine on java, using RMI(Remote Method Invocation). The code works fine on my machine. It basically gives commands to the client machine and the client processes these commands and responds accordingly. After executing the command, the machine sends back its status to the server. An example would be, the server requests for an image feed from the client and the client returns an image to the server.

I used git to clone the current project and push it to another machine. When I execute the client side code, it works completely fine and the other machine(to which I pushed the source) responds the way it should.

However, when I run the server side code to code on the other machine, it gives a cryptic error that says:

C:\Users\RdX\Desktop\Thiswa
javax.naming.NamingException [Root exception is java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.UnsupportedClassVersionError: javadrone/Server (Unsupported major.minor version 51.0)]
at com.sun.jndi.rmi.registry.RegistryContext.rebind(RegistryContext.java:159)
at com.sun.jndi.toolkit.url.GenericURLContext.rebind(GenericURLContext.java:249)
at javax.naming.InitialContext.rebind(InitialContext.java:427)
at javadrone.server.ServerImpl.<init>(ServerImpl.java:46)
at javadrone.server.DroneServer.<init>(DroneServer.java:45)
at javadrone.server.DroneServer.main(DroneServer.java:84)
Caused by: java.rmi.ServerError: Error occurred in server thread; nested exception is:
java.lang.UnsupportedClassVersionError: javadrone/Server (Unsupported major.minor version 51.0)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:349)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)
at sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(StreamRemoteCall.java:273)
at sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:251)
at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:377)
at sun.rmi.registry.RegistryImpl_Stub.rebind(Unknown Source)
at com.sun.jndi.rmi.registry.RegistryContext.rebind(RegistryContext.java:157)
... 5 more
Caused by: java.lang.UnsupportedClassVersionError: javadrone/Server (Unsupported major.minor version 51.0)
at java.lang.ClassLoader.defineClass0(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:537)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:123)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:251)
at java.net.URLClassLoader.access$100(URLClassLoader.java:55)
at java.net.URLClassLoader$1.run(URLClassLoader.java:194)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:187)
at java.lang.ClassLoader.loadClass(ClassLoader.java:289)
at java.lang.ClassLoader.loadClass(ClassLoader.java:282)
at java.lang.ClassLoader.loadClass(ClassLoader.java:235)
at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:302)
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:219)
at sun.rmi.server.LoaderHandler.loadProxyInterfaces(LoaderHandler.java:707)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:651)
at sun.rmi.server.LoaderHandler.loadProxyClass(LoaderHandler.java:588)
at java.rmi.server.RMIClassLoader$2.loadProxyClass(RMIClassLoader.java:639)
at java.rmi.server.RMIClassLoader.loadProxyClass(RMIClassLoader.java:309)
at sun.rmi.server.MarshalInputStream.resolveProxyClass(MarshalInputStream.java:241)
at java.io.ObjectInputStream.readProxyDesc(ObjectInputStream.java:1469)
at java.io.ObjectInputStream.readClassDesc(ObjectInputStream.java:1432)
at java.io.ObjectInputStream.readOrdinaryObject(ObjectInputStream.java:1626)
at java.io.ObjectInputStream.readObject0(ObjectInputStream.java:1274)
at java.io.ObjectInputStream.readObject(ObjectInputStream.java:324)
at sun.rmi.registry.RegistryImpl_Skel.dispatch(Unknown Source)
at sun.rmi.server.UnicastServerRef.oldDispatch(UnicastServerRef.java:342)
at sun.rmi.server.UnicastServerRef.dispatch(UnicastServerRef.java:207)
at sun.rmi.transport.Transport$1.run(Transport.java:148)
at java.security.AccessController.doPrivileged(Native Method)
at sun.rmi.transport.Transport.serviceCall(Transport.java:144)
at sun.rmi.transport.tcp.TCPTransport.handleMessages(TCPTransport.java:460)
at sun.rmi.transport.tcp.TCPTransport$ConnectionHandler.run(TCPTransport.java:701)
at java.lang.Thread.run(Thread.java:534)


To be specific,

namingContext.rebind(RMI_PROT + name, ServerImpl.this)
is the line that generates the error.

I searched a lot of places and they say that when the JDK compliler is of a higher version than the JRE version, it may produce such an error.

However I uninstalled all prior JDKs and JREs and recompiled the code after installing JDK 7.03. It still gives the same exception.

Why is this happening and how do I correct it?

[NK: Added code tags, UseCodeTags]
 
Ranch Hand
Posts: 291
Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Did you recompile everything? Get new serial version id?

The exception says, "Thrown when the Java Virtual Machine attempts to read a class file and determines that the major and minor version numbers in the file are not supported. "
 
Nik JainJavaJainJavaJainJava
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes, I recompiled it several times on the new machine. I did a "Clean and build" on Netbeans and it wouldn't work. However I experimented by porting it to another machine (another another machine). Curiously, it doesn't throw the same exception there. However it wouldn't let me connect to any clients other than the localhost. Maybe firewall issues.
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Nik JainJavaJainJavaJainJava, did you check your private messages already?
 
Being a smart alec beats the alternative. This tiny ad knows what I'm talking about:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic