Search code examples
javaspring-bootsoapws

Endpoint cannot be resolved to a type (@Endpoint in ws)- Eclipse compilation error


This is some what strange or may be i am missing something.

I am publishing an SOAP endpoint with Spring Boot application. Below is pom.xml file

<?xml version="1.0" encoding="UTF-8"?>
<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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion> ..................
<parent>
    .............
</parent>
<groupId>com.gd</groupId>
<artifactId>sl</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>sl</name>
<description>Demo project for Spring Boot</description>
<properties>
    <java.version>1.8</java.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-actuator</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-devtools</artifactId>
        <scope>runtime</scope>
        <optional>true</optional>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>wsdl4j</groupId>
        <artifactId>wsdl4j</artifactId>
    </dependency>
</dependencies> ..........plugin and other stuff.

As per the tutorials, we need only wsdl4j dependency to publish a SOAP endpoint.

Below is my endpoint class -

@Endpoint
public class UserDetailsEndpoint {

}

This is as simple as it could be, but eclipse is showing compilation error and do not resolve the @Endpoint annotation to

import org.springframework.ws.server.endpoint.annotation.Endpoint;

Compilation error

What could be the issue, What is it that I am missing?


Solution

  • Try adding this dependency:

    <!-- https://mvnrepository.com/artifact/org.springframework.ws/spring-ws-core -->
    <dependency>
        <groupId>org.springframework.ws</groupId>
        <artifactId>spring-ws-core</artifactId>
    </dependency>
    

    An often successful way to find needed dependencies is to simply search "maven <missing-package>".

    In this case I searched "maven org.springframework.ws" and found this dependency.