I have downloaded Eclipse and tried to create a sample servlet program but I got following error
我已经下载了Eclipse并试图创建一个示例servlet程序,但是我遇到了以下错误
The type java.io.ObjectInputStream cannot be resolved. It is indirectly referenced from required .class files
无法解析java.io.ObjectInputStream类型。它是从所需的.class文件间接引用的
I have configured build path correctly. I am using Java 8 and Apache Tomcat 7 and libraries for both are referenced correctly.
我已正确配置构建路径。我正在使用Java 8和Apache Tomcat 7,并且正确引用了两者的库。
Problem is specifically for Java EE only. Ordinarily Java SE projects are running fine.
问题仅适用于Java EE。通常Java SE项目运行正常。
9 个解决方案
#1
31
Something happened in Java 8 Update 91 that broke existing JSP code. That seems pretty clear. Here is a sample of similar questions and bug reports:
Java 8 Update 91中发生了破坏现有JSP代码的事情。这似乎很清楚。以下是类似问题和错误报告的示例:
- Unable to compile JSP file with JDK1.8.0_92
- Spring MVC - Unable to compile class for JSP
- Unable to access CloudPlatform Client
- https://bugs.openjdk.java.net/browse/JDK-8155588 (closed as "not an issue")
- https://bugs.openjdk.java.net/browse/JDK-8155223 (closed as "not an issue")
- https://access.redhat.com/solutions/2294701
- https://alluxio.atlassian.net/browse/ALLUXIO-1956
- https://jira.atlassian.com/browse/CWD-4729
- https://community.exoplatform.com/portal/intranet/forum/topic/topic991e097d9e45345236bb2bd1920a4c68
- https://issues.apache.org/jira/browse/OOZIE-2533 (from a comment: "This is really looking like a JDK bug")
-
https://bugzilla.redhat.com/show_bug.cgi?id=1337940 (comment 2 mentions the change to
java.io.ObjectInputStream
in Update 91 that "made it incompatible with RHEL6's current ECJ version") - https://github.com/mit-cml/appinventor-sources/issues/814
- https://community.oracle.com/thread/3953395
无法使用JDK1.8.0_92编译JSP文件
Spring MVC - 无法为JSP编译类
无法访问CloudPlatform客户端
https://bugs.openjdk.java.net/browse/JDK-8155588(关闭为“不是问题”)
https://bugs.openjdk.java.net/browse/JDK-8155223(关闭为“不是问题”)
https://issues.apache.org/jira/browse/OOZIE-2533(来自评论:“这实际上看起来像一个JDK错误”)
https://bugzilla.redhat.com/show_bug.cgi?id=1337940(评论2提到更新91中对java.io.ObjectInputStream的更改“使其与RHEL6当前的ECJ版本不兼容”)
All these are about problems with Java 8 Update 91 (or later) that are not present when using earlier JRE/JDK versions.
所有这些都是关于使用早期JRE / JDK版本时不存在的Java 8 Update 91(或更高版本)的问题。
The following OpenJDK changeset from 22 January 2016 appears to be related: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/32f64c19b5fb (commit message "8144430: Improve JMX connections"). The changeset seems to be related to this vulnerability, https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-3427, which is mentioned in a comment to this Red Hat bug report, https://bugzilla.redhat.com/show_bug.cgi?id=1336481.
从2016年1月22日开始的以下OpenJDK变更集似乎是相关的:http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/32f64c19b5fb(提交消息“8144430:改进JMX连接”)。变更集似乎与此漏洞有关,https://cve.mitre.org/cgi-bin/cvename.cgi?name = CVE-2016-3427,在此Red Hat错误报告的评论中提及,https :?//bugzilla.redhat.com/show_bug.cgi ID = 1336481。
The Update 91 release notes document mentions JDK-8144430 (non-public ticket): http://www.oracle.com/technetwork/java/javase/8u91-relnotes-2949462.html.
更新91发布说明文档提到了JDK-8144430(非公开票证):http://www.oracle.com/technetwork/java/javase/8u91-relnotes-2949462.html。
In "Oracle Critical Patch Update Advisory - April 2016", the CVE-2016-3427 vulnerability is mentioned: http://www.oracle.com/technetwork/security-advisory/cpuapr2016v3-2985753.html.
在“Oracle重要补丁更新公告 - 2016年4月”中,提到了CVE-2016-3427漏洞:http://www.oracle.com/technetwork/security-advisory/cpuapr2016v3-2985753.html。
#2
#3
1
Using the latest 7.x Tomcat (currently 7.0.69) solved the problem for me.
使用最新的7.x Tomcat(目前为7.0.69)解决了我的问题。
We did also try a workaround in a old eclipse bug, maybe that did it's part to solve the problem, too?
我们也尝试了一个旧的日食错误的解决方法,也许这也解决了这个问题?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=67414
Workaround:
- Window->Preferences->Java->Installed JREs
- Uncheck selected JRE
- Click OK (this step may be optional?)
- Check JRE again
取消选中选定的JRE
单击确定(此步骤可以是可选的?)
再次检查JRE
#4
1
Workaround:
Window -> Preferences -> Java -> Installed JREs, select a different JRE
窗口 - >首选项 - > Java - >已安装的JRE,选择不同的JRE
maybe this JDK edition is not suitable:
也许这个JDK版不适合:
So try this one instead:
所以试试这个:
Problem solved!
#5
0
same problem with me. This is not a solution but a workaround, which worked for me: Buildpath->Configure buildpath->Libraries-> Here remove the JRE system library pointing to JRE8 and add JRE system library for JRE7.
和我一样的问题。这不是解决方案,而是一种解决方法,对我有用:Buildpath-> Configure buildpath-> Libraries->这里删除指向JRE8的JRE系统库并为JRE7添加JRE系统库。
#6
0
Upgrading to tomcat 7.0.70 resolved the issue for me
升级到tomcat 7.0.70为我解决了这个问题
#7
0
I was also facing same issue. I had Jdk1.7.0.79. Then I updated it with Jdk8.0.120. Then the problem solved. After successful completion of upgraded jdk. Go to project->clean. It will rebuild the project and all red alert will be eliminated.
我也面临同样的问题。我有Jdk1.7.0.79。然后我用Jdk8.0.120更新了它。然后问题解决了。成功完成升级后的jdk。转到项目 - >清理。它将重建项目,并将消除所有红色警报。
#8
0
Okay, this question was a year ago but I recently got this problem as well.
好的,这个问题是一年前的,但我最近也遇到了这个问题。
So what I did :
所以我做了什么:
- Update tomcat 7 to tomcat 8.
- Update to the latest java (java 1.8.0_141).
- Update the JRE System Library in Project > Properties > Java Build Path. Make sure it has the latest version which in my case is jre1.8.0_141 (before it was the previous version jre1.8.0_111)
将tomcat 7更新为tomcat 8。
更新到最新的java(java 1.8.0_141)。
在Project> Properties> Java Build Path中更新JRE系统库。确保它有最新版本,在我的情况下是jre1.8.0_141(在之前的版本jre1.8.0_111之前)
When I did the first two steps it still doesn't remove the error so the last step is important. It didn't automatically change the build path for jre.
当我执行前两个步骤时,它仍然不会删除错误,因此最后一步很重要。它没有自动更改jre的构建路径。
#9
0
I am using Google appengine java sdk and was facing similar issue. I had to add
我正在使用谷歌appengine java sdk,并面临类似的问题。我不得不补充一下
<runtime>java8</runtime>
in appengine-web.xml file to make it work.
在appengine-web.xml文件中使其工作。
#1
31
Something happened in Java 8 Update 91 that broke existing JSP code. That seems pretty clear. Here is a sample of similar questions and bug reports:
Java 8 Update 91中发生了破坏现有JSP代码的事情。这似乎很清楚。以下是类似问题和错误报告的示例:
- Unable to compile JSP file with JDK1.8.0_92
- Spring MVC - Unable to compile class for JSP
- Unable to access CloudPlatform Client
- https://bugs.openjdk.java.net/browse/JDK-8155588 (closed as "not an issue")
- https://bugs.openjdk.java.net/browse/JDK-8155223 (closed as "not an issue")
- https://access.redhat.com/solutions/2294701
- https://alluxio.atlassian.net/browse/ALLUXIO-1956
- https://jira.atlassian.com/browse/CWD-4729
- https://community.exoplatform.com/portal/intranet/forum/topic/topic991e097d9e45345236bb2bd1920a4c68
- https://issues.apache.org/jira/browse/OOZIE-2533 (from a comment: "This is really looking like a JDK bug")
-
https://bugzilla.redhat.com/show_bug.cgi?id=1337940 (comment 2 mentions the change to
java.io.ObjectInputStream
in Update 91 that "made it incompatible with RHEL6's current ECJ version") - https://github.com/mit-cml/appinventor-sources/issues/814
- https://community.oracle.com/thread/3953395
无法使用JDK1.8.0_92编译JSP文件
Spring MVC - 无法为JSP编译类
无法访问CloudPlatform客户端
https://bugs.openjdk.java.net/browse/JDK-8155588(关闭为“不是问题”)
https://bugs.openjdk.java.net/browse/JDK-8155223(关闭为“不是问题”)
https://issues.apache.org/jira/browse/OOZIE-2533(来自评论:“这实际上看起来像一个JDK错误”)
https://bugzilla.redhat.com/show_bug.cgi?id=1337940(评论2提到更新91中对java.io.ObjectInputStream的更改“使其与RHEL6当前的ECJ版本不兼容”)
All these are about problems with Java 8 Update 91 (or later) that are not present when using earlier JRE/JDK versions.
所有这些都是关于使用早期JRE / JDK版本时不存在的Java 8 Update 91(或更高版本)的问题。
The following OpenJDK changeset from 22 January 2016 appears to be related: http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/32f64c19b5fb (commit message "8144430: Improve JMX connections"). The changeset seems to be related to this vulnerability, https://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2016-3427, which is mentioned in a comment to this Red Hat bug report, https://bugzilla.redhat.com/show_bug.cgi?id=1336481.
从2016年1月22日开始的以下OpenJDK变更集似乎是相关的:http://hg.openjdk.java.net/jdk8u/jdk8u/jdk/rev/32f64c19b5fb(提交消息“8144430:改进JMX连接”)。变更集似乎与此漏洞有关,https://cve.mitre.org/cgi-bin/cvename.cgi?name = CVE-2016-3427,在此Red Hat错误报告的评论中提及,https :?//bugzilla.redhat.com/show_bug.cgi ID = 1336481。
The Update 91 release notes document mentions JDK-8144430 (non-public ticket): http://www.oracle.com/technetwork/java/javase/8u91-relnotes-2949462.html.
更新91发布说明文档提到了JDK-8144430(非公开票证):http://www.oracle.com/technetwork/java/javase/8u91-relnotes-2949462.html。
In "Oracle Critical Patch Update Advisory - April 2016", the CVE-2016-3427 vulnerability is mentioned: http://www.oracle.com/technetwork/security-advisory/cpuapr2016v3-2985753.html.
在“Oracle重要补丁更新公告 - 2016年4月”中,提到了CVE-2016-3427漏洞:http://www.oracle.com/technetwork/security-advisory/cpuapr2016v3-2985753.html。
#2
3
You simply need to upgrade your Tomcat version, to Tomcat 8.0.xx. Java8 <-> Tomcat8
您只需将Tomcat版本升级到Tomcat 8.0.xx. Java8 < - > Tomcat8
This is the configuration that I have been using and it has always worked out well
这是我一直在使用的配置,它一直很好用
#3
1
Using the latest 7.x Tomcat (currently 7.0.69) solved the problem for me.
使用最新的7.x Tomcat(目前为7.0.69)解决了我的问题。
We did also try a workaround in a old eclipse bug, maybe that did it's part to solve the problem, too?
我们也尝试了一个旧的日食错误的解决方法,也许这也解决了这个问题?
https://bugs.eclipse.org/bugs/show_bug.cgi?id=67414
Workaround:
- Window->Preferences->Java->Installed JREs
- Uncheck selected JRE
- Click OK (this step may be optional?)
- Check JRE again
取消选中选定的JRE
单击确定(此步骤可以是可选的?)
再次检查JRE
#4
1
Workaround:
Window -> Preferences -> Java -> Installed JREs, select a different JRE
窗口 - >首选项 - > Java - >已安装的JRE,选择不同的JRE
maybe this JDK edition is not suitable:
也许这个JDK版不适合:
So try this one instead:
所以试试这个:
Problem solved!
#5
0
same problem with me. This is not a solution but a workaround, which worked for me: Buildpath->Configure buildpath->Libraries-> Here remove the JRE system library pointing to JRE8 and add JRE system library for JRE7.
和我一样的问题。这不是解决方案,而是一种解决方法,对我有用:Buildpath-> Configure buildpath-> Libraries->这里删除指向JRE8的JRE系统库并为JRE7添加JRE系统库。
#6
0
Upgrading to tomcat 7.0.70 resolved the issue for me
升级到tomcat 7.0.70为我解决了这个问题
#7
0
I was also facing same issue. I had Jdk1.7.0.79. Then I updated it with Jdk8.0.120. Then the problem solved. After successful completion of upgraded jdk. Go to project->clean. It will rebuild the project and all red alert will be eliminated.
我也面临同样的问题。我有Jdk1.7.0.79。然后我用Jdk8.0.120更新了它。然后问题解决了。成功完成升级后的jdk。转到项目 - >清理。它将重建项目,并将消除所有红色警报。
#8
0
Okay, this question was a year ago but I recently got this problem as well.
好的,这个问题是一年前的,但我最近也遇到了这个问题。
So what I did :
所以我做了什么:
- Update tomcat 7 to tomcat 8.
- Update to the latest java (java 1.8.0_141).
- Update the JRE System Library in Project > Properties > Java Build Path. Make sure it has the latest version which in my case is jre1.8.0_141 (before it was the previous version jre1.8.0_111)
将tomcat 7更新为tomcat 8。
更新到最新的java(java 1.8.0_141)。
在Project> Properties> Java Build Path中更新JRE系统库。确保它有最新版本,在我的情况下是jre1.8.0_141(在之前的版本jre1.8.0_111之前)
When I did the first two steps it still doesn't remove the error so the last step is important. It didn't automatically change the build path for jre.
当我执行前两个步骤时,它仍然不会删除错误,因此最后一步很重要。它没有自动更改jre的构建路径。
#9
0
I am using Google appengine java sdk and was facing similar issue. I had to add
我正在使用谷歌appengine java sdk,并面临类似的问题。我不得不补充一下
<runtime>java8</runtime>
in appengine-web.xml file to make it work.
在appengine-web.xml文件中使其工作。