Win a copy of TDD for a Shopping Website LiveProject this week in the Testing forum!
  • 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
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

HFSJ Jsp Compilation - Status 500 error message

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

I am going over HFSJ. In Chapter 3 the final stage of deployment - (Servlet version 3 that includes the call to Jsp) is creating a consistent trouble for me.

I am not able to get over this error Status 500. Upon surfing through the questions posted here, I was able to find out that there is a version conflict. But however, I am using Tomcat 5.0 which supports Java sdk version 1.4.

The error am getting is:
Http Status 500

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Unable to compile class for JSP

Generated servlet error:
C:\Program Files\Apache Software Foundation\Tomcat 5.0\work\Catalina\localhost\Beer-v1\org\apache\jsp\result_jsp.java:8: cannot access java.lang.Object


Generated servlet error:
bad class file: C:\Program Files\Java\jre1.6.0\lib\rt.jar(java/lang/Object.class)
class file has wrong version 49.0, should be 48.0
Please remove or make sure it appears in the correct subdirectory of the classpath.
public final class result_jsp extends org.apache.jasper.runtime.HttpJspBase
^
1 error



org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:437)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:497)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:476)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:464)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
com.example.web.BeerSelect.doPost(BeerSelect.java:28)
javax.servlet.http.HttpServlet.service(HttpServlet.java:709)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)


note The full stack trace of the root cause is available in the Apache Tomcat/5.0.30 logs.





Below is the other related details that I felt maybe needed.

C:\Users\Praveen>java -version
java version "1.4.2_04"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_04-b05)
Java HotSpot(TM) Client VM (build 1.4.2_04-b05, mixed mode)





CLASSPATH: C:\j2sdk1.4.2_04\bin;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\jsp-api.jar;C:\Program Files\Apache Software Foundation\Tomcat 5.0\common\lib\struts.jar


JAVA_HOME: C:\j2sdk1.4.2_04

PATH: C:\j2sdk1.4.2_04\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Program Files\Common Files\Roxio Shared\DLLShared\;C:\Program Files\Common Files\Roxio Shared\9.0\DLLShared\;C:\Program Files\Common Files\Teleca Shared;C:\BIN;C:\TC\BIN;C:\Program Files\IBM\Installation Manager\eclipse\lib



Can someone please guide me as to what could the exact problem in this case be, and how I can resolve it. Thanks a bunch for your time.
 
author & internet detective
Posts: 41073
848
Eclipse IDE VI Editor Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Praveen,

class file has wrong version 49.0, should be 48.0


This error means something was compiled with Java 5 and being run with Java 1.4. You either need to compile with Java 1.5 or run with a later version of Tomcat. Tomcat 5.5 supports Java 5.
 
Praveen Shivashankar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Jeanne Boyarsky:
Praveen,

This error means something was compiled with Java 5 and being run with Java 1.4.




Hi Jeanne .. Thanks a lot for the response. I have a doubt regarding this. All along the classpath and other required variables, I've specified the java version 1.4 to be used. How can it be possible that Java 5 was used for compiling? The javac command that is being used is present inside the j2sdk1.4.2_04\bin folder isn't it? I am trying to understand the nature of how this error gets generated... inspite of having specified the version of java to be used.

Can you/anyone please guide me on this? Thanks!
 
Praveen Shivashankar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello!! Can someone please resolve the query? Anybody there......?!!
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

All along the classpath and other required variables, I've specified the java version 1.4 to be used.


Which "other" variables?

javac command that is being used is present inside the j2sdk1.4.2_04\bin folder isn't it?


Depends on your invocation of the command.And is it the only version you have installed?
Tip: If you are using windows xp, then at the command prompt type path to see if your path is set to version 5.

Hope this helps
 
Praveen Shivashankar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Amit Ghorpade:

Depends on your invocation of the command.And is it the only version you have installed?
Tip: If you are using windows xp, then at the command prompt type path to see if your path is set to version 5.

Hope this helps




As far as my knowledge goes (which is not very far actually!!) that is the only version I have installed. I am using Windows Vista Home Premium. I have in the original post listed all the variables that I have set - CLASSPATH, JAVA_HOME & Path... in all of those I have directed it to 1.4 version only. I am not using any IDE to code the programs.. though earlier I did use MyEclipse 3.5 GA.
 
Amit Ghorpade
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry I missed the variables stuff in your original post.

This means currently you only have version 1.4.
But as you can see

C:\Program Files\Java\jre1.6.0\lib\rt.jar(java/lang/Object.class)


is pointing to JRE 1.6.

The only thing that comes to my mind is deleting the generated servlet file for the JSP. And a retry.
 
Marshal
Posts: 75642
354
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Even more confusing; you have a folder called 1.6 and are getting a 49.0 class file, which is Java5 out of it. If Amit Ghorpade's suggestion doesn't work, try reinstalling Java and also go through these FAQs.
 
Praveen Shivashankar
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Okie.. I have uninstalled Java SDK version 1.4, and have installed 1.5. I also recompiled all the files and deployed them appropriately. But yet am facing the same problem!

Is there any other way to work around this problem? Should I uninstall the Java version 6 that is present in my program files? I think it came as a default installation along with the Windows vista Home Premium.

And help plzzzzzzzzz?!!
[ August 06, 2008: Message edited by: Praveen Shivashankar ]
 
I want my playground back. Here, I'll give you this tiny ad for it:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic