Hi André,
On 21.12.2008 23:28, André Warnier wrote:
I have created (ok, copied from Chuck would be more exact) a tiny weeny
little servlet. It's about 15 lines including comments.
On my Windows PC, where I have a Sun JDK 1.6 and Tomcat 5.5 installed,
the servlet compiles fine, with the following command :
javac -classpath
%CLASSPATH%;C:\java6jdk\lib\tools.jar;C:\java6jdk\jre\lib\jsse.jar;C:\Tomcat5.5\common\lib\servlet-api.jar;C:\Tomcat5.5\common\lib\commons-el.jar
%1
Side remark: You shouldn't need tools.jar.
Then I move the resulting servlet class to the server where it is
supposed to run, which has a Tomcat 5.0.x running under an IDM JDK 1.5.
When I call this servlet, I get an error in the tomcat logfile, saying
essentially that it cannot load this servlet, because the major version
doesn't match (I guess it means Java's).
You compiled with Java 6 and try to run under Java 5. That won't work,
unless you add "-target 1.5" to your javac arguments.
"No problema ! Piece o'cake ! I'll just move the source of my servlet to
the target machine and compile it there with the IBM javac and the
Tomcat5 libraries", says me.
Well, that gives these errors when compiling :
Unfortunately you didn't tell us, how you called javac on the IBM
system. I think it is recommendation number 6. ;)
DumpUser.java:6: package javax.servlet does not exist
import javax.servlet.ServletException;
^
DumpUser.java:7: package javax.servlet.http does not exist
import javax.servlet.http.HttpServlet;
^
DumpUser.java:8: package javax.servlet.http does not exist
import javax.servlet.http.HttpServletRequest;
etc... (about 8 of them above-like messages).
Looks like servlet-api.jar is not on your build classpath. Look inside
the jar, you can find all the missing classes there.
So now, what's the recommendation, apart from in that order
- nuking the Tomcat 5.0
- nuking the IBM Java 1.5
- nuking the server (*)
- throwing my laptop out the window (**)
I would recommend a couple of those, but if you only want to solve the
actual problem, then either use "-target 1.5" on your PC or check your
javac commandline on the system with the IBM JDK.
Regards,
Rainer
---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org