gpt4 book ai didi

java - 如何将依赖jar导入JWS?

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

我们正在从 Applet 迁移到 JWS。如何向JWS提供依赖jar?请检查我的 JNLP 文件。

<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://localhost:8080/JWSINSTEADOFAPPLET/" href="HelloWorld.jnlp">
<information>
<title>HelloWorld</title>
<vendor>IBM - JWS example of HelloWorld</vendor>`
enter code here
<description>HelloWorld - Example of JWS</description>
<description kind="short">HelloWorld example</description>
<offline-allowed/>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.3+"/>
<jar href="Harper_Colin.jar" main="true"/>
<jar href="lib/commons-codec-1.10.jar"/>
<jar href="lib/commons-httpclient-3.1.jar"/>
<jar href="lib/commons-logging-1.2.jar"/>
<jar href="lib/commons-net-3.3.jar"/>
<jar href="lib/httpclient-4.0.2-sources.jar"/>
<jar href="lib/httpclient-4.5.3.jar"/>
<jar href="lib/httpcore-4.4.6.jar"/>
<jar href="lib/plugin.jar"/>

</resources>
<application-desc main-class="Harper_Upload_Final"/>
</jnlp>

即使在资源选项卡下提供了依赖 jar,我也会收到如下错误:

java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at com.sun.javaws.Launcher.doLaunchApp(Unknown Source)
at com.sun.javaws.Launcher.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at com.sun.jnlp.JNLPClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more

请检查下面的项目结构

JWSINSTEADOFAPPLET
|
SRC
|
PACKAGE
|
.java file
|
JBoss 7.1 Runtime
|
Maven Dependencies
|
JRE System Library
|
Web Content
|
META_INF
|
WEB_INF
|
lib
|.jars
HelloWorld.jnlp
index.html
MyHarper.jar

|
pom.xml

需要更改什么让我知道,提前致谢

最佳答案

来自this answer ..

The WEB-INF node is not part of the public document tree of the application. No file contained in the WEB-INF directory may be served directly to a client..".

尝试直接获取(通过在浏览器中输入路径)以确认服务器将拒绝该请求。

关于java - 如何将依赖jar导入JWS?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43091273/

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