我在Java Web Start应用程序中遇到以下错误 .
Exception in thread "AWT-EventQueue-2" java.lang.NoClassDefFoundError: org/apache/commons/httpclient/HttpMethod
我的JNLP文件:
<?xml version="1.0" encoding="UTF-8"?>
<jnlp codebase="http://localhost:7001/myapp/" href="">
<information>
<title>My App</title>
<vendor>Something</vendor>
</information>
<resources>
<j2se version="1.6+" />
<jar href="applets/myApp.jar" main="true" />
<jar href="applets/commons-httpclient-3.0.1.jar" main="false" />
<jar href="applets/commons-logging-1.0.4.jar" main="false" />
<jar href="applets/commons-codec-1.2.jar" main="false" />
<jar href="applets/json-2.0.jar" main="false" />
<jar href="applets/commons-io-1.1.jar" main="false" />
</resources>
<application-desc name="app1" main-class="com.test.MainClass" width="1200" height="850">
<argument>abc</argument>
</application-desc>
<security>
<all-permissions/>
</security>
<update check="background"/>
</jnlp>
myApp.jar中的MANIFEST.MF条目:
Manifest-Version: 1.0
Ant-Version: Apache Ant 1.9.6
Trusted-Library: true
Application-Library-Allowable-Codebase: *
Class-Path: commons-httpclient-3.0.1.jar
commons-logging-1.0.4.jar commons-codec-1.2.jar commons-io-1.1.jar json-2.0.jar commons-httpclient-3.0.1.jar
Application-Name: My Applicaton
Permissions: all-permissions
Created-By: 1.7.0_79-b15 (Oracle Corporation)
Caller-Allowable-Codebase: *
Codebase: *
我可以在Java控制面板(Java Cache Viewer)的资源中看到jar文件“commons-httpclient-3.0.1.jar”,但是当我的应用程序使用HttpMethod类时,它会抛出异常 . 所有 jar 都在我的申请中签名 . 我也得到与其他第三方jar文件相同的错误 .
任何帮助将非常感激!