【问题标题】:Deploying an application using Java Web Start使用 Java Web Start 部署应用程序
【发布时间】:2013-01-03 13:52:35
【问题描述】:

我最近用 Java 开发了一个完整的系统,该系统连接到数据库(使用 jtds.jdbc.Driver)并使用 Apache POI 将表格内容导出和导入到 Excel 工作表。我使用 Swing 作为用户界面。用户将与它进行交互以进行身份​​验证和文件管理。

显然客户端想要部署它,所以我开始在 Apache tomcat 服务器上使用 Java Web Start 进行部署。

我参考了this 有趣的教程。自从我关注了它

启动文件

<jnlp spec="1.0+" codebase="http://localhost:8080/" href="Test.jnlp">
  <information>
    <title>Talisman</title>
    <vendor>CCT</vendor>
    <homepage href="http://localhost:8080/"/>
    <description>Testing Testing</description>
  </information>
  <resources>
    <j2se version="1.6+"/>
    <jar href="Talisman.jar"/>
  </resources>
  <application-desc main-class="cct.karim.karim"/>
</jnlp>

运行时异常

java.lang.NoClassDefFoundError: org/apache/poi/ss/usermodel/CellStyle
    at java.lang.Class.getDeclaredMethods0(Native Method)
    at java.lang.Class.privateGetDeclaredMethods(Class.java:2442)
    at java.lang.Class.getMethod0(Class.java:2685)
    at java.lang.Class.getMethod(Class.java:1620)
    at com.sun.javaws.Launcher.executeApplication(Unknown Source)
    at com.sun.javaws.Launcher.executeMainClass(Unknown Source)
    at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
    at com.sun.javaws.Launcher.run(Unknown Source)
    at java.lang.Thread.run(Thread.java:722)
Caused by: java.lang.ClassNotFoundException: org.apache.poi.ss.usermodel.CellStyle
    at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
    at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
    at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
    at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
    ... 9 more

似乎是什么问题?

【问题讨论】:

    标签: java tomcat apache-poi noclassdeffounderror java-web-start


    【解决方案1】:

    您的部署中没有包含您的 POI jar。我怀疑您还需要部署其他 jars。您的应用所需的一切都必须下载并安装在您客户端的主机上。

    你需要这样一行:

       <jar href="apache-poi.x.y.jar"/>
    

    对于每个 jar 文件。

    【讨论】:

    • 好吧,我做到了 得到了这个 com.sun.deploy.net.FailedDownloadException: Unable to load resource: localhost:8080/poi-3.9-20121203.jar
    • 我在我的项目中使用了很多 Jars 然后我将我的项目导出到一个 jar(Talisman.jar)
    • 由于代码库指向http://localhost:8080/,因此使用类似http://localhost:8080/poi-3.9-20121203.jar 如果you 来检查浏览器中每个 Jar 的位置不能直接在浏览器中下载,JRE也不能。
    • 我所有的 jar 都是项目目录中的内部 jar
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2023-03-27
    • 1970-01-01
    • 2018-10-11
    • 1970-01-01
    • 1970-01-01
    • 2015-08-08
    • 1970-01-01
    相关资源
    最近更新 更多