programmer
programmer

Reputation: 101

jersey with spring-boot 1.5.14 not working

i am trying to make a jersey jax-rs rest project with spring-boot 1.5.14. i have used spring jersey starter in dependency. but not working. Please see my pom beolow.

<parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.5.14.BUILD-SNAPSHOT</version>
        <relativePath /> <!-- lookup parent from repository -->
    </parent>
<dependences>
 <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-jersey</artifactId>
        </dependency>
</dependences>

Its not working. @Path @Get those all jax-rs anotation is not resolved. i have added

<dependency>
    <groupId>javax.ws.rs</groupId>
    <artifactId>javax.ws.rs-api</artifactId>
    <version>2.1</version>
</dependency>

then it is resolved. another issue has come.

register(RequestContextFilter.class); is not solved. then i added---

<dependency>
    <groupId>org.glassfish.jersey.core</groupId>
    <artifactId>jersey-common</artifactId>
    <version>2.24.1</version>
</dependency>

now it is solved but new error comming at runtime. org/jvnet/hk2/spring/bridge/api/SpringBridge class def not found. again i have added---

<dependency>
    <groupId>org.glassfish.hk2</groupId>
    <artifactId>spring-bridge</artifactId>
    <version>2.2.0-b14</version>
</dependency>

now different error has come--- org/glassfish/hk2/api/ServiceLocatorFactory$CreatePolicy class def not found. again i have added.

 <dependency>
        <groupId>org.glassfish.hk2</groupId>
        <artifactId>hk2-api</artifactId>
        <version>2.1.9</version>
    </dependency>

now it is giving---- org/glassfish/hk2/utilities/binding/AbstractBinder class def not found

i have added h2k api again it is giving java.lang.NoClassDefFoundError: org/glassfish/hk2/api/ServiceLocator. i upgraded hk2 api version . then comming class not found jersey.repackaged.com.google.common.base.Function i added

<dependency>
    <groupId>org.glassfish.jersey.bundles.repackaged</groupId>
    <artifactId>jersey-guava</artifactId>
    <version>2.25.1</version>

now t last it is giving-"No generator was provided and there is no default generator registered-IllegalArgs exception.

if i ad jeresy all. then it is throwing no implementation found for hibernate validator

Upvotes: 1

Views: 833

Answers (1)

Paul Samsotha
Paul Samsotha

Reputation: 208994

Probably because you're using BUILD-SNAPSHOT for the Spring Boot parent version. If you're going to use a snapshot version, then you need to configure a snapshot repository in your pom. That's why the Jersey starter dependency can't be resolved. What you want to use is the RELEASE version. All Spring release version end with this suffix.

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.5.14.RELEASE</version>
    <relativePath /> <!-- lookup parent from repository -->
</parent>

Upvotes: 1

Related Questions