skip to Main Content

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


  1. 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 dont have the com.sun.xml.ws dependencies anymore -> Therefore, we need to add them explicitly.

    Hope it helps!

    Login or Signup to reply.
  2. <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>
    <!-- JAXWS for Java 11 -->
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-rt</artifactId>
        <version>2.3.0</version>
    </dependency>
    <dependency>
        <groupId>com.sun.xml.ws</groupId>
        <artifactId>jaxws-ri</artifactId>
        <version>2.3.2</version>
        <type>pom</type>
    </dependency>
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search