Lwjgl applet loader crash,RuntimeExceptoin:java.lang.Reflect.InvocationException

时间:2013-10-18 09:08:25

标签: java swing applet lwjgl slick

我正在尝试运行我的LWJGL applet并且我得到这些错误,不知道这意味着什么。

这是我的文件层次结构的屏幕截图。

File hierarchy

这是我的html文件的内容。

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
  <head>
    <title>AppletLoader</title>
  </head>
  <body>

  <applet code="org.lwjgl.util.applet.AppletLoader" archive="lwjgl_util_applet.jar, lzma.jar" codebase="." width="347" height="355">

    <!-- The following tags are mandatory -->

    <!-- Name of Applet, will be used as name of directory it is saved in, and will uniquely identify it in cache -->
    <param name="al_title" value="Sudoku">

    <!-- Main Applet Class -->
    <param name="al_main" value="sud.main.MainClass">

    <!-- logo to paint while loading, will be centered -->
    <!--param name="al_logo" value="appletlogo.png">

   <!-- progressbar to paint while loading. Will be painted on top of logo, width clipped to percentage done -->
    <!--param name="al_progressbar" value="appletprogress.gif">

   <!-- List of Jars to add to classpath -->
    <param name="al_jars" value="sudoku.jar, lwjgl_applet.jar.pack.lzma, lwjgl.jar.pack.lzma, jinput.jar.pack.lzma, lwjgl_util.jar.pack.lzma, slick.jar">

    <!-- signed windows natives jar in a jar -->
    <param name="al_windows" value="windows_natives.jar.lzma">

    <!-- signed linux natives jar in a jar -->
    <param name="al_linux" value="linux_natives.jar.lzma">

    <!-- signed mac osx natives jar in a jar -->
    <param name="al_mac" value="macosx_natives.jar.lzma">

    <!-- signed solaris natives jar in a jar -->
    <param name="al_solaris" value="solaris_natives.jar.lzma">

    <!-- Tags under here are optional -->

    <!-- Version of Applet, important otherwise applet won't be cached, version change will update applet, must be int or float -->
    <!-- <param name="al_version" value="0.1"> -->

    <!-- whether to use cache - defaults to true -->
    <!-- <param name="al_cache" value="true"> -->

    <!-- background color to paint with, defaults to white -->
    <!-- <param name="boxbgcolor" value="#000000"> -->

    <!-- foreground color to paint with, defaults to black -->
    <!-- <param name="boxfgcolor" value="#ffffff"> -->

    <!-- whether to run in debug mode -->
    <!-- <param name="al_debug" value="true"> -->

    <!-- whether to prepend host to cache path - defaults to true -->
    <!-- <param name="al_prepend_host" value="true"> -->

    <!-- main applet specific params -->

   <param name="separate_jvm" value="true">
  </applet>

  <p>
    if <code>al_debug</code> is true the applet will load and extract resources with a delay, to be able to see the loader process.
  </p>

  </body>
</html>

这是它返回的错误。

network: Cache entry not found [url: file:/C:/Users/Rose/Desktop/Applet%20Test/lwjgl_util_applet.jar, version: null]
basic: exception: java.lang.reflect.InvocationTargetException.
java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
        at sun.plugin2.applet.Plugin2ClassLoader.defineClassHelper(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.access$100(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader$2.run(Unknown Source)
        at java.security.AccessController.doPrivileged(Native Method)
        at sun.plugin2.applet.Plugin2ClassLoader.findClassHelper(Unknown Source)
        at sun.plugin2.applet.Applet2ClassLoader.findClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass0(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.loadCode(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager.initAppletAdapter(Unknown Source)
        at sun.plugin2.applet.Plugin2Manager$AppletExecutionRunnable.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.reflect.InvocationTargetException
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
        at java.lang.reflect.Method.invoke(Unknown Source)
        ... 14 more
Caused by: java.lang.NullPointerException
        at sun.plugin2.applet.Plugin2ClassLoader.loadAllowedCodebases(Unknown Source)
        at sun.plugin2.applet.Plugin2ClassLoader.getPermissions(Unknown Source)
        at sun.plugin2.applet.Applet2ClassLoader.getPermissions(Unknown Source)
        at java.security.SecureClassLoader.getProtectionDomain(Unknown Source)
        at java.security.SecureClassLoader.defineClass(Unknown Source)
        at java.net.URLClassLoader.defineClass(Unknown Source)
        ... 18 more
Ignored exception: java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
basic: Dialog type is not candidate for embedding
basic: Removed progress listener: sun.plugin.util.ProgressMonitorAdapter@1cb8654
security: Reset deny session certificate store

问我需要提出的任何问题。

1 个答案:

答案 0 :(得分:0)

我们遇到了和你一样的崩溃。切换到使用JNLP修复它:

(1)为applet创建一个JNLP文件。见http://docs.oracle.com/javase/tutorial/deployment/applet/deployingApplet.html。如果/当您对applet进行更改时,可能需要清除JNLP缓存以使其获取(在命令行执行“javaws -uninstall”)。

(2)更改标记以使用jnlp_href标记而不是存档和代码库标记。将其指向您在(1)中创建的.jnlp文件。看到: http://docs.oracle.com/javase/tutorial/deployment/applet/html.html

这为我们解决了崩溃问题。请注意,在尝试修复崩溃时,我们还更新了清单文件以使用Codebase,Application-Library-Allowable-Codebase,Caller-Allowable-Codebase和Permissions字段。但是在我们切换到使用JNLP之前,崩溃仍然发生。