Package...not found in import

I am using Tomcat 4.0 on windows 98, when I try to use my bean class from jsp program, I get package not found error. I read/followed all the similar problems in the forum but still have not been able to solve the problem. The error I get is as follows: ============================== type Exception report message Internal Server Error description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated. D:\Apps\Apache\Tomcat4.0\work\Standalone\localhost\cartapp\handoff1$jsp.java:3: Package com.cartapp.user not found in import. import com.cartapp.user.*; ^ 1 error, 1 warning at org.apache.jasper.compiler.Compiler.compile(Compiler.java:285) at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java:548) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspServlet.java:176) at org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.java:188) Location of files ================== My jsp file is located at: D:\Apps\Apache\Tomcat4.0\webapps\ROOT\WEB-INF\com\cartapp my bean class - User - is at: D:\Apps\Apache\Tomcat4.0\webapps\ROOT\WEB-INF\com\cartapp\user Contents of the jsp file ======================= <jsp:useBean id="handoff" scope="session" class="com.cartapp.user.User" /> <HTML> <BODY> This is the setting page! <% handoff.setFirstName("George"); %> </BODY> </HTML> First line of bean class ======================== package com.cartapp.user; Environment settings ==================== JAVA_HOME=D:\Apps\java\jdk CATALINA_HOME=D:\Apps\Apache\Tomcat4.0 CLASSPATH=;.;F:\ola\progmn\JAVA\pkgs;D:\Apps\Apache\Tomcat4.0\common\lib\servlet.jar;D:\Apps\Apache\Tomcat4.0\webapps\ROOT\WEB-INF\classes Can anyone please help, this is driving me mad. Thanks.

You'll get better Tomcat help in the Tomcat forum, so I'm moving this post there. Btw, you win 2 gold stars for an exemplary question - specific, to the point, with all the necessary information for people to provide the best level of help. I'm rushed right now so I can't research your question, but if no one has answered by noon today I'll take a shot at it myself.

I think you want to put your user class in: D:\Apps\Apache\Tomcat4.0\webapps\ROOT\WEB-INF\classes\com\cartapp\user Also, you don't need to have the "..\Tomcat\.." directories in your classpath when running Tomcat: it will automatically discover and add everything it needs to the classpath.

Rob Ross
Bartender

Joined: Jan 07, 2002
Posts: 2205

posted Sep 11, 2003 12:24:00

0

Also, don't put the JSP in the Web-INF directory. It should be one level higher, so you want to put it in this directory: D:\Apps\Apache\Tomcat4.0\webapps\ROOT

Tokunbo Oke
Ranch Hand

Joined: Sep 09, 2003
Posts: 57

posted Sep 12, 2003 00:16:00

0

Rob, Thanks for your response. Further to your recommendations, I did the following: 1. Moved the User class to D:\Apps\Apache\Tomcat4.0\webapps\ROOT\WEB-INF\classes\com\cartapp\user 2. changed my classpath to CLASSPATH=;.;F:\ola\progmn\JAVA\pkgs;D:\Apps\Apache\Tomcat4.0\common\lib\servlet.jar 3. Moved my jsp to D:\Apps\Apache\Tomcat4.0\webapps\ROOT\cartapp. In addition I changed the context to this directory in the SERVER.XML file. After restarting the computer, I got this error (class not found): =========================================== type Exception report message Internal Server Error description The server encountered an internal error (Internal Server Error) that prevented it from fulfilling this request. exception org.apache.jasper.JasperException: Unable to compile class for JSPNote: sun.tools.javac.Main has been deprecated.