Java 无法使用 JDK1.8.0_92 编译 JSP 文件

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/36981733/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-11 18:53:31  来源:igfitidea点击:

Unable to compile JSP file with JDK1.8.0_92

javajspjboss

提问by Kiran Mohan

We have a legacy JavaEE application running on JBoss 6.1. When running JBoss6 with Java 1.8.0_92 we are getting the following error. Please help me resolve or give some hints on this error.

我们有一个在 JBoss 6.1 上运行的遗留 JavaEE 应用程序。当使用 Java 1.8.0_92 运行 JBoss6 时,我们收到以下错误。请帮助我解决此错误或提供一些提示。

16:49:32,888 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/webSSO].[jsp]] Servlet.service() for servlet jsp threw exception: org.apache.jasper.JasperException: Unable to compile class for JSP:

An error occurred at line: 1 in the generated java file
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files

Stacktrace:
        at org.apache.jasper.compiler.DefaultErrorHandler.javacError(DefaultErrorHandler.java:92) [:6.1.0.Final]
        at org.apache.jasper.compiler.ErrorDispatcher.javacError(ErrorDispatcher.java:330) [:6.1.0.Final]
        at org.apache.jasper.compiler.JDTCompiler.generateClass(JDTCompiler.java:446) [:6.1.0.Final]
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:362) [:6.1.0.Final]
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:340) [:6.1.0.Final]
        at org.apache.jasper.compiler.Compiler.compile(Compiler.java:327) [:6.1.0.Final]
        at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:607) [:6.1.0.Final]
        at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:312) [:6.1.0.Final]
        at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:326) [:6.1.0.Final]
        at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:253) [:6.1.0.Final]
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) [:1.0.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:324) [:6.1.0.Final]
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:242) [:6.1.0.Final]

Note: It works fine upto (Java 1.8.0_77)

注意:它工作正常(Java 1.8.0_77)

回答by cihan adil seven

As you can see red hat web sitejdk 1.8 supports only jboss 6.3.3 and above.

如您所见,red hat 网站jdk 1.8 仅支持 jboss 6.3.3 及更高版本。

回答by Andreas Osterburg

It works with the newer compiler if you compile your tomcat from source with it. You just have to download the source, and follow the few building instructions in BUILDING.txt.

如果您使用它从源代码编译您的 tomcat,它可以与较新的编译器一起使用。您只需要下载源代码,然后按照 BUILDING.txt 中的几个构建说明进行操作。

回答by Kaushik Lele

I used latest version of tomcat i.e. Tomcat 9 and it solved the problem.

我使用了最新版本的 tomcat,即 Tomcat 9,它解决了这个问题。