我们有一个应用程序,它从登录页面开始,然后导航到加载小程序的第二个页面。一切都很好。当用户注销时,浏览器将导航回登录屏幕。如果用户再次登录,则初始化applet的某些部分时浏览器会崩溃。这只发生在第二次加载applet时。浏览器中已禁用缓存,但浏览器永远不会完全关闭,所以我认为第一次登录时加载的applet仍然存在吗?
更多信息。 applet加载时会出现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"
答案 0 :(得分:1)
如果你谷歌“javax.swing.text.html.parser.Parser.errorContext”你会发现其他人有类似的问题并在一些oracle讨论板上报告过:
http://forums.oracle.com/forums/thread.jspa?messageID=8297744&tstart=0
他们谈论了一个解决方法 - 也许这也适合你的情况。
来自论坛的Qute:
我不明白是不是 正确的运行,但能够逃避 当我这样做的时候。
JEditorPane htmlPane = new JEditorPane(“text / html”,html);
答案 1 :(得分: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;
}
});