| Author |
javax.servlet package not found error
|
Dhivya Imayavaramban
Greenhorn
Joined: Oct 23, 2012
Posts: 3
|
|
Hi
I like to do project in java servlet in tomcat. I have installed jdk1.7.0_03 version and Apache Tomcat 7.0.22 version and also i set classpath for both of them.
this is my classpath value
"C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\bin;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\annotations-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\tomcat-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\servlet-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\jsp-api.jar;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\el-api.jar;C:\Servlets+JSP;C:\Program Files (x86)\Java\jdk1.7.0_03;.;C:\Program Files\Apache Software Foundation\Apache Tomcat 7.0.22\lib\*;
My java program was running successfully but
im getting javax.servlet package not found error while running servlet program....
I dont know what,s the problem... someone help me to get rid of this problem
What s the mistake i did
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14475
|
|
Welcome to the JavaRanch, Dhivya!
The javax.servlet servlet classes reside in 2 places: the servlet-api.jar and in the Tomcat server internal jars.
When compiling a J2EE webapp, you have to have the servlet-api.jar in the compile classpath, however, you do not include copies of it or any other library in the TOMCAT_HOME/lib directory in the WAR that you produce. Tomcat will supply them at run time.
Beyond that, as long as what you have produced is a valid WAR (as defined by the J2EE spec) and properly deployed it into Tomcat, then launched Tomcat using the standard startup scripts that come with Tomcat, everything should resolve properly.
|
Customer surveys are for companies who didn't pay proper attention to begin with.
|
 |
Dhivya Imayavaramban
Greenhorn
Joined: Oct 23, 2012
Posts: 3
|
|
HI
I didnt get the output yet.... What i have to deploy into tomcat....
I have a doubt actually..... am i using the correct version of java and tomcat?
|
 |
Tim Holloway
Saloon Keeper
Joined: Jun 25, 2001
Posts: 14475
|
|
Your JVM and Tomcat releases should be compatible. You do not have to set explicit classpaths, but you do need to set the JAVA_HOME environment variable to point to the JDK directory before launching Tomcat.
To deploy a webapp into Tomcat, you must create it in WAR format, as documented by the J2EE specification. A WAR file can then be deployed by copying it into the TOMCAT_HOME/webapps directory.
|
 |
 |
|
|
subject: javax.servlet package not found error
|
|
|