Results 1 to 8 of 8
  1. #1
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default jdk jre tomcat conflict

    Hi i am running eclipse and i have built a servlet (hello world ) which runs fine on the tomcat version that i have on my laptop
    apache-tomcat-6.0.18...

    i am running sdk 1.6 and jre 1.6

    when i add the servlet to the appropriate place on my online account i get the following error..


    Java Code:
    java.lang.UnsupportedClassVersionError: Bad version number in .class file
    i have found out that the problem is that the web hosting site is running jdk 1.5
    and apache 5.0.2.7

    both older versions

    so i recompiled in eclipse using jdk 1.5
    and set the jre to 1.5.05

    but when i lodge the servlet online i still get the same error which indicates..
    that the web hosting has an earlier version of java than the one i am compiling in ???

    any suggestions would be greatly appreciated

  2. #2
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Contact your site and ask them what the correct version should be. No need to guess it.

  3. #3
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    thanks for the response .. they told me
    jdk 1.5
    jre 1.4.2.07 or older
    jre 1.5.0_02 or older were supported

    so i tried compiling down to 1.4 standard and using the jre 1.4.2_07 ...
    still no joy same error...

    the only other thing that i can think of is the servlet jar that i have on the build path ...
    javax.servlet_2.5.0v200806031605.jar...

    is it possible that there is a conflict here ??

    thanks

  4. #4
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    You should not have any servlet API jars on your class path. The server has it's own.

  5. #5
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    thanks for the response

    this is getting tricky....

    ok so i downloaded the servlet ide for eclipse and rebuilt my helloWorld servlet..

    to their specs jdk 1.5 ....... however, using this ide it links to my version of apache tomcat which is v 6....

    now if eclipse is linking to that,,,. and that's where the call to the javax.servlet
    library is being called . there is still going to be a potential problem...

    i reloaded the page on my hosting and its not throwing any errors but unfortunately its also not displaying anything ??? ( when i go to view source code of the html) it shows nothing...

    so the only last thing i can think of doing is trying to get a copy of the older version of tomcat and install it on my system...

    link that to eclipse and then the class will be calling the right versions of the libraries ?

    the only place i could find it was


    apache ---->archive.apache.org/dist/tomcat/tomcat-5/archive/v5.0.27/]Index of /dist/tomcat/tomcat-5/archive/v5.0.27<----

    but im not sure what to do with these files...

    any help would be appreciated

  6. #6
    r035198x is offline Senior Member
    Join Date
    Aug 2009
    Posts
    2,388
    Rep Power
    7

    Default

    Did you check the error logs to see what the problem was when nothing was being displayed?
    You also need to understand that JDK version != Servlet API version.

  7. #7
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    yes thanks i understand that ( now... reading installing tomcat v5 ->6 ,jdk..)

    as i understand it the servlet api comes from the tomcat server ??

    time to fess up though and ouch ( see above postings )...

    just checked the url and the page loaded... sigh ...

    thanks for everyone who contributed... that was quite the journey...
    and at least now i gota pretty good idea what tomcat is about :)

    sorry for the stupidity

  8. #8
    simo_mon is offline Member
    Join Date
    Dec 2008
    Posts
    50
    Rep Power
    0

    Default

    and just for others who have this problem this is what i actually did....

    i got exactly the same version of apache tomcat v 5.0.2.7 from

    Index of /dist/tomcat

    i had no idea what i was doing but i re assembled all of the files into the same folder structure and order as my correctly installed and working apache tomcat v6 .... got it run from the command line .. testing with localhost:8080 etc..

    i then linked my version of eclipse to the old version v 5.0.2.7 and lowered the compilation from 1.5 to 1.4

    i then rebuilt the servlets

    transferred the new class files and web.xml docs to the host sites WEB-INF folder and viola ....

    after 6 hrs the server reloaded and all was well :)

    hope this helps someone

Similar Threads

  1. Help with TOMCAT
    By necroninja in forum Advanced Java
    Replies: 0
    Last Post: 08-04-2009, 09:52 PM
  2. Replies: 6
    Last Post: 04-08-2009, 04:05 AM
  3. About Tomcat
    By sindhuri in forum JavaServer Pages (JSP) and JSTL
    Replies: 21
    Last Post: 04-25-2008, 10:13 AM
  4. Tomcat In Eclipse - Sysdeo Tomcat Plug-in
    By JavaForums in forum Eclipse
    Replies: 1
    Last Post: 02-13-2008, 10:33 AM
  5. tomcat xml
    By Ed in forum XML
    Replies: 2
    Last Post: 07-04-2007, 05:39 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •