Win a copy of The Little Book of Impediments (e-book only) this week in the Agile and Other Processes forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Problem with the first example of HFSJ

 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
This problem might seem silly. I'm able to compile the java file and deploy the web app. But when I try to run it, using "http://localhost:8080/ch1/Serv1", I'm geting this error:
root cause

java.lang.UnsupportedClassVersionError: (Ch1Servlet) bad major version at offset=6
at java.lang.ClassLoader.defineClassImpl(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:211)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:147)
at org.apache.catalina.loader.WebappClassLoader.findClassInternal(WebappClassLoader.java:1634)
at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:860)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1307)
at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1189)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Thread.java:811)


Please can anyone tell me what to do with this! Should I use any other JDK version for compiling this??

Regards,
Anitha
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Which version of java did you use to compile it ?
And under which version of JRE is your web app running ?
Make sure that they are same.
 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm using Sun JDK 1.5.0_05 for compiling teh java file and the JRE version
is also 1.5.0_05. They are the same.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Are you sure there is no other version of Java on your system ?
Please check JAVA_HOME.
And on the command line, check java -version

(please be careful of the Naming Policy )
[ January 16, 2006: Message edited by: Satou kurinosuke ]
 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\SCWCD\HFSJ\project1\classes>java -fullversion
java full version "1.5.0_05-b05"

and

JAVA_HOME = C:\Program Files\Java\jdk1.5.0_05\jre

Regards,
Anitha
 
Marc Peabody
pie sneak
Sheriff
Posts: 4727
Mac Ruby VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Anitha", we don't have many rules around here but our naming policy is one of them. Not complying with the policy will lead to your account becoming locked. This warning hopefully will prevent that from happening, but some action is required on your part.

Please review the policy here and you can change your Publicly Displayed Name here.

(Hint: Your name should have two words.)
 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry for the blunder created with display name....
My real name isi Anitha, and finally I have maintained it as the
display name.
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can you also try "java -version" ? Thanks.

Also, which server are you using ?
 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
C:\SCWCD\HFSJ\project1\classes>java -version
java version "1.5.0_05"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_05-b05)
Java HotSpot(TM) Client VM (build 1.5.0_05-b05, mixed mode, sharing)

I'm using Tomcat Server 5.0.28. And I have been using servlets in the past.
But I don't know why I'm getting this exception !!
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you compile on the command line, or are you using a GUI ?
 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I compiled it on command line using the command :
javac -classpath C:\jakarta-tomcat-5.0.28\common\lib\serv
let-api.jar -d classes src\Ch1Servlet.java
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also check Tomcat's properties, to make sure it uses JRE 1.5
(In Tomcat 5.5, there is a link "Configure Tomcat". How about 5.0 ? )
 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I got it working
I saw the config in Tomcat server. It was using a different version of Java.
Thanks a lot for your time and response

Regards,
Anitha
 
Vishnu Prakash
Ranch Hand
Posts: 1026
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

JAVA_HOME = C:\Program Files\Java\jdk1.5.0_05\jre


This is NOT correct.

Modify it to.


JAVA_HOME=C:\Program Files\Java\jdk1.5.0_05
TOMCAT_HOME=C:\jakarta-tomcat-5.0.28
classpath=%classpath%;.;C:\jakarta-tomcat-5.0.28\common\lib\servlet-api.jar;


What version of windows are you using?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Got it working ? Great.

Don't forget to look at Marc and Vishnu's comments too
 
Anitha Ramaswamy
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sure.
I find this forum really interactive and helpful.
Thanks all,
Anitha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic