You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Lee Reynolds <so...@annasart.com> on 2001/11/09 07:19:52 UTC

Newbie problem with class paths

Hello,

I'm having a problem that's gotta be simple to fix.

I'm using jakarta-tomcat-4.0.1 on a Redhat Linux 7.1 server with jdk1.3.1.
All the examples included with Tomcat-4.0.1 work, but I can't even get a
simple .jsp page to run.


I have two files, the first being
$CATALINA_HOME/webapps/test/test_tomcat.jsp
<%
        out.write("Has The Class Been Loaded Correctly - " +
TestTomCat.isClassLoaded());
%>


and the 2nd being
$CATALINA_HOME/webapps/test/WEB-INF/classes/TestTomCat.java
public class TestTomCat {

        public static String isClassLoaded() {
                return "YES";
        }

}


When I try to access the .jsp page, I get the following error.

org.apache.jasper.JasperException: Unable to compile class for JSP

An error occured between lines: 1 and 3 in the jsp file: /test_tomcat.jsp

Generated servlet error:
/usr/jakarta-tomcat-4.0.1/work/localhost/test/test_0005ftomcat$jsp.java:55:
Undefined variable or class name: TestTomCat
                	out.write("Has The Class Been Loaded Correctly - " +
TestTomCat.isClassLoaded());
                	                                                     ^
1 error

	at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled
Code)
	at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java, Compiled
Code)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspSe
rvlet.java, Compiled Code)
	at
org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.ja
va, Compiled Code)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java,
Compiled Code)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled
Code)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java, Compiled Code)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java, Compiled Code)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va, Compiled Code)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va, Compiled Code)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java,
Compiled Code)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java,
Compiled Code)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
Compiled Code)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java, Compiled Code)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
Compiled Code)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java,
Compiled Code)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java,
Compiled Code)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
, Compiled Code)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
Compiled Code)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
Compiled Code)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java,
Compiled Code)
	at org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java,
Compiled Code)
	at java.lang.Thread.run(Thread.java:484)


I know this has to be a simple "user error", but I haven't been able to
figure it out.

Help please?



Thanks!
Lee



--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>


Re: Newbie problem with class paths

Posted by David Smith <dn...@cornell.edu>.
This appears to be a syntax error.  You have to instantiate a variable of 
type TestTomCat and then use that to invoke the method isClassLoaded().  
Classes (last I knew) can not be used directly as was written in your code.

Check the error message:
> Undefined variable or class name: TestTomCat
>                 	out.write("Has The Class Been Loaded Correctly - " +
> TestTomCat.isClassLoaded());

Hope this helps in debugging....

--David Smith


On Friday 09 November 2001 01:19 am, you wrote:
> Hello,
>
> I'm having a problem that's gotta be simple to fix.
>
> I'm using jakarta-tomcat-4.0.1 on a Redhat Linux 7.1 server with jdk1.3.1.
> All the examples included with Tomcat-4.0.1 work, but I can't even get a
> simple .jsp page to run.
>
>
> I have two files, the first being
> $CATALINA_HOME/webapps/test/test_tomcat.jsp
> <%
>         out.write("Has The Class Been Loaded Correctly - " +
> TestTomCat.isClassLoaded());
> %>
>
>
> and the 2nd being
> $CATALINA_HOME/webapps/test/WEB-INF/classes/TestTomCat.java
> public class TestTomCat {
>
>         public static String isClassLoaded() {
>                 return "YES";
>         }
>
> }
>
>
> When I try to access the .jsp page, I get the following error.
>
> org.apache.jasper.JasperException: Unable to compile class for JSP
>
> An error occured between lines: 1 and 3 in the jsp file: /test_tomcat.jsp
>
> Generated servlet error:
> /usr/jakarta-tomcat-4.0.1/work/localhost/test/test_0005ftomcat$jsp.java:55:
> Undefined variable or class name: TestTomCat
>                 	out.write("Has The Class Been Loaded Correctly - " +
> TestTomCat.isClassLoaded());
>                 	                                                     ^
> 1 error
>
> 	at org.apache.jasper.compiler.Compiler.compile(Compiler.java, Compiled
> Code)
> 	at org.apache.jasper.servlet.JspServlet.loadJSP(JspServlet.java, Compiled
> Code)
> 	at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.loadIfNecessary(JspS
>e rvlet.java, Compiled Code)
> 	at
> org.apache.jasper.servlet.JspServlet$JspServletWrapper.service(JspServlet.j
>a va, Compiled Code)
> 	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java,
> Compiled Code)
> 	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java, Compiled
> Code)
> 	at javax.servlet.http.HttpServlet.service(HttpServlet.java, Compiled Code)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Applicatio
>n FilterChain.java, Compiled Code)
> 	at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterC
>h ain.java, Compiled Code)
> 	at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.j
>a va, Compiled Code)
> 	at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> 	at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.j
>a va, Compiled Code)
> 	at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> 	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java,
> Compiled Code)
> 	at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java,
> Compiled Code)
> 	at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
> Compiled Code)
> 	at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve
>. java, Compiled Code)
> 	at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
> Compiled Code)
> 	at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java,
> Compiled Code)
> 	at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java,
> Compiled Code)
> 	at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> 	at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.jav
>a , Compiled Code)
> 	at
> org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java,
> Compiled Code)
> 	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java,
> Compiled Code)
> 	at
> org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java
>, Compiled Code)
> 	at
> org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java,
> Compiled Code)
> 	at java.lang.Thread.run(Thread.java:484)
>
>
> I know this has to be a simple "user error", but I haven't been able to
> figure it out.
>
> Help please?
>
>
>
> Thanks!
> Lee
>
>
>
> --
> To unsubscribe:   <ma...@jakarta.apache.org>
> For additional commands: <ma...@jakarta.apache.org>
> Troubles with the list: <ma...@jakarta.apache.org>


--
To unsubscribe:   <ma...@jakarta.apache.org>
For additional commands: <ma...@jakarta.apache.org>
Troubles with the list: <ma...@jakarta.apache.org>