The ORBlogs Test Site Fix

Recording for posterity:  the ORBlogs test site, running on Tomcat 6.0.18, was throwing this exception on the home page:

org.apache.jasper.JasperException: /WEB-INF/jsp/home.jsp(45,0) Unknown attribute type (java.util.List<net.bigbark.item.Item>) for attribute items.

The thing that was driving me crazy about this was that it ran just fine in a local Jetty container (started with “mvn jetty:run“).   The problem was this line in src/main/webapp/WEB-INF/tags/ui/article-list.tag:

<%@ attribute name="items" required="true" type="java.util.List<net.bigbark.item.Item>" %>

Apparently Jetty’s JSP implementation (which IIRC comes from Glassfish) allows one to use generic types, while the one in Tomcat (Jasper) does not.  Between the J2EE 1.4 tutorial documentation [1][2], the JSP 2.0 syntax reference [3], and the JSR-241 (JSP 2.1) final release specification [4], the only restriction I saw on the type attribute is that it must not reference a primitive type.  Does this mean that Jasper’s inability to handle a parameterized type reference is a bug?  It would appear that some Glassfish developer(s) allowed for this usage, which makes me wonder whether the corresponding Jasper developer(s) intentionally left out such support or simply never considered the possibility.

I changed the type attribute’s value to “java.util.List” (removed the generic type parameter), and the exception disappeared. C’est la vie!

-Bill
P.S. Here is the full stack trace; maybe the search engines will pick up on it and it will help someone else in the future — but probably not. 🙂

Jan 27, 2009 2:23:22 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet default threw exception
org.apache.jasper.JasperException: /WEB-INF/jsp/home.jsp(43,8) Unknown attribute type (java.util.List<net.bigbark.item.Item>) for attribute items.
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:236)
at org.apache.jasper.compiler.Validator$ValidateVisitor.checkXmlAttributes(Validator.java:1164)
at org.apache.jasper.compiler.Validator$ValidateVisitor.visit(Validator.java:821)
at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1512)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2393)
at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2399)
at org.apache.jasper.compiler.Node$Root.accept(Node.java:489)
at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2343)
at org.apache.jasper.compiler.Validator.validate(Validator.java:1739)
at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:166)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:315)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:295)
at org.apache.jasper.compiler.Compiler.compile(Compiler.java:282)
at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:586)
at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:317)
at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
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 com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:119)
at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:55)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:630)
at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:436)
at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:374)
at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:302)
at net.sourceforge.stripes.action.ForwardResolution.execute(ForwardResolution.java:110)
at net.sourceforge.stripes.controller.DispatcherHelper$7.intercept(DispatcherHelper.java:483)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:158)
at net.bigbark.stripes.util.ResourceBundleInterceptor.intercept(ResourceBundleInterceptor.java:21)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.HttpCacheInterceptor.intercept(HttpCacheInterceptor.java:99)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.BeforeAfterMethodInterceptor.intercept(BeforeAfterMethodInterceptor.java:113)
at net.sourceforge.stripes.controller.ExecutionContext.proceed(ExecutionContext.java:155)
at net.sourceforge.stripes.controller.ExecutionContext.wrap(ExecutionContext.java:74)
at net.sourceforge.stripes.controller.DispatcherHelper.executeResolution(DispatcherHelper.java:477)
at net.sourceforge.stripes.controller.DispatcherServlet.executeResolution(DispatcherServlet.java:293)
at net.sourceforge.stripes.controller.DispatcherServlet.doPost(DispatcherServlet.java:177)
at net.sourceforge.stripes.controller.DispatcherServlet.doGet(DispatcherServlet.java:67)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:617)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
at net.sourceforge.stripes.controller.DynamicMappingFilter$2.doFilter(DynamicMappingFilter.java:363)
at net.sourceforge.stripes.controller.StripesFilter.doFilter(StripesFilter.java:246)
at net.sourceforge.stripes.controller.DynamicMappingFilter.doFilter(DynamicMappingFilter.java:350)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.wideplay.warp.hibernate.SessionPerRequestFilter.doFilter(SessionPerRequestFilter.java:53)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
at com.google.inject.servlet.GuiceFilter.doFilter(GuiceFilter.java:46)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
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:128)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:568)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
at org.apache.jk.server.JkCoyoteHandler.invoke(JkCoyoteHandler.java:190)
at org.apache.jk.common.HandlerRequest.invoke(HandlerRequest.java:283)
at org.apache.jk.common.ChannelSocket.invoke(ChannelSocket.java:767)
at org.apache.jk.common.ChannelSocket.processConnection(ChannelSocket.java:697)
at org.apache.jk.common.ChannelSocket$SocketConnection.runIt(ChannelSocket.java:889)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:690)
at java.lang.Thread.run(Thread.java:619)

Advertisements

5 thoughts on “The ORBlogs Test Site Fix

  1. I like that the stack trace text gets filled with happy emoticons. Unfortunate for those who want code-syntax. Looks nice though 🙂

  2. Whoops! Is there a tag to tell WordPress to ignore those non-emoticons? I deliberately used the code tag instead of pre because the latter’s forced non-wrapping was overlapping the sidebar.

  3. Thanks a lot! I had exactly the same problem, working in jetty and failing in tomcat. This is the only result in Google that really addresses the problem.

  4. Great, that’s exactly why I posted this; in hopes of helping others. 🙂

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s