需要這一個,請幫助.....試圖利用以下神器: artifactory的-Java的客戶端服務 我的POM文件如下:java.lang.NoClassDefFoundError行家+日食
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>ArtRepoClient</groupId>
<artifactId>ArtRepoClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>jar</packaging>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.1.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jfrog.artifactory.client</groupId>
<artifactId>artifactory-java-client-services</artifactId>
<version>0.13</version>
</dependency>
</dependencies>
</project>
我必須位於/ src目錄/主/ Java的有以下摘錄代碼的類:
public static void main(String[] args) {
Artifactory artifactory = ArtifactoryClient.create(url, username,password);
}
代碼編譯罰款,但小號EEM在運行時有一個類裝載問題: ,如下所示:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/client/methods/HttpUriRequest
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2413)
at java.lang.Class.getDeclaredConstructors(Class.java:1855)
at org.codehaus.groovy.reflection.CachedClass$2$1.run(CachedClass.java:69)
at java.security.AccessController.doPrivileged(Native Method)
at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:66)
at org.codehaus.groovy.reflection.CachedClass$2.initValue(CachedClass.java:64)
at org.codehaus.groovy.util.LazyReference.getLocked(LazyReference.java:46)
at org.codehaus.groovy.util.LazyReference.get(LazyReference.java:33)
at org.codehaus.groovy.reflection.CachedClass.getConstructors(CachedClass.java:258)
at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:189)
at groovy.lang.MetaClassImpl.<init>(MetaClassImpl.java:193)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createNormalMetaClass(MetaClassRegistry.java:157)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.createWithCustomLookup(MetaClassRegistry.java:147)
at groovy.lang.MetaClassRegistry$MetaClassCreationHandle.create(MetaClassRegistry.java:130)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:175)
at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:192)
at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:309)
at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:806)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallConstructorSite(CallSiteArray.java:84)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallConstructor(CallSiteArray.java:57)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:182)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callConstructor(AbstractCallSite.java:190)
at org.jfrog.artifactory.client.ArtifactoryClient.create(ArtifactoryClient.groovy:23)
at com.cs.etl.rsclient.TestMain.main(TestMain.java:16)
Caused by: java.lang.ClassNotFoundException: org.apache.http.client.methods.HttpUriRequest
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 java.lang.ClassLoader.loadClass(ClassLoader.java:423)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
... 25 more
我的類路徑(System.getProperty("java.class.path");
)示出了相關的罐:C:\用戶\ Administrator.m2 \庫\組織\阿帕奇\ httpcomponents \ HttpClient的\ 4.2.1 \ httpclient-4.2.1.jar是在運行時加載的,如下圖所示,所以我不明白爲什麼上面的問題。
C:\Users\Administrator\Workspaces\MyEclipse Blue 2014\ArtifactoryRepClient\target\classes
**C:\Users\Administrator\.m2\repository\org\apache\httpcomponents\httpclient\4.2.1\httpclient-4.2.1.jar**
C:\Users\Administrator\.m2\repository\org\jfrog\artifactory\client\artifactory-java-client-services\0.13\artifactory-java-client-services-0.13.jar
C:\Users\Administrator\.m2\repository\org\jfrog\artifactory\client\artifactory-java-client-api\0.13\artifactory-java-client-api-0.13.jar
C:\Users\Administrator\.m2\repository\org\codehaus\groovy\groovy\2.1.0\groovy-2.1.0-indy.jar
C:\Users\Administrator\.m2\repository\antlr\antlr\2.7.7\antlr-2.7.7.jar
C:\Users\Administrator\.m2\repository\org\ow2\asm\asm-tree\4.0\asm-tree-4.0.jar
C:\Users\Administrator\.m2\repository\org\ow2\asm\asm-commons\4.0\asm-commons-4.0.jar
C:\Users\Administrator\.m2\repository\org\ow2\asm\asm\4.0\asm-4.0.jar
C:\Users\Administrator\.m2\repository\org\ow2\asm\asm-util\4.0\asm-util-4.0.jar
C:\Users\Administrator\.m2\repository\org\ow2\asm\asm-analysis\4.0\asm-analysis-4.0.jar
C:\Users\Administrator\.m2\repository\org\codehaus\groovy\groovy-json\2.1.0\groovy-json-2.1.0-indy.jar
C:\Users\Administrator\.m2\repository\org\codehaus\groovy\groovy\2.1.0\groovy-2.1.0.jar
C:\Users\Administrator\.m2\repository\org\codehaus\groovy\groovy-xml\2.1.0\groovy-xml-2.1.0-indy.jar
C:\Users\Administrator\.m2\repository\org\codehaus\groovy\modules\http-builder\http-builder\0.6\http-builder-0.6.jar
C:\Users\Administrator\.m2\repository\org\apache\httpcomponents\httpcore\4.2.1\httpcore-4.2.1.jar
C:\Users\Administrator\.m2\repository\commons-logging\commons-logging\1.1.1\commons-logging-1.1.1.jar
C:\Users\Administrator\.m2\repository\commons-codec\commons-codec\1.6\commons-codec-1.6.jar
C:\Users\Administrator\.m2\repository\net\sf\json-lib\json-lib\2.3\json-lib-2.3-jdk15.jar
C:\Users\Administrator\.m2\repository\commons-beanutils\commons-beanutils\1.8.0\commons-beanutils-1.8.0.jar
C:\Users\Administrator\.m2\repository\commons-collections\commons-collections\3.2.1\commons-collections-3.2.1.jar
C:\Users\Administrator\.m2\repository\commons-lang\commons-lang\2.4\commons-lang-2.4.jar
C:\Users\Administrator\.m2\repository\net\sf\ezmorph\ezmorph\1.0.6\ezmorph-1.0.6.jar
C:\Users\Administrator\.m2\repository\xml-resolver\xml-resolver\1.2\xml-resolver-1.2.jar
C:\Users\Administrator\.m2\repository\net\sourceforge\nekohtml\nekohtml\1.9.17\nekohtml-1.9.17.jar
C:\Users\Administrator\.m2\repository\xerces\xercesImpl\2.9.1\xercesImpl-2.9.1.jar
C:\Users\Administrator\.m2\repository\org\slf4j\slf4j-api\1.7.2\slf4j-api-1.7.2.jar
C:\Users\Administrator\.m2\repository\org\slf4j\log4j-over-slf4j\1.7.2\log4j-over-slf4j-1.7.2.jar
C:\Users\Administrator\.m2\repository\org\slf4j\jcl-over-slf4j\1.7.2\jcl-over-slf4j-1.7.2.jar
C:\Users\Administrator\.m2\repository\ch\qos\logback\logback-classic\1.0.9\logback-classic-1.0.9.jar
C:\Users\Administrator\.m2\repository\ch\qos\logback\logback-core\1.0.9\logback-core-1.0.9.jar
C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\core\jackson-core\2.0.4\jackson-core-2.0.4.jar
C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\core\jackson-annotations\2.0.4\jackson-annotations-2.0.4.jar
C:\Users\Administrator\.m2\repository\com\fasterxml\jackson\core\jackson-databind\2.0.4\jackson-databind-2.0.4.jar
C:\Users\Administrator\.m2\repository\junit\junit\4.11\junit-4.11.jar
C:\Users\Administrator\.m2\repository\org\hamcrest\hamcrest-core\1.3\hamcrest-core-1.3.jar
這很有趣。我想知道安全部分如何處理好。 – BenoitParis