Eclipse times out when trying to show Javadoc for classes in rt.jar

放肆的年华 提交于 2019-12-22 14:03:25

问题


Just recently, my Eclipse installation has stopped reliably displaying Javadoc information for any of the classes in rt.jar. Neither the hover-over documentation, nor the content assist are able to display Javadoc for any non-local types. The issue is sporadic, with the Javadocs sometimes working perfectly for several hours at a time.

Looking in the workspace log, I see messages such as the following:

!ENTRY org.eclipse.jdt.ui 4 10001 2012-08-13 10:03:58.050
!MESSAGE Internal Error
!STACK 1
Java Model Exception: Java Model Status [Timed out while retrieving the attached javadoc for String {key=Ljava/lang/String;} [in String.class [in java.lang [in C:\Program Files\Java\jre6\lib\rt.jar]]] ]
  at org.eclipse.jdt.internal.core.JavaElement.getURLContents(JavaElement.java:808)
  at org.eclipse.jdt.internal.core.BinaryType.getJavadocContents(BinaryType.java:1037)
  at org.eclipse.jdt.internal.core.BinaryType.getAttachedJavadoc(BinaryType.java:995)
  at org.eclipse.jdt.internal.ui.text.javadoc.JavadocContentAccess2.getHTMLContent(JavadocContentAccess2.java:463)
  at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo(JavadocHover.java:619)
  at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.internalGetHoverInfo(JavadocHover.java:565)
  at org.eclipse.jdt.internal.ui.text.java.hover.JavadocHover.getHoverInfo2(JavadocHover.java:557)
  at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:163)
  at org.eclipse.jdt.internal.ui.text.java.hover.BestMatchHover.getHoverInfo2(BestMatchHover.java:129)
  at org.eclipse.jdt.internal.ui.text.java.hover.JavaEditorTextHoverProxy.getHoverInfo2(JavaEditorTextHoverProxy.java:85)
  at org.eclipse.jface.text.TextViewerHoverManager$4.run(TextViewerHoverManager.java:166)
!SUBENTRY 1 org.eclipse.jdt.core 4 1012 2012-08-13 10:03:58.050
!MESSAGE Timed out while retrieving the attached javadoc for String {key=Ljava/lang/String;} [in String.class [in java.lang [in C:\Program Files\Java\jre6\lib\rt.jar]]]

I initially wondered if McAfee on-access scan was getting in the way - it has a terrible habit of grinding to a halt when encountering JARs - but I was reassured to see my settings were still in place to ignore all JAR files (plus, as an added bonus, the contents of C:\Program...\Java).

Has anyone encountered this problem before? Is there a way to increase the timeout value being applied here?

Things I have tried:

  • Increasing the value stored at Preferences > Java > Edit > Content Assist > Advanced > Timeout for fetching a parameter name from attached Javadoc (ms), but it had no apparent effect on my issue. Not surprising, as it never claims to affect the hover-based timeout.
  • Creating a fresh workspace, no effect.
  • Double-checking McAfee settings - JARs apparently not scanned.
  • Watching the McAfee on access scan logs which didn't appear to show it was chewing over rt.jar.
  • Shouting slowly and loudly at the monitor.

None has worked.


回答1:


The issue was triggered because my Eclipse installation was configured to use my local JRE, rather than my JDK. As the JRE does not contain the Java sources (nor attached Javadocs), Eclipse was forced to retrieve this information from the web. Presumably some network lag was causing problems on occasions.

I resolved this by adding a reference to my local JDK in Preferences > Java > Installed JREs and removing the reference to the old JRE.




回答2:


I had the same problem with Eclipse 3.7.1 and solved it by going to

Window -> Preferences -> Java -> Installed JREs -> Execution Environment -> JavaSE-1.7

and then I selected the jdk option instead of jre7



来源:https://stackoverflow.com/questions/11934538/eclipse-times-out-when-trying-to-show-javadoc-for-classes-in-rt-jar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!