tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Davidson <bill...@gmail.com>
Subject Missing something with custom tags.
Date Wed, 02 Feb 2011 22:03:54 GMT
version "1.6.0_20", Java(TM) SE Runtime Environment (build 
1.6.0_20-b02), Java HotSpot(TM) 64-Bit Server VM (build 16.3-b01, mixed 
mode)
Tomcat: 6.0.26

I'm having trouble with a custom tag and I've tried to reduce the 
problem to its most basic form:

/WEB-INF/tags/example.tag:

<%@tag %>
<%@attribute name="xName" required="true" rtexprvalue="true" %>
<h1>xName="${xName}"</h1>

/jsp/Example.jsp:

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" 
"http://www.w3.org/TR/html4/strict.dtd">
<%@page language="java" contentType="text/html; charset=UTF-8" 
pageEncoding="UTF-8" %>
<%@taglib prefix="ex" tagdir="/WEB-INF/tags" %>
<html>
<body>
<ex:example xName="Testing Example" />
</body>
</html>

I usually get:

You have run into a org.apache.jasper.JasperException: 
/jsp/Example.jsp(6,4) Unable to find setter method for attribute: xName 
error.

But sometimes I get this:

You have run into a java.lang.ClassNotFoundException: 
org.apache.jsp.jsp.Example_jsp error.

Any idea what I'm doing wrong?  From what I can see, my code seems to mirror
examples I've found in books and on the web.  Intermittent results 
suggest a race
condition to me though that seems odd here.  I've not had good luck with 
google on
this error.

Full stack traces for the exceptions here:

Feb 2, 2011 1:55:02 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
org.apache.jasper.JasperException: /jsp/Example.jsp(6,4) Unable to find 
setter method for attribute: xName
         at 
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:40)
         at 
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:407)
         at 
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:148)
         at 
org.apache.jasper.compiler.Generator$GenerateVisitor.evaluateAttribute(Generator.java:2809)
         at 
org.apache.jasper.compiler.Generator$GenerateVisitor.generateSetters(Generator.java:3032)
         at 
org.apache.jasper.compiler.Generator$GenerateVisitor.generateCustomDoTag(Generator.java:2452)
         at 
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1736)
         at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
         at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         at 
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
         at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
         at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
         at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
         at 
org.apache.jasper.compiler.Generator.generate(Generator.java:3440)
         at 
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:347)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327)
         at org.apache.jasper.compiler.Compiler.compile(Compiler.java:314)
         at 
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
         at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
         at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
         at 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
         at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
         at 
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
         at 
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
         at 
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
         at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
         at 
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
         at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
         at java.lang.Thread.run(Thread.java:619)

Feb 2, 2011 1:55:29 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: org.apache.jsp.jsp.Example_jsp
         at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
         at java.security.AccessController.doPrivileged(Native Method)
         at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
         at 
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:134)
         at 
org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
         at 
org.apache.jasper.JspCompilationContext.load(JspCompilationContext.java:628)
         at 
org.apache.jasper.servlet.JspServletWrapper.getServlet(JspServletWrapper.java:144)
         at 
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:329)
         at 
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
         at 
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
         at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
         at 
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
         at 
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
         at 
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
         at 
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
         at 
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
         at 
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
         at 
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:555)
         at 
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
         at 
org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
         at 
org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
         at 
org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:291)
         at 
org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:774)
         at 
org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:703)
         at 
org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:896)
         at 
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
         at java.lang.Thread.run(Thread.java:619)


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


Mime
View raw message