Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

package javax.servlet not found in import?

 
Tom Barns
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I'm trying since more than two days to fix this problem and i could not,i almost did and try everything i know and i'm still
do not know how to fix it.
what i did is i put the following setting in tomcat.bat:
SET JAVA_HOME=c:\jdk1.2.2
SET TOMCAT_HOME=C:\jakarta-tomcat-3.2.1
that is only what i did for tomcat.
also here is my classpath setting:
//=====================================
.;c:\jdk1.2.2\bin;c:\jdk1.2.2\lib\tools.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomcat-3. 2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\webapps\ROOT\api
//=====================================
I do not know what do i need to do.
please an help.
thanks
 
vaibhav punekar
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Tom
I was also been the victim of such things quite recently.But I faced the problem for the JSP.it said "can not find class name servlet:JSP" for the sake of nothing.AS per your posting there is nothing wrong with classpath.For running servlets,you need to have "servlet.jar" in the classpath which you rightly did.
In such a case try going down the hierarchy of packages and see if there is any security problem like "access permissions".IF it is the case,give the "full control" to all the packages under tomcat.Also see if you have locked the tomcat dir.Try to be owner of all the subfolders under Tomcat.I think you are getting me.Even if the problem persists,just uninstall the hopeless stuff,reinstall it and I m sure it will work.
Many a times computer try to test our brain.We are absolutely right in everything (classpath etc.)Still things do not work.
In such cases without taking onus on ourselves it is always advisable to reinstall the thing.See unjarring your "servlet.jar" and see if "javax" is really there.
I hope this helps.
 
Tom Barns
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I did that believe me more than 3 to 4 times and even i tried different version of tomcat and i'm still getting this error.
Any additional help will be appreciated.
thanks
 
Val Dra
Ranch Hand
Posts: 439
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Tom what i would do then is this. Go to where you have jdk1.3 or whatever located. Then c:\jdk1.3\jre\lib\ext\
and put servlet.jar file in there. It should work then you don't need to configure your classpath then.
 
Tom Barns
Ranch Hand
Posts: 138
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all
I'm still can't fix it,i compiled some built in servlet within
classes directory and i got same error,i did compile them from command line and i got just one error that says:
superclass java.lang.Object of class ServletTemplate not found.
is there anything related to textpad settings?
I have jdk1.3.0_02 and tomcat3.2.1.
here is my Classpath setting:
//=============================
.;c:\jdk1.3.0_02\bin;c:\jdk1.3.0_02\lib\jaxp.jar;c:\jakarta-tomcat-3.2.1\lib\servlet.jar;c:\jakarta-tomcat-3.2.1\lib\jasper.jar;c:\jakarta-tomcat-3.2.1\lib\jaxp.jar;c:\jakarta-tomc at-3.2.1\lib\webserver.jar;c:\jakarta-tomcat-3.2.1\src;
//==============================
Here is my servlet file
//==========================
import javax.servlet.*;
import javax.servlet.http.*;
public class ServletTemplate extends HttpServlet
{
public void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException
{
PrintWriter out = response.getWriter();
response.setContentType("text/plain");
out.println("Snoop Servlet");
}
}
//==========================
 
vaibhav punekar
Ranch Hand
Posts: 134
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
Tom
Could you see "javax" package after unjarring "servlet.jar" file.
I think it must not be there or your classpath setting is not accepting that.From comand prompt you go step by step through the hierarchy of Tomcat by giving "dir" every time and see whether you see "servlet"directory at all.If it is there I would suggest to check the "access permissions" of both "tomcat and "jdk" folders.The last option is to download the tomcat afresh and try again.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic