Re: Tomcat classpath
From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 12/29/04
- Next message: JS: "Prime numbers (Eratosthenes)"
- Previous message: George W. Cherry: "Re: Problem with if-else statement in for loop"
- Next in thread: Ryan Stewart: "Re: Tomcat classpath"
- Maybe reply: Ryan Stewart: "Re: Tomcat classpath"
- Maybe reply: William Brogden: "Re: Tomcat classpath"
- Maybe reply: newB: "Re: Tomcat classpath"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Wed, 29 Dec 2004 13:38:20 -0600
<john_twigg24@yahoo.co.uk> wrote in message
news:1104343844.360695.135580@f14g2000cwb.googlegroups.com...
> ************** This saved as test.jsp **********
>
> <%@ include file="included.jinc" %>
>
Probably best to take one step at a time. Drop the include. Just do
everything in one page.
> ************** This saved as included.jinc **********
>
> <%@ page language="java" autoFlush="true" buffer="none"
> isThreadSafe="true"
> session="true" import="TestClass"
> %>
> <%!
> private TestClass testIt = null;
> %>
>
Here you import TestClass.
> ************** This saved as TestClass.java **********
>
> package TestClass;
>
> public class TestClass
> {
> static int TestValue1;
> static float TestValue2;
> }
>
The full name of this class is TestClass.TestClass
> *******************************************************
>
> I compiled TestClass.java into TestClass.class and made TestClass.jar
> from that.
>
Forget the JAR. If you have the class, why do you need it again?
> Here is the directory structure of the app within tomcat:
>
> C:\jakarta-tomcat-5.5.4\webapps\ROOT\test.jsp
> C:\jakarta-tomcat-5.5.4\webapps\ROOT\included.jinc
> C:\jakarta-tomcat-5.5.4\webapps\ROOT\WEB-INF\classes\TestClass.class
This should be ...\classes\TestClass\TestClass.class since your class
declares it is in package TestClass.
> C:\jakarta-tomcat-5.5.4\webapps\ROOT\WEB-INF\lib\TestClass.jar
>
> I also copied TestClass.jar into:
>
> C:\jakarta-tomcat-5.5.4\common\lib
>
> Since catalina.bat appears to put this into the classpath.
>
This is wrong both ways round. The common/lib folder is for JARs used by
Tomcat, not for applications.
> I ust can't get the app to run successfully, when I enter:
>
> http://localhost:8080/test/test.jsp
>
> into the browser I get these messages:
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> Generated servlet error:
> The import TestClass cannot be resolved
>
Again forget the JAR. Do one of two things:
1) Remove the package statement from your code and put TestClass.class in
WEB-INF/classes.
2) Put TestClass.class in WEB-INF/classes/TestClass, since that's the
package you declared it to be in.
- Next message: JS: "Prime numbers (Eratosthenes)"
- Previous message: George W. Cherry: "Re: Problem with if-else statement in for loop"
- Next in thread: Ryan Stewart: "Re: Tomcat classpath"
- Maybe reply: Ryan Stewart: "Re: Tomcat classpath"
- Maybe reply: William Brogden: "Re: Tomcat classpath"
- Maybe reply: newB: "Re: Tomcat classpath"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]