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 !
2
Answers
I had the same error with Java 11. Just add the following dependencies into the maven file:
Java 11 dont have the com.sun.xml.ws dependencies anymore -> Therefore, we need to add them explicitly.
Hope it helps!