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
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..
i have found out that the problem is that the web hosting site is running jdk 1.5
java.lang.UnsupportedClassVersionError: Bad version number in .class file
and apache 18.104.22.168
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
Contact your site and ask them what the correct version should be. No need to guess it.
thanks for the response .. they told me
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 ...
is it possible that there is a conflict here ??
You should not have any servlet API jars on your class path. The server has it's own.
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
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.
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
and just for others who have this problem this is what i actually did....
i got exactly the same version of apache tomcat v 22.214.171.124 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 126.96.36.199 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