tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 22426] New: - cannot resolve getContextPath on ServletRequest
Date Thu, 14 Aug 2003 15:15:58 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22426>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=22426

cannot resolve getContextPath on ServletRequest

           Summary: cannot resolve getContextPath on ServletRequest
           Product: Tomcat 5
           Version: 5.0.7
          Platform: PC
        OS/Version: Windows XP
            Status: NEW
          Severity: Minor
          Priority: Other
         Component: Jasper2
        AssignedTo: tomcat-dev@jakarta.apache.org
        ReportedBy: dougvanhorn@yahoo.com


Summary:  Using <%= request.getContextPath() %> in one of the new, schmancy .tag
files results in the following error:



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

An error occurred at line: 2 in the jsp file: /WEB-INF/tags/basePath.tag

Generated servlet error:
    [javac] Compiling 1 source file

C:\usr\software\jakarta-tomcat-5.0.7\work\Catalina\localhost\Tomcat5\org\apache\jsp\tag\web\basePath_tag.java:51:
cannot resolve symbol
symbol  : method getContextPath ()
location: interface javax.servlet.ServletRequest
      out.write(String.valueOf( request.getContextPath() ));
                                       ^
1 error



This expression works fine in a regular .jsp file, though.  I can work around
the problem with the following:

<%= ((javax.servlet.http.HttpServletRequest)request).getContextPath() %>

This seems to be because the underlying object is
org.apache.coyote.tomcat5.CoyoteRequestFacade which implements the
HttpServletRequest interface.

Anyway, hopefully this isn't some obscure configuration or usage error on my part.

Hope this helps.


doug.


FULL STACK TRACE:

2003-08-14 09:50:26 StandardWrapperValve[jsp]: Servlet.service() for servlet jsp
threw exception
org.apache.jasper.JasperException: Unable to compile class for JSP

An error occurred at line: 2 in the jsp file: /WEB-INF/tags/basePath.tag

Generated servlet error:
    [javac] Compiling 1 source file

C:\usr\software\jakarta-tomcat-5.0.7\work\Catalina\localhost\Tomcat5\org\apache\jsp\tag\web\basePath_tag.java:51:
cannot resolve symbol
symbol  : method getContextPath ()
location: interface javax.servlet.ServletRequest
      out.write(String.valueOf( request.getContextPath() ));
                                       ^
1 error


	at
org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:128)
	at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:307)
	at org.apache.jasper.compiler.Compiler.generateClass(Compiler.java:415)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:455)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
	at
org.apache.jasper.servlet.JspServletWrapper.loadTagFile(JspServletWrapper.java:218)
	at
org.apache.jasper.compiler.TagFileProcessor.loadTagFile(TagFileProcessor.java:506)
	at org.apache.jasper.compiler.TagFileProcessor.access$000(TagFileProcessor.java:85)
	at
org.apache.jasper.compiler.TagFileProcessor$TagFileLoaderVisitor.visit(TagFileProcessor.java:552)
	at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1444)
	at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2142)
	at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2184)
	at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2190)
	at org.apache.jasper.compiler.Node$Root.accept(Node.java:471)
	at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2142)
	at
org.apache.jasper.compiler.TagFileProcessor.loadTagFiles(TagFileProcessor.java:570)
	at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:271)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:453)
	at org.apache.jasper.compiler.Compiler.compile(Compiler.java:439)
	at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:555)
	at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:300)
	at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:293)
	at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:240)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:286)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:254)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:256)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:210)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:190)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:175)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:149)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:156)
	at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:151)
	at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:564)
	at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:974)
	at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:207)
	at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:647)
	at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:489)
	at org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:575)
	at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:649)
	at java.lang.Thread.run(Thread.java:534)

Mime
View raw message