Bug 36767 - Taglibrary utilizing generified collections
Summary: Taglibrary utilizing generified collections
Status: RESOLVED WONTFIX
Alias: None
Product: Tomcat 5
Classification: Unclassified
Component: Jasper (show other bugs)
Version: 5.0.28
Hardware: PC Linux
: P4 minor (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
URL:
Keywords: JDK1.5
Depends on:
Blocks:
 
Reported: 2005-09-22 07:03 UTC by Michael Snoyman
Modified: 2005-12-18 17:59 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Snoyman 2005-09-22 07:03:53 UTC
I implemented two tags, one to display a navigation bar and another to display a
list of news items.  Both tags received their data from a DAO which returned a
Collection of appropriate objects.  When I switched over to using generics the
error below appeared for *both* tags.

I found two different fixes.  If I avoided creating a local variable to hold
either the Collection<NewsItem> or Iterator<NewsItem>, then everything worked
fine.  For example:
for(NewsItem n : newsItemDao.getAll()) { ... }
solved the problem.  The other approach was simply not to use the generic
approach in the tag, even though the DAO was still returning a generified
collection.

Here's one of the stacktraces, the other was the same:

Sep 21, 2005 9:43:57 PM org.apache.jasper.compiler.Compiler generateClass
SEVERE: Error compiling file:
/var/lib/tomcat-5/default/work/Catalina/localhost/javacms//org/apache/jsp/WEB_002dINF/jsp/news_jsp.java
    [javac] Compiling 1 source file
    [javac]
/var/lib/tomcat-5/default/work/Catalina/localhost/javacms/org/apache/jsp/WEB_002dINF/jsp/news_jsp.java:95:29:95:35:
Semantic Error: The class file "NewsTag.class" in
"/var/lib/tomcat-5/default/webapps/javacms/WEB-INF/classes/com/snoyman/jcms/taglib"
has an invalid format (duplicate local variable type table).
    [javac]
/var/lib/tomcat-5/default/work/Catalina/localhost/javacms/org/apache/jsp/WEB_002dINF/jsp/news_jsp.java:95:61:95:91:
Semantic Error: Type "NewsTag" was not found.
    [javac]
/var/lib/tomcat-5/default/work/Catalina/localhost/javacms/org/apache/jsp/WEB_002dINF/jsp/news_jsp.java:95:129:95:159:
Semantic Error: Type "NewsTag" was not found.


Sep 21, 2005 9:43:57 PM org.springframework.web.servlet.FrameworkServlet
serviceWrapper
SEVERE: Could not complete request
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 8 in the jsp file: /WEB-INF/jsp/news.jsp
Generated servlet error:
    [javac]
/var/lib/tomcat-5/default/work/Catalina/localhost/javacms/org/apache/jsp/WEB_002dINF/jsp/news_jsp.java:95:29:95:35:
Semantic Error: The class file "NewsTag.class" in
"/var/lib/tomcat-5/default/webapps/javacms/WEB-INF/classes/com/snoyman/jcms/taglib"
has an invalid format (duplicate local variable type table).


An error occurred at line: 8 in the jsp file: /WEB-INF/jsp/news.jsp
Generated servlet error:
    [javac]
/var/lib/tomcat-5/default/work/Catalina/localhost/javacms/org/apache/jsp/WEB_002dINF/jsp/news_jsp.java:95:61:95:91:
Semantic Error: Type "NewsTag" was not found.


An error occurred at line: 8 in the jsp file: /WEB-INF/jsp/news.jsp
Generated servlet error:
    [javac]
/var/lib/tomcat-5/default/work/Catalina/localhost/javacms/org/apache/jsp/WEB_002dINF/jsp/news_jsp.java:95:129:95:159:
Semantic Error: Type "NewsTag" was not found.




	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:856)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:39)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at
org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:704)
	at
org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:474)
	at
org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:409)
	at
org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:312)
	at
org.springframework.web.servlet.view.InternalResourceView.renderMergedOutputModel(InternalResourceView.java:97)
	at org.springframework.web.servlet.view.AbstractView.render(AbstractView.java:250)
	at
org.springframework.web.servlet.DispatcherServlet.render(DispatcherServlet.java:928)
	at
org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:705)
	at
org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:625)
	at
org.springframework.web.servlet.FrameworkServlet.serviceWrapper(FrameworkServlet.java:386)
	at
org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:346)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
	at
com.opensymphony.module.sitemesh.filter.PageFilter.parsePage(PageFilter.java:118)
	at com.opensymphony.module.sitemesh.filter.PageFilter.doFilter(PageFilter.java:52)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:186)
	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.coyote.http11.Http11Processor.process(Http11Processor.java:799)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
	at java.lang.Thread.run(Thread.java:595)
Comment 1 william.barker 2005-12-19 02:59:06 UTC
Tomcat 5.5 has support for JDK 1.5 features already.

As a work-around, you can try removing the JTD jar from common/lib and use the 
Ant compiler.