This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Distributed Java and the fly likes Classformat error while trying to access ORB.init Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Distributed Java
Bookmark "Classformat error while trying to access ORB.init" Watch "Classformat error while trying to access ORB.init" New topic
Author

Classformat error while trying to access ORB.init

Shriram Gopalakrishnan
Ranch Hand

Joined: Feb 20, 2007
Posts: 44

this.serverVO = serverVO;
String arg[] = { "-ORBInitialHost", serverVO.getServerIP(),
"-ORBInitialPort", String.valueOf(serverVO.getServerPort()),
"-ORBGIOPVersion", "1.1" };
orb = ORB.init(arg, null);
System.out.println("Initialization Device handle using IOR:"+serverVO.getDcmIOR());
obj = orb.string_to_object(serverVO.getDcmIOR().trim());
deviceControlImpl = DeviceControlHelper.narrow(obj);
System.out.println(className+":CORBAService:"+"DeviceControl handle initialized successfully......");



Getting below exception while trying to access ORB.init as bolded above. LINUX platform

Exception in thread "main" java.lang.ClassFormatError: java.lang.AbstractStringBuilder (erroneous method access flags)
at _Jv_ClassReader.throw_class_format_error(byte) (/usr/lib/libgcj.so.5.0.0)
at _Jv_ClassReader.handleMethod(int, int, int, int) (/usr/lib/libgcj.so.5.0.0)
at _Jv_ClassReader.read_methods() (/usr/lib/libgcj.so.5.0.0)
at _Jv_ClassReader.parse() (/usr/lib/libgcj.so.5.0.0)
at _Jv_DefineClass(java.lang.Class, byte[], int, int) (/usr/lib/libgcj.so.5.0.0)
at java.lang.VMClassLoader.defineClass(java.lang.ClassLoader, java.lang.String, byte[], int, int, java.security.ProtectionDomain) (/usr/lib/libgcj.so.5.0.0)
at java.lang.ClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.ProtectionDomain) (/usr/lib/libgcj.so.5.0.0)
at java.security.SecureClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.CodeSource) (/usr/lib/libgcj.so.5.0.0)
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0)
at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
at _Jv_ClassReader.handleClassBegin(int, int, int) (/usr/lib/libgcj.so.5.0.0)
at _Jv_ClassReader.parse() (/usr/lib/libgcj.so.5.0.0)
at _Jv_DefineClass(java.lang.Class, byte[], int, int) (/usr/lib/libgcj.so.5.0.0)
at java.lang.VMClassLoader.defineClass(java.lang.ClassLoader, java.lang.String, byte[], int, int, java.security.ProtectionDomain) (/usr/lib/libgcj.so.5.0.0)
at java.lang.ClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.ProtectionDomain) (/usr/lib/libgcj.so.5.0.0)
at java.security.SecureClassLoader.defineClass(java.lang.String, byte[], int, int, java.security.CodeSource) (/usr/lib/libgcj.so.5.0.0)
at java.net.URLClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
at java.lang.ClassLoader.loadClass(java.lang.String, boolean) (/usr/lib/libgcj.so.5.0.0)
at _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
at java.lang.Class.forName(java.lang.String, boolean, java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
at _Jv_BytecodeVerifier.verify_instructions_0() (/usr/lib/libgcj.so.5.0.0)
at _Jv_VerifyMethod(_Jv_InterpMethod) (/usr/lib/libgcj.so.5.0.0)
at _Jv_PrepareClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at _Jv_WaitForState(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
at java.lang.VMClassLoader.linkClass0(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at java.lang.VMClassLoader.resolveClass(java.lang.Class) (/usr/lib/libgcj.so.5.0.0)
at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
at _Jv_ResolvePoolEntry(java.lang.Class, int) (/usr/lib/libgcj.so.5.0.0)
at com.cisco.test.CorbaClient.CorbaClient(com.cisco.test.ServerVO) (Unknown Source)
at com.cisco.test.CorbaClient.main(java.lang.String[]) (Unknown Source)



Shriram Gopalakrishnan
Ranch Hand

Joined: Feb 20, 2007
Posts: 44
I got the solution for this. The problem was I was compiling it in JDK 1.6 but running it in JRE1.4. This happenned because in linux by default "java" command was pointing to jdk1.4 path.

I figured out that by typing in "java -version" which gave 1.4 version and then executed java by prefixing path which in my case happens to be /usr/jdk1.6_014/bin/java
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Classformat error while trying to access ORB.init