2010-04-12 65 views
0

即使如此jar文件存在並位於正確的文件夾中,我得到了NoClassDefFoundError。爲什麼?我做錯了什麼?Jsystem AutoITAgent不起作用 - java.lang.NoClassDefFoundError:org/apache/xmlrpc/WebServer

The Classpath definition is .\thirdparty\lib\;C:\jsystem\runner\lib\ant-jsystem.jar;C:jsystem\runner\lib\cli.jar;C:\jsystem\runner\lib\commons-logging-1.1.jar;C:\jsystem\runner\lib\embeddedCatalina.jar;C:\jsystem\runner\lib\fileParser.jar;C:\jsystem\runner\lib\filetransfer.jar;C:\jsystem\runner\lib\j2autoit.jar;C:\jsystem\runner\lib\jsystem-launcher.jar;C:\jsystem\runner\lib\jsystemAgent.jar;C:\jsystem\runner\lib\jsystemApp.jar;C:\jsystem\runner\lib\jsystemCommon.jar;C:\jsystem\runner\lib\jsystemCore.jar;C:\jsystem\runner\lib\snmp.jar;C:\jsystem\runner\lib\stations.jar;C:\jsystem\runner\lib\swing.jar;C:\jsystem\runner\lib\tcl.jar;C:\jsystem\runner\lib\vbshell.jar;C:\jsystem\runner\lib\web.jar;C:\jsystem\runner\lib\wget.jar; 
C:\jsystem\runner\lib\xmlrpc-client-3.1.3.jar; 
C:\jsystem\runner\lib\xmlrpc-common-3.1.3.jar; 
C:\jsystem\runner\lib\xmlrpc-server-3.1.3.jar; 
C:\jsystem\runner\lib\j2autoit\j2autoit.jar 
C:\jsystem\runner 
Setting J2AutoIt Agent to use the port: 8888 
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xmlrpc/WebServer 
    at com.jsystem.j2autoit.AutoItAgent.startAutoItWebServer(AutoItAgent.java:665) 
    at com.jsystem.j2autoit.AutoItAgent.main(AutoItAgent.java:348) 
    Caused by: java.lang.ClassNotFoundException: org.apache.xmlrpc.WebServer 
     at java.net.URLClassLoader$1.run(Unknown Source) 
     at java.security.AccessController.doPrivileged(Native Method) 
     at java.net.URLClassLoader.findClass(Unknown Source) 
     at java.lang.ClassLoader.loadClass(Unknown Source) 
     at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) 
     at java.lang.ClassLoader.loadClass(Unknown Source) 
     at java.lang.ClassLoader.loadClassInternal(Unknown Source) 
     ... 2 more 

回答

0

的問題您正在使用的版本爲XML-RPC。該包已從version 2移至version 3。但要使用它,您應該刪除第三方目錄的XML-RPC。並看到你有現在的版本(我認爲你的情況是version 3)。

0

我發現了。\第三方\ LIB \和\ thridparty \ commonLib必須添加到classpath,擺脫錯誤的。

如果不加\ thridparty \ commonLib您將收到以下錯誤:

Exception in thread "Thread-5" java.lang.NoClassDefFoundError: org/apache/commons/codec/DecoderException 

目前我已經修改了runAutoItAgent.bat如下:

@echo OFF 
rem Runs AutoIt agent 

set current_dir=%~dp0 
set current_drive=%~d0 
%current_drive% 
cd %current_dir% 

setlocal ENABLEDELAYEDEXPANSION 
set CLASSPATH=.\thirdparty\lib\ 
FOR /R .\lib %%G IN (*.jar) DO set CLASSPATH=!CLASSPATH!;%%G 
FOR /R .\thirdparty\commonLib %%G IN (*.jar) DO set CLASSPATH=!CLASSPATH!;%%G 
FOR /R .\thirdparty\lib %%G IN (*.jar) DO set CLASSPATH=!CLASSPATH!;%%G 

echo The Classpath definition is %CLASSPATH% 

java -classpath "%CLASSPATH%;." com.jsystem.j2autoit.AutoItAgent 8888 

rem Make sure that we see the output 
@echo ON 

pause