tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albretch Mueller" <lbrt...@gmail.com>
Subject HTTP Status 500 while trying to use a DTO to send data from a Servlet to a JSP
Date Thu, 03 Jan 2008 20:45:37 GMT
~
 I am using TC 4.1.36 and I have a simple Data Transfer Object that I
create in a front controller servlet and use to build a JSP view
~
 This is where I have both the servlet and the DTO
~
 . . .\webapps08\serv2jspTest\WEB-INF\classes>dir *.* /B
~
UpFlInfoK.class
UpFlInfoK.java
UploadServlet10.class
UploadServlet10.java
~
 and this is where I have the jsp pages
~
 . . .\webapps08\serv2jspTest>dir *.* /B
serv2jspTest.jsp
~
 and this is my jsp page
~
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<%@ page import="java.util.*" %>
<%@ page import="java.text.*" %>

<jsp:useBean id="UpFlInf" class="UpFlInfoK" />

// __ global data set in jspInit() which runs once
<%!
 private final String aDtFrmt = "yyyy-MM-dd_HHmmss"; // @! it should
be read in as input parameter
 private SimpleDateFormat SDtF = null;
 public void jspInit(){ SDtF =  new SimpleDateFormat(aDtFrmt); }
%>

// __ request scoped data runs every time jsp is accessed
<%
 UpFlInfoK UpFlInf = request.getAttribute("UpFlInf");
 String aLModDt = SDtF.format(new Date(UpFlInf.lL2LModDt));
// __
 String aPg = "<p>There already exist a file on the server, uploaded ";
 aPg += aLModDt;
 aPg += "by user id: ";
 aPg += UpFlInf.aUsrID;
 aPg += " that is exactly the same as the one you tried to
upload.</p><p>Information about current file on server:<u><li> File
Length: ";
 aPg += UpFlInf.lFlL2;
 aPg += " (bytes)</li><li> MD5Sum: ";
 aPg += UpFlInf.aFlMD5Sum;
 aPg += "</li></u></p><p>Do you want to <a
href=javascript.back(-1)>try again</a>?</p>";
%>

<html>
 <head>
  <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
  <title>Same File</title>
 </head>
 <body>
  <%=aPg%>
 </body>
</html>
~
 then I am going:
~
 request.setAttribute("UpFlInf", UpFlInf);
 request.getRequestDispatcher(aDispatchPg).forward(request, response);
~
 but I can't make the jsp page import the class, even though I thought
you should keep all classes in /WEB-INF/classes
~
 Where do you put classes so that servlets and JSPs can import and use them?
~
 This is the error I am getting:
~
HTTP Status 500 -

type Exception report

message

description The server encountered an internal error () that prevented
it from fulfilling this request.

exception

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

An error occurred at line: 6 in the jsp file: /same_file.jsp

Generated servlet error:
Project base dir set to: C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36
Detected Java version: 1.6 in: C:\WApps\java\jdk1.6.0_02\jre
Detected OS: Windows XP
[antlib:org.apache.tools.ant] Could not load definitions from resource
org/apache/tools/ant/antlib.xml. It could not be found.
    [javac] same_file_jsp.java added as same_file_jsp.class is outdated.
    [javac] Compiling 1 source file
    [javac] Using modern compiler
dropping C:\cmllpz\prjx\java\GWB\tc\bin\bootstrap.jar from path as it
doesn't exist
    [javac] Compilation arguments:
    [javac] '-classpath'
    [javac] 'C:\WApps\java\jdk1.6.0_02\lib\tools.jar;C:\cmllpz\prjx\java\GWB\webappsDir_tc-4.1.36\webapps08\fileupload\WEB-INF\classes;C:\cmllpz\prjx\java\GWB\webappsDir_tc-4.1.36\webapps08\fileupload\WEB-INF\lib\commons-fileupload-1.2.jar;C:\cmllpz\prjx\java\GWB\webappsDir_tc-4.1.36\webapps08\fileupload\WEB-INF\lib\commons-io-1.3.2.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\shared\classes;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\classes;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\endorsed\xercesImpl.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\endorsed\xml-apis.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\activation.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\ant-launcher.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\ant.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\commons-collections-3.2.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\commons-dbcp-1.2.1.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\commons-logging-api-1.1.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\commons-pool-1.3.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\jasper-compiler.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\jasper-runtime.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\jdbc2_0-stdext.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\jndi.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\jta.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\mail.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\naming-common.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\naming-factory.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\naming-resources.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\postgresql-8.2-506.jdbc4.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\common\lib\servlet.jar;C:\cmllpz\prjx\java\GWB\tc\tc-4.1.36\bin\bootstrap.jar'
    [javac] '-sourcepath'
    [javac] 'C:\cmllpz\prjx\java\GWB\work'
    [javac] '-encoding'
    [javac] 'UTF8'
    [javac] '-g'
    [javac]
    [javac] The ' characters around the executable and arguments are
    [javac] not part of the command.
    [javac] File to be compiled:
    [javac]     C:\cmllpz\prjx\java\GWB\work\same_file_jsp.java

C:\cmllpz\prjx\java\GWB\work\same_file_jsp.java:49: cannot find symbol
symbol  : class UpFlInfoK
location: class org.apache.jsp.same_file_jsp
                        UpFlInfoK UpFlInf = null;
                        ^



An error occurred at line: 6 in the jsp file: /same_file.jsp

Generated servlet error:
C:\cmllpz\prjx\java\GWB\work\same_file_jsp.java:51: cannot find symbol
symbol  : class UpFlInfoK
location: class org.apache.jsp.same_file_jsp
        UpFlInf = (UpFlInfoK) pageContext.getAttribute("UpFlInf",
PageContext.PAGE_SCOPE);
                   ^



An error occurred at line: 6 in the jsp file: /same_file.jsp

Generated servlet error:
C:\cmllpz\prjx\java\GWB\work\same_file_jsp.java:54: cannot find symbol
symbol  : class UpFlInfoK
location: class org.apache.jsp.same_file_jsp
            UpFlInf = (UpFlInfoK)
java.beans.Beans.instantiate(this.getClass().getClassLoader(),
"UpFlInfoK");
                       ^



An error occurred at line: 16 in the jsp file: /same_file.jsp

Generated servlet error:
C:\cmllpz\prjx\java\GWB\work\same_file_jsp.java:66: cannot find symbol
symbol  : class UpFlInfoK
location: class org.apache.jsp.same_file_jsp
 UpFlInfoK UpFlInf = request.getAttribute("UpFlInf");
 ^
4 errors


	at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:85)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:248)
	at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:343)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:356)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:427)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:142)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:240)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:187)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
	at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:628)
	at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:383)
	at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:307)
	at UploadServlet10.doPost(UploadServlet10.java:197)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:199)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:145)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:210)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:139)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
	at org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2460)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:133)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.java:119)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:117)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:594)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:127)
	at org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.invokeNext(StandardPipeline.java:596)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:433)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:955)
	at org.apache.coyote.tomcat4.CoyoteAdapter.service(CoyoteAdapter.java:157)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:874)
	at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:665)
	at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:528)
	at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:81)
	at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:685)
	at java.lang.Thread.run(Thread.java:619)

---------------------------------------------------------------------
To start a new topic, e-mail: users@tomcat.apache.org
To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
For additional commands, e-mail: users-help@tomcat.apache.org


Mime
View raw message