Hi there,
I'm trying to set up a simple beans backed jsp application. I set up everything, the bean compiles, the context for the web app is set. But after reading around on a number of mailing lists and ruling out the most common mistakes (no package, useBean misspelled, no full class name used in useBean class= etc.) and after reading the tomcat class not found page, I'm pretty sure that something beyond my making a mistake is going on...
I greatly appreciate any help, as I am stumped and utterly puzzled at this...
thanks, Ben
Below find: 1. directory structure 2. stack trace 3. primitive-test.jsp 4. PrimitiveBean.jsp 5. web.xml 6. relevant part of /conf/server.xml
I'm running: * Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_03-117.1) * Java HotSpot(TM) Client VM (build 1.4.2-34, mixed mode) * tomcat 5.0.25 * OS X 10.3.4
---
The only "unconventional" thing I'm doing is that my folder structure is as follows (which shouldn't matter because I set the docbase, and tomcat finds my jsps without complaint).
/webapps
/node
/src
/bundle
/java
/www
/WEB-INF
/classes
/my
/packages
/PrimitiveBean.class
/lib
/web.xml
/pages
/primitive-test.jspStack trace from tomcat/logs
----------------------------
2004-06-04 21:34:19 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp threw exceptionorg.apache.jasper.JasperException: /pages/primitive-test.jsp(11,0) The value for the useBean class attribute my.packages.PrimitiveBean is invalid. at org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:39) at org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:376) at org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:150) at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1217) at org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1116) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2213) at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2219) at org.apache.jasper.compiler.Node$Root.accept(Node.java:456) at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2163) at org.apache.jasper.compiler.Generator.generate(Generator.java:3261) at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:244) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:461) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:442) at org.apache.jasper.compiler.Compiler.compile(Compiler.java:430) at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:511) at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:274) 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:810) 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:117) 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.coyote.http11.Http11Processor.process(Http11Processor.java:793) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:702) at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:571) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:644) at java.lang.Thread.run(Thread.java:552)
primitive-test.jsp ------------------ <html xmlns:jsp="http://java.sun.com/JSP/Page" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:fn="http://java.sun.com/jsp/jstl/functions" xmlns:fmt="http://java.sun.com/jsp/jstl/fmt" xmlns="http://www.w3.org/1999/xhtml" >
<jsp:directive.page contentType="text/html"/>
<jsp:useBean id="simple" class="my.packages.PrimitiveBean" scope="session"/>
<!-- just to prove that jsp and EL are generally working -->
<head>
<title>${5/8}</title>
</head>
<body>
<p>
This is just a test.
</p>
</body>
</html>---------------------------------------------------
PrimitiveBean.java ------------------ package my.packages;
public class PrimitiveBean implements java.io.Serializable
{
String content = "PrimitiveBean says hi!"; PrimitiveBean() {
} public String getContent() {
return content;
} public void setContent (String content) {
this.content = content;
}} // end of class
--------------------------------------
my deployment descriptor web.xml ------------------------ <?xml version="1.0" encoding="ISO-8859-1"?>
<web-app xmlns="http://java.sun.com/xml/ns/j2ee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd" version="2.4">
<!-- Used by the JSTL I18N actions -->
<context-param>
<param-name>
javax.servlet.jsp.jstl.fmt.fallbackLocale
</param-name>
<param-value>
en
</param-value>
</context-param> <!-- Used by the JSTL database actions -->
<context-param>
<param-name>
javax.servlet.jsp.jstl.sql.dataSource
</param-name>
<param-value>
jdbc:mysql:///test,org.gjt.mm.mysql.Driver
</param-value>
</context-param> <!-- Servlet for showing JSP source. NOTE! Remove this in production -->
<!--
<servlet>
<servlet-name>jspSource</servlet-name>
<servlet-class>JSPSourceServlet</servlet-class>
</servlet> <servlet-mapping>
<servlet-name>jspSource</servlet-name>
<url-pattern>/jspSource/*</url-pattern>
</servlet-mapping>
-->
</web-app>----------------------------------------
the relevant section of my context registration
tomcat/conf/server.xml
----------------------
<Context debug="0"docBase="/Users/ben/Development/tomcat5/webapps/node/www"path="/node" reloadable="true"/>
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
