gpt4 book ai didi

java - Applet在Eclipse中运行良好;但在 Chrome 中运行会出现 InvocableTargetException

转载 作者:行者123 更新时间:2023-12-01 05:13:02 25 4
gpt4 key购买 nike

我制作了一个 Swing 小程序,它可以在 Eclipse 中运行,没有任何问题,但是当我使用 Chrome 使用 html 文件运行它时,我得到一个运行时异常:java.lang.reflect.InitationTargetException。任何人都可以建议出什么问题吗?这是我尝试过的:

  • 我读到 InvocableTargetException 包含了一些其他错误(导致它的不同错误),但我不知道是哪个方法放置 try{} catch(InitationTargetException e){ e.toString()} 来获取有用的错误。

  • 在线 Material 表明我已经使用 jdb 生成了堆栈跟踪,但是同样,它似乎不包含任何有用的信息来查找异常原因:

堆栈跟踪

TimerQueue:
[1] sun.misc.Unsafe.park (native method)
[2] java.util.concurrent.locks.LockSupport.park (null)
[3] java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awai
t (null)
[4] java.util.concurrent.DelayQueue.take (null)
[5] javax.swing.TimerQueue.run (null)
[6] java.lang.Thread.run (null)
ConsoleTraceListener:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] com.sun.deploy.uitoolkit.ui.ConsoleTraceListener$ConsoleWriterThread.run (
null)
TimerQueue:
[1] sun.misc.Unsafe.park (native method)
[2] java.util.concurrent.locks.LockSupport.park (null)
[3] java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awai
t (null)
[4] java.util.concurrent.DelayQueue.take (null)
[5] javax.swing.TimerQueue.run (null)
[6] java.lang.Thread.run (null)
D3D Screen Updater:
[1] java.lang.Object.wait (native method)
[2] sun.java2d.d3d.D3DScreenUpdateManager.run (null)
[3] java.lang.Thread.run (null)
AWT-EventQueue-1:
[1] sun.misc.Unsafe.park (native method)
[2] java.util.concurrent.locks.LockSupport.park (null)
[3] java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awai
t (null)
[4] java.awt.EventQueue.getNextEvent (null)
[5] java.awt.EventDispatchThread.pumpOneEventForFilters (null)
[6] java.awt.EventDispatchThread.pumpEventsForFilter (null)
[7] java.awt.EventDispatchThread.pumpEventsForHierarchy (null)
[8] java.awt.EventDispatchThread.pumpEvents (null)
[9] java.awt.EventDispatchThread.pumpEvents (null)
[10] java.awt.EventDispatchThread.run (null)
AWT-EventQueue-2:
[1] sun.misc.Unsafe.park (native method)
[2] java.util.concurrent.locks.LockSupport.park (null)
[3] java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awai
t (null)
[4] java.awt.EventQueue.getNextEvent (null)
[5] java.awt.EventDispatchThread.pumpOneEventForFilters (null)
[6] java.awt.EventDispatchThread.pumpEventsForFilter (null)
[7] java.awt.EventDispatchThread.pumpEventsForHierarchy (null)
[8] java.awt.EventDispatchThread.pumpEvents (null)
[9] java.awt.EventDispatchThread.pumpEvents (null)
[10] java.awt.EventDispatchThread.run (null)
Applet 3 LiveConnect Worker Thread:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] sun.plugin2.main.client.LiveConnectSupport$PerAppletInfo$LiveConnectWorker
.run (null)
[4] java.lang.Thread.run (null)
Browser Side Object Cleanup Thread:
[1] java.lang.Object.wait (native method)
[2] java.lang.ref.ReferenceQueue.remove (null)
[3] java.lang.ref.ReferenceQueue.remove (null)
[4] sun.plugin2.main.client.LiveConnectSupport$BrowserSideObjectCleanupThread.
run (null)
CacheCleanUpThread:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] com.sun.deploy.cache.CleanupThread.run (null)
CacheMemoryCleanUpThread:
[1] java.lang.Object.wait (native method)
[2] java.lang.ref.ReferenceQueue.remove (null)
[3] java.lang.ref.ReferenceQueue.remove (null)
[4] com.sun.deploy.cache.MemoryCache$LoadedResourceCleanupThread.run (null)
SysExecutionTheadCreator:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] sun.plugin.util.PluginSysUtil$SysExecutionThreadCreator.run (null)
AWT-EventQueue-0:
[1] sun.misc.Unsafe.park (native method)
[2] java.util.concurrent.locks.LockSupport.park (null)
[3] java.util.concurrent.locks.AbstractQueuedSynchronizer$ConditionObject.awai
t (null)
[4] java.awt.EventQueue.getNextEvent (null)
[5] java.awt.EventDispatchThread.pumpOneEventForFilters (null)
[6] java.awt.EventDispatchThread.pumpEventsForFilter (null)
[7] java.awt.EventDispatchThread.pumpEventsForHierarchy (null)
[8] java.awt.EventDispatchThread.pumpEvents (null)
[9] java.awt.EventDispatchThread.pumpEvents (null)
[10] java.awt.EventDispatchThread.run (null)
AWT-Windows:
[1] sun.awt.windows.WToolkit.eventLoop (native method)
[2] sun.awt.windows.WToolkit.run (null)
AWT-Shutdown:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] sun.awt.AWTAutoShutdown.run (null)
[4] java.lang.Thread.run (null)
Java2D Disposer:
[1] java.lang.Object.wait (native method)
[2] java.lang.ref.ReferenceQueue.remove (null)
[3] java.lang.ref.ReferenceQueue.remove (null)
[4] sun.java2d.Disposer.run (null)
[5] java.lang.Thread.run (null)
Java Plug-In Pipe Worker Thread (Client-Side):
[1] sun.plugin2.os.windows.Windows.ReadFile0 (native method)
[2] sun.plugin2.os.windows.Windows.ReadFile (null)
[3] sun.plugin2.ipc.windows.WindowsNamedPipe.read (null)
[4] sun.plugin2.message.transport.NamedPipeTransport$SerializerImpl.read (null
)
[5] sun.plugin2.message.transport.NamedPipeTransport$SerializerImpl.readByte (
null)
[6] sun.plugin2.message.AbstractSerializer.readInt (null)
[7] sun.plugin2.message.transport.SerializingTransport.read (null)
[8] sun.plugin2.message.Pipe$WorkerThread.run (null)
Timer-0:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] java.util.TimerThread.mainLoop (null)
[4] java.util.TimerThread.run (null)
traceMsgQueueThread:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] com.sun.deploy.trace.Trace$TraceMsgQueueChecker.run (null)
[4] java.lang.Thread.run (null)
Attach Listener:
Signal Dispatcher:
Finalizer:
[1] java.lang.Object.wait (native method)
[2] java.lang.ref.ReferenceQueue.remove (null)
[3] java.lang.ref.ReferenceQueue.remove (null)
[4] java.lang.ref.Finalizer$FinalizerThread.run (null)
Reference Handler:
[1] java.lang.Object.wait (native method)
[2] java.lang.Object.wait (Object.java:503)
[3] java.lang.ref.Reference$ReferenceHandler.run (null)
main:
[1] java.lang.Object.wait (native method)
[2] sun.plugin2.message.Queue.waitForMessage (null)
[3] sun.plugin2.message.Pipe$1.run (null)
[4] com.sun.deploy.util.Waiter$1.wait (null)
[5] com.sun.deploy.util.Waiter.runAndWait (null)
[6] sun.plugin2.message.Pipe.receive (null)
[7] sun.plugin2.main.client.PluginMain.mainLoop (null)
[8] sun.plugin2.main.client.PluginMain.run (null)
[9] sun.plugin2.main.client.PluginMain.main (null)

最佳答案

问题是我在 init() 方法之外初始化变量。 Eclipse 似乎对此没有问题,但使用浏览器 Java 插件运行它会抛出 java.lang.reflection.InterruptedThreadException

关于java - Applet在Eclipse中运行良好;但在 Chrome 中运行会出现 InvocableTargetException,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11785998/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com