提供程序实现被忽略-Java Rest API(泽西岛)

时间:2018-08-14 22:18:12

标签: java rest jersey

我已经创建了Restful API,并希望根据某些条件编辑响应。在添加@Provider之前,api可以按预期工作,但是在添加@Provider批注之后,在将@Provider批注添加到实现ContainerResponseFilter的类中之后,出现以下错误:

 org.glassfish.jersey.internal.ServiceConfigurationError: org.glassfish.jersey.server.spi.ComponentProvider: A dependent class, javax/enterprise/inject/spi/Extension, of the class org.glassfish.jersey.gf.cdi.internal.CdiComponentProvider implementing the provider interface org.glassfish.jersey.server.spi.ComponentProvider is not found. The provider implementation is ignored.
[INFO] [talledLocalContainer]   at org.glassfish.jersey.internal.ServiceFinder.fail(ServiceFinder.java:426)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.internal.ServiceFinder.access$700(ServiceFinder.java:155)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.internal.ServiceFinder$LazyObjectIterator.hasNext(ServiceFinder.java:748)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.server.ApplicationHandler.getRankedComponentProviders(ApplicationHandler.java:743)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.server.ApplicationHandler.access$600(ApplicationHandler.java:184)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.server.ApplicationHandler$4.get(ApplicationHandler.java:406)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.server.ApplicationHandler$4.get(ApplicationHandler.java:399)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.internal.util.collection.Values$LazyValueImpl.get(Values.java:340)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.server.ApplicationHandler.createApplication(ApplicationHandler.java:366)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.server.ApplicationHandler.<init>(ApplicationHandler.java:342)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.servlet.WebComponent.<init>(WebComponent.java:392)
[INFO] [talledLocalContainer]   at org.glassfish.jersey.servlet.Servle

我添加了球衣依赖项,但仍然看到此问题:

<dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.ext</groupId>
        <artifactId>jersey-spring3</artifactId>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet</artifactId>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.containers.glassfish</groupId>
        <artifactId>jersey-gf-cdi</artifactId>
        <version>2.7</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.core</groupId>
        <artifactId>jersey-server</artifactId>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
    </dependency>

我们将不胜感激。谢谢您。

0 个答案:

没有答案