On Thu, Nov 17, 2022 at 10:52 AM Mark Thomas <ma...@apache.org> wrote:
>
> On 17/11/2022 08:23, Han Li wrote:
> >
> >
> >> 2022年11月17日 16:08,Mark Thomas <ma...@apache.org> 写道:
> >>
> >> On 17/11/2022 04:04, Han Li wrote:
> >>> I think that I encounter a problem, shown below:
> >>> org.apache.jasper.JasperException: Unable to compile class for JSP:
> >>> An error occurred at line: [17] in the jsp file: [/jsp/include/foo.jsp]
> >>> System cannot be resolved
> >>> 14: See the License for the specific language governing permissions and
> >>> 15: limitations under the License.
> >>> 16:
> >>> 17: --%><%= System.currentTimeMillis() %>
> >>> Stacktrace:
> >>>     
> >>> org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:102)
> >>>     
> >>> org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:213)
> >>>     
> >>> org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:589)
> >>>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:380)
> >>>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:350)
> >>>     org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
> >>>     
> >>> org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:597)
> >>>     
> >>> org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
> >>>     
> >>> org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:383)
> >>>     org.apache.jasper.servlet.JspServlet.service(JspServlet.java:331)
> >>>     javax.servlet.http.HttpServlet.service(HttpServlet.java:765)
> >>>     org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
> >>>     
> >>> org.apache.catalina.filters.HttpHeaderSecurityFilter.doFilter(HttpHeaderSecurityFilter.java:126)
> >>>     
> >>> org.apache.catalina.filters.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:109)
> >>> Ant test show passes, but there are problems. (I downloaded 8.5.83 from 
> >>> the official website, then accessed example webapp
> >>> and also have this problem). I don’t know JDT, but I tested again by 
> >>> upgrading ecj version to 4.25 and this
> >>> problem was solved.
> >>
> >> I can't repeat this.
> >>
> >> I downloaded the 8.5.84 RC and then tested with Oracle JDK 1.7.0_80. The 
> >> JSP include example worked.
> >>
> >> I then cleared out the work directory, switched to Temurin JDK 11.0.17_08 
> >> and tested the JSP include example. That worked too.
> >>
> >> I made no changes to the Eclipse compiler JAR.
> >>
> >> Can you provide the exact steps to recreate the issue from a clean 8.5.84 
> >> download?
> >
> > There are no exact steps, just need to simply access this url:
> > http://localhost:8080/examples/jsp/include/foo.jsp
>
> The Java version was the key.
>
> Eclispe JDT 4.6.3 can't compile JSPs under Java 17 as it can't read the
> Java 17 class files.
>
> We can't update JDT as that is the latest version that works with Java 7
> and Tomcat 8.x has a (specification mandated) minimum Java version of 7.
>
> Updating the JDT locally, as you found, is the way to work around this
> problem.

Maybe we should add some conditional classloader construction hacks to
better support this ? The problem will likely become more and more
visible in the future (Tomcat 9 could be hit when/if JDT drops support
for Java 8). Bootstrap.createClassLoader would be a spot to do it.

Possible use cases:
- Add a different JDT if on Java 7 for Tomcat 8.5, use the more up to
date if on another one
- Add Panama Java 17 JAR if on Java 17
- Add Panama Java 20 JAR if on Java 20

Rémy

> Mark
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
> For additional commands, e-mail: dev-h...@tomcat.apache.org
>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@tomcat.apache.org
For additional commands, e-mail: dev-h...@tomcat.apache.org

Reply via email to