Exception java.lang.Noclassdeffounderror: javax/xml/Ws/Endpoint

Asked

Viewed 44 times

0

It is a simple code, where I will create a Webservice with SOAP, but when I run the code in Eclipse it presents me the following error:

Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/ws/Endpoint
    at br.com.caelum.estoque.ws.PublicaWebService.main(PublicaWebService.java:15)
Caused by: java.lang.ClassNotFoundException: javax.xml.ws.Endpoint
    at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:606)
    at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:168)
    at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:522)
    ... 1 more

I’ve imported some Jars:

  • Jakarta.xml.bind-api-2. 3.2
  • javaee-api-6.0
  • jaxb-Runtime-2.3.3-B02
  • jaxb-api-2.2.3

It’s a simple project, I’m not using Maven, so my first contact with Webservice.

Here are the main classes of the project:

package br.com.caelum.estoque.ws;
import javax.xml.ws.Endpoint;
public class PublicaWebService {
public static void main(String[] args) {

        EstoqueWS implementacaoWS = new EstoqueWS();
        String URL = "http://localhost:8080/estoquews";

        Endpoint.publish(URL, implementacaoWS);

    }

}

Class Stocks.java:

package br.com.caelum.estoque.ws;
import java.util.ArrayList;
import java.util.List;
import javax.jws.WebService;
import br.com.caelum.estoque.modelo.item.Item;
import br.com.caelum.estoque.modelo.item.ItemDao;

@WebService
public class EstoqueWS {

    private ItemDao dao = new ItemDao();
    
    public List<Item> getItens(){
        System.out.println("Chamando getItens()");
        ArrayList<Item> lista = dao.todosItens();
        return lista;
    }
    
}

I have tried some solutions as other versions of the Jars of jaxb-api-2.2.3 and jaxb-api-2.0, but nothing has any effect.

I’d appreciate any help

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.