无法初始化com.ebay.sdk.SdkAPIInterfaceServiceLocator JAVA类 [英] Could not initialize class com.ebay.sdk.SdkAPIInterfaceServiceLocator JAVA
问题描述
我正在使用Java eBay SDK,并且尝试调用 addItem
API,我添加了eBay maven依赖项和存储库,并编写了一个简单的应用程序,其中添加了新的 Item
.主要如下图所示:
I am using Java eBay SDK, and I am trying to call addItem
API, I added eBay maven dependency and repository and wrote a simple application that adds a new Item
. The main is as shown below:
public static void main(String[] args) {
App aai = new App();
try {
ItemType item = aai.buildItem();
FeesType fees;
AddItemCall call = new AddItemCall(aai.apiContext);
call.setItem(item);
call.setAutoSetItemUUID(true);
fees = call.addItem();
} catch (Exception e) {
e.printStackTrace();
}
}
我不断收到无法修复的错误:
I keep getting this error that i couldn't fix:
[main] INFO com.ebay.sdk.SdkAPIInterfaceServiceLocator - loading wsdl : jar:file:/home/mss/.m2/repository/ebaysdkcore/ebaysdkcore/943/ebaysdkcore-943.jar!/eBaySvc.wsdl
Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class com.ebay.sdk.SdkAPIInterfaceServiceLocator
at com.ebay.sdk.ApiCall.executeByApiName(ApiCall.java:594)
at com.ebay.sdk.ApiCall.execute(ApiCall.java:348)
at com.ebay.sdk.call.AddItemCall.addItem(AddItemCall.java:162)
at org.ecommerce_eBay.App.main(App.java:38)
有人对此有任何想法吗?谢谢!
Does anyone have any idea about it? Thank you !
推荐答案
我在使用Java 11时遇到了相同的错误.只需将以下依赖项添加到maven文件中:
I had the same error with Java 11. Just add the following dependencies into the maven file:
<dependency>
<groupId>com.ebay</groupId>
<artifactId>ebaysdkcore</artifactId>
<version>1055</version>
<version>1085</version>
</dependency>
<dependency>
<groupId>com.ebay</groupId>
<artifactId>ebaycalls</artifactId>
<version>1055</version>
<version>1085</version>
</dependency>
<dependency>
<groupId>javax.xml.ws</groupId>
<artifactId>jaxws-api</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>rt</artifactId>
<version>2.3.2</version>
</dependency>
<dependency>
<groupId>com.sun.xml.ws</groupId>
<artifactId>jaxws-ri</artifactId>
<version>2.3.2</version>
<type>pom</type>
</dependency>
Java 11不再具有 com.sun.xml.ws 依赖性->因此,我们需要显式添加它们.
Java 11 dont have the com.sun.xml.ws dependencies anymore -> Therefore, we need to add them explicitly.
希望有帮助!
这篇关于无法初始化com.ebay.sdk.SdkAPIInterfaceServiceLocator JAVA类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!