-
1. Re: Issues in Ejb 3.0 Deployment
jaikiran Aug 27, 2008 10:09 AM (in response to vasudm82)java.lang.ClassNotFoundException: Unexpected error during load of: com.demo.hello.HelloBeanBean, msg=Bad version number in .class file
at
You probably compiled it with a higher version of JDK and are using JBoss with a lower version of Java.
What do the following commands output?echo %JAVA_HOME%
java -version
Also ensure that your Eclipse is not pointing to some other JDK version for compiling. -
2. Re: Issues in Ejb 3.0 Deployment
vasudm82 Aug 27, 2008 12:55 PM (in response to vasudm82)Hi Kiran,
Thanks for the quick response.
As i said earlier, I have only one jdk in my system. 1.5.0._07
C:\>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.5.0_07C:\>java -version
java version "1.5.0_07"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_07-b03)
Java HotSpot(TM) Client VM (build 1.5.0_07-b03, mixed mode, sharing)
Eclipse also points to the same.
More over I am getting this exception only during ejb deployment. When i remove this ejb.jar from the ear, The other war files are properly deployed and functioning as well.
When i try to deploy a ejb jar ( both via an ear or separately i am getting this problem ).
I am kind of stuck over here.
Thnx
Vasu -
3. Re: Issues in Ejb 3.0 Deployment
peterj Aug 27, 2008 1:31 PM (in response to vasudm82)Two things to try.
In Eclipse, In the Package Explorer, when you expand your project there should be an entry for "JRE System Library" with a version in brackets behind it. What is that version?
From a command prompt, run:
%java_home%\bin\javap -verbose -classpath xxx com.demo.hello.HelloBeanBean
where xxx is the base directory into which Eclipse is compiling the classes. Post the output. -
4. Re: Issues in Ejb 3.0 Deployment
vasudm82 Aug 30, 2008 2:23 AM (in response to vasudm82)Hi PeterJ
Appologies for the delayed reply.
In Eclipse, In the Package Explorer, when you expand your project there should be an entry for "JRE System Library" with a version in brackets behind it. What is that version?
I checked it. It is the same version 1.5.0_07
From a command prompt, run:
%java_home%\bin\javap -verbose -classpath xxx com.demo.hello.HelloBeanBean
where xxx is the base directory into which Eclipse is compiling the classes. Post the output.
Here is the output
Compiled from "HelloBeanBean.java"
public class com.demo.hello.HelloBeanBean extends java.lang.Object implements com.demo.hello.HelloBean
SourceFile: "HelloBeanBean.java"
RuntimeVisibleAnnotations: length = 0xB
00 01 00 22 00 01 00 23 73 00 24
minor version: 0
major version: 50
Constant pool:
const #1 = class #2; // com/demo/hello/HelloBeanBean
const #2 = Asciz com/demo/hello/HelloBeanBean;
const #3 = class #4; // java/lang/Object
const #4 = Asciz java/lang/Object;
const #5 = class #6; // com/demo/hello/HelloBean
const #6 = Asciz com/demo/hello/HelloBean;
const #7 = Asciz ;
const #8 = Asciz ()V;
const #9 = Asciz Code;
const #10 = Method #3.#11; // java/lang/Object."":()V
const #11 = NameAndType #7:#8;// "":()V
const #12 = Asciz LineNumberTable;
const #13 = Asciz LocalVariableTable;
const #14 = Asciz this;
const #15 = Asciz Lcom/demo/hello/HelloBeanBean;;
const #16 = Asciz hello;
const #17 = Field #18.#20; // java/lang/System.out:Ljava/io/PrintStream;
const #18 = class #19; // java/lang/System
const #19 = Asciz java/lang/System;
const #20 = NameAndType #21:#22;// out:Ljava/io/PrintStream;
const #21 = Asciz out;
const #22 = Asciz Ljava/io/PrintStream;;
const #23 = String #24; // Hello
const #24 = Asciz Hello;
const #25 = Method #26.#28; // java/io/PrintStream.println:(Ljava/lang/String;)V
const #26 = class #27; // java/io/PrintStream
const #27 = Asciz java/io/PrintStream;
const #28 = NameAndType #29:#30;// println:(Ljava/lang/String;)V
const #29 = Asciz println;
const #30 = Asciz (Ljava/lang/String;)V;
const #31 = Asciz SourceFile;
const #32 = Asciz HelloBeanBean.java;
const #33 = Asciz RuntimeVisibleAnnotations;
const #34 = Asciz Ljavax/ejb/Stateless;;
const #35 = Asciz name;
const #36 = Asciz HelloBeanBean;
{
public com.demo.hello.HelloBeanBean();
Code:
Stack=1, Locals=1, Args_size=1
0: aload_0
1: invokespecial #10; //Method java/lang/Object."":()V
4: return
LineNumberTable:
line 7: 0
LocalVariableTable:
Start Length Slot Name Signature
0 5 0 this Lcom/demo/hello/HelloBeanBean;
public void hello();
Code:
Stack=2, Locals=1, Args_size=1
0: getstatic #17; //Field java/lang/System.out:Ljava/io/PrintStream;
3: ldc #23; //String Hello
5: invokevirtual #25; //Method java/io/PrintStream.println:(Ljava/lang/String;)V
8: return
LineNumberTable:
line 11: 0
line 13: 8
LocalVariableTable:
Start Length Slot Name Signature
0 9 0 this Lcom/demo/hello/HelloBeanBean;
} -
5. Re: Issues in Ejb 3.0 Deployment
jaikiran Aug 30, 2008 3:40 AM (in response to vasudm82)minor version: 0
major version: 50
This indicates that the file was compiled using Java6. Somewhere in Eclipse, JDK 6 is being used.
Try this - In Eclipse, Project -> Properties -> Java Compiler, set the "Generated .class files compatibility" to 5.0. Then rebuild your project class files. -
6. Re: Issues in Ejb 3.0 Deployment
vasudm82 Aug 30, 2008 5:18 AM (in response to vasudm82)
Bingo .. You guys were right ....
java compiler setting was pointing to jdk 6.0 .. ( but i dont have it in my system )..
now i am able to deploy my app..
Thanks to both of you guys Kiran and Peter for your help.