Link to home
Start Free TrialLog in
Avatar of mbf-it
mbf-it

asked on

!!!URGENT!!! 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.

Hi all,

I am trying to get a simple data access and display .jsp page working but I have run into difficulties.

I am running:
--- JDK 1.4.2 (C:\j2sdk1.4.2_13)
--- JRE 1.4.2 (C:\Program Files\Java\j2re1.4.2_13)
--- Apache Ant 1.6.2 (C:\apache-ant-1.6.2)
--- Jakarta Tomcat (C:\jakarta-tomcat-5.0.28)

I have the following environment variables
--- CATALINA_HOME=C:\jakarta-tomcat-5.0.28
--- JAVA_HOME=C:\j2sdk1.4.2_13
--- PATH=C:\Program Files\Java\j2re1.4.2_13\lib;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;%SystemRoot%\system32\nls;%SystemRoot%\system32\nls\ENGLISH;C:\Program Files\Novell\ZENworks\;C:\Program Files\MySQL\MySQL Server 5.0\bin;C:\Program Files\QuickTime\QTSystem\

------------------------------------------------------------------------------------------------------------------------

Here is my build file:

<project name="VMF" default="all" basedir=".">
       <description>
          Ant build file (see http://jakarta.apache.org/ant).
        </description>

       <!-- set global properties for this build -->
        <property name="src" location="src"/>
       <property name="build" location="build"/>
       <property name="lib" location="lib"/>
      <!-- <property name="tomcat.home" value="C:/Program Files/Apache Software Foundation/apache-tomcat-5.5.20"/>  -->
      <property name="tomcat.home" value="C:\jakarta-tomcat-5.0.28"/>

      <property name="tomcat.deploy" location="${tomcat.home}/webapps"/>
      <property name="deploy" location="C:\VMF"/>
       <property file="${src}/resources/General.properties"/>

        <path id="classpath">
          <fileset dir="${lib}">
                  <include name="*.jar"/>
          </fileset>
        </path>

  <target name="init">
    <tstamp/>
        <delete dir="${deploy}"/>
    <mkdir dir="${build}"/>
    <mkdir dir="${lib}"/>
    <mkdir dir="${deploy}"/>
        <!--mkdir dir="${deploy}/WEB-INF/lib"/-->
        <!--delete file="${deploy}/CashManager.war"/-->
  </target>

  <target name="compile" depends="init"
        description="compile the source" >
    <javac srcdir="${src}" destdir="${build}">
      <classpath refid="classpath"/>
          <!-- exclude junit test cases-->
          <exclude name = "test/*.*"/>

    </javac>
        <copy todir="${build}/resources">
                <fileset dir="${src}/resources"/>
            </copy>
  </target>

  <target name="jar" depends="compile">
    <!-- generate manifest -->
    <dirname property="project.dir" file="build.xml"/>
    <pathconvert property="classpath.mf"
                 dirsep="/"
                 pathsep=" "
                 refid="classpath">
      <map from="${project.dir}/lib/" to=""/>
      <map from="${project.dir}\lib\" to=""/>
    </pathconvert>
    <copy file="Manifest"
          tofile="Manifest.build"
          overwrite="yes">
      <filterset>
        <filter token="CLASSPATH" value="${classpath.mf}"/>
      </filterset>
    </copy>

    <jar jarfile="${lib}/vmf.jar" basedir="${build}" manifest="Manifest.build"/>

  </target>


      <target name="war" depends = "jar">
            <copy todir="${deploy}">
                  <fileset dir="VMF-WEB"/>
            </copy>
            <copy todir="${deploy}/WEB-INF/lib">
                  <fileset dir="${lib}"/>
            </copy>

            <war
                    basedir="${deploy}/"
                    warfile="${deploy}/VMF.war"
                        webxml="${deploy}/WEB-INF/web.xml">
                    <exclude name="${deploy}/VMF.war"/>
                  </war>
                  <copy
                        file="${deploy}/VMF.war"
                        todir="${tomcat.deploy}"/>
      </target>


<target name="all" depends="init,compile,jar,war">
</target>

</project>


-------------------------------------------------

Here is the error I get when I try to access this page...

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

Generated servlet error:
C:\jakarta-tomcat-5.0.28\work\Catalina\localhost\VMF\org\apache\jsp\jsp\greenbook_005ftech_005flist_jsp.java:6: cannot access core.Tech_List_Query


Generated servlet error:
bad class file: C:\jakarta-tomcat-5.0.28\webapps\VMF\WEB-INF\lib\vmf.jar(core/Tech_List_Query.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.
import core.Tech_List_Query;
            ^
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:412)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
      org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
      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)

---------------------- YOU'RE HELP WOULD BE GREATLY APPRECIATED!!!!!!!!!!
Avatar of Mick Barry
Mick Barry
Flag of Australia image

looks like you've got classes compiled wiuth java 5
easiest fix would be to use jdk 1.5 instead of 1.4 to run tomcat
Avatar of mbf-it
mbf-it

ASKER

so what exactly do I have to do and change???  (i.e. environment variables, eclipse settings)

sorry - I just need to make sure I get this right  :)
do u have java 5 installed?
if so change JAVA_HOME to point at it
ASKER CERTIFIED SOLUTION
Avatar of Mick Barry
Mick Barry
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mbf-it

ASKER

you are a legend!!!!!!!!!!!!

Thank you so much!!!!!!!!!!!!!!!