1

我们有一个应用程序,它在登录页面上启动,然后导航到加载小程序的第二个页面。一切都很好。当用户注销时,浏览器导航回登录屏幕。如果用户再次登录,则在初始化小程序的某些部分时浏览器会崩溃。这只发生在第二次加载小程序时。缓存已在浏览器中禁用,但浏览器从未完全关闭,所以我是否正确假设第一次登录时加载的小程序仍然存在?

更多信息。小程序加载时会出现 sun java 控制台。当用户注销并返回登录屏幕时,即使登录屏幕不使用 java(仅 html 和 javascript),sun java 控制台仍处于启动状态。我认为当用户注销时某些东西没有被重新初始化,但是小程序被停止并销毁了,所以还有什么可能还在徘徊?
奇怪的是,这只发生在一台测试机器上,而不会发生在其他机器上。

以下是来自 SJC 的错误日志:

java.lang.NullPointerException
    at javax.swing.text.html.parser.Parser.errorContext(Unknown Source)
    at javax.swing.text.html.parser.Parser.parse(Unknown Source)
    at javax.swing.text.html.parser.DocumentParser.parse(Unknown Source)
    at javax.swing.text.html.parser.ParserDelegator.parse(Unknown Source)
    at javax.swing.text.html.HTMLEditorKit.read(Unknown Source)
    at javax.swing.JEditorPane.setText(Unknown Source)
    at ReportPane.setDescription(ReportPane.java:577)
    at ReportPane.doDefineLoad(ReportPane.java:608)
    at ReportPane.<init>(ReportPane.java:565)
    at RevApp2.createGui(RevApp2.java:640)
    at RevApp2.access$0(RevApp2.java:414)
    at RevApp2$1.run(RevApp2.java:393)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
asDescription-><font face="CENTURY SCHOOLBOOK">Use to assign accounts to coders.</font>
java.lang.reflect.InvocationTargetException
    at java.awt.EventQueue.invokeAndWait(Unknown Source)
    at javax.swing.SwingUtilities.invokeAndWait(Unknown Source)
    at RevApp2.init(RevApp2.java:389)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.NullPointerException
    at javax.swing.text.html.parser.Parser.errorContext(Unknown Source)
    at javax.swing.text.html.parser.Parser.parse(Unknown Source)
    at javax.swing.text.html.parser.DocumentParser.parse(Unknown Source)
    at javax.swing.text.html.parser.ParserDelegator.parse(Unknown Source)
    at javax.swing.text.html.HTMLEditorKit.read(Unknown Source)
    at javax.swing.JEditorPane.setText(Unknown Source)
    at AdminPane.setDescription(AdminPane.java:197)
    at AdminPane.<init>(AdminPane.java:174)
    at RevApp2.createGui(RevApp2.java:656)
    at RevApp2.access$0(RevApp2.java:414)
    at RevApp2$1.run(RevApp2.java:393)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
netscape.javascript.JSException: Unspecified error invoking method or accessing property "accountfocus"
    at sun.plugin2.main.client.MessagePassingJSObject.newJSException(Unknown Source)
    at sun.plugin2.main.client.MessagePassingJSObject.waitForReply(Unknown Source)
    at sun.plugin2.main.client.MessagePassingJSObject.call(Unknown Source)
    at RevApp2.start(RevApp2.java:2045)
    at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
Exception: netscape.javascript.JSException: Unspecified error invoking method or accessing property "accountfocus"
4

2 回答 2

1

解决此问题的方法如下:

  editorPane.setEditorKit(new HTMLEditorKit() {
   protected Parser getParser() {
    try {
     Class c = Class
       .forName("javax.swing.text.html.parser.ParserDelegator");
     Parser defaultParser = (Parser) c.newInstance();
     return defaultParser;
    } catch (Throwable e) {
    }
    return null;
   }
  });
于 2010-11-10T10:00:53.150 回答
1

如果你用谷歌搜索“javax.swing.text.html.parser.Parser.errorContext”,你会发现其他人也有类似的问题,并在一些 oracle 讨论板上报告了这些问题:

http://forums.oracle.com/forums/thread.jspa?messageID=8297744&tstart=0

他们谈论了解决方法-也许这也适合您的情况。

来自论坛的 Q:

我不明白是否是右端运行,但是当我这样做时能回避它。

JEdi​​torPane htmlPane = new JEditorPane("text/html", html);

于 2010-11-09T22:18:01.753 回答