Link to home
Start Free TrialLog in
Avatar of rosshind
rosshind

asked on

Tomcat - Apache and JSP not finding class files

Hi.

I have a jsp/ java class application on tomcat / Apache.  My package is called diablopackage it is located in tomcathome/shared/classes/diablopackage . I have created a test page to see what the problem might be called indextest.jsp .


I had this working on hte live environment, but I need to create a local copy of the site for testing / redevelopment.  

I get errors like this:

An error occurred at line: 18 in the jsp file: /indextest.jsp
Generated servlet error:
/root/jakarta-tomcat-5.0.28/work/Catalina/diablolocal/_/org/apache/jsp/indextest_jsp.java:420: ';' expected
    out.print modPresentation.formatMoney(new Double(2.5));


modPresentation is a class in diablopackage which is in my classpath and is  imported intothe page using:

<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="java.util.*, java.sql.*, diablopackage.*" %>


at the top.  Like I say this was working in hte live environment, but not on my machine. I think it is a configuration issue
Avatar of rosshind
rosshind

ASKER

The full stack trace reveals that the jsp is not compiled prolperly (I thinK)


2005-05-14 11:22:22 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 18 in the jsp file: /indextest.jsp
Generated servlet error:
/root/jakarta-tomcat-5.0.28/work/Catalina/diablolocal/_/org/apache/jsp/indextest_jsp.java:420: ';' expected
    out.print diablopackage.modPresentation.formatMoney(new Double(2.5));
                           ^
1 error



      at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:84)
      at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:332)
      at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:412)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:472)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:451)
      at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
      at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511)
      at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:295)
      at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
      at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
      at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
      at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
      at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
      at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:300)
      at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:374)
      at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:743)
      at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:675)
      at org.apache.jk.common.SocketConnection.runIt(ChannelSocket.java:866)
      at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
      at java.lang.Thread.run(Thread.java:534)
ASKER CERTIFIED SOLUTION
Avatar of bloodredsun
bloodredsun
Flag of Australia image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Try deleting the compile jsp after checking it for errors
There isnt an error in code. The error message is eroneous. The code has been working fine on the live environment, there is not a prob with missing semi-colons.  I get the same or similar errors on every page of the application.  The problem is to do with configuration.  To eliminate the possibility of syntax errors I have created a test page which is very simple and looks like this:
<code>
<%@ taglib prefix="c" uri="http://java.sun.com/jstl/core" %>
<%@ page import="java.util.*, java.sql.*, diablopackage.*" %>


<body bgcolor="#FFFFFF"  leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
hello
<%
    out.print diablopackage.modPresentation.formatMoney(new Double(2.5));
%>
</code>



A point to note,  it doesnt matter what I put into the <%@ page import="java.util.*, java.sql.*, diablopackage.*" %> line.  I still get the same error on this test page even if i put for example :<%@ page import="javaMadeup.util.*, javaShouldRaiseError.sql.*, diablopackageNotThere.*" %>


I guess nobody has come up with this problem before?
Forget those <code> and </code> tags, I put that in because I thought experts-exchange would interpret them as HTML,  sorry.
if I completely delete the page import tag I get the same error.  The problem is caused by those imports not working correctly, so the JSP does not have access to anything in diablopackage, or in the other imports...

Any ideas about how I can get the imports working?
Sorry All.  I have been following tcompletely the wrong line of enquiry here.  You are correct .  Sincere apologies.
Great. Glad it was easy to sort out, and thanks for the points and grade :-)