users@jersey.java.net

[Jersey] Re: Registering Providers in Jersey Client 1.17

From: Marek Potociar <marek.potociar_at_oracle.com>
Date: Tue, 9 Jun 2015 16:32:23 -0700

From the logs it seems that you are trying to inject server-side stuff (Request, ServletConfig) into your client providers. AFAIK that is a no-go in Jersey 1.x client.

Marek

> On 02 Jun 2015, at 06:19, Martynas Jusevičius <martynas_at_graphity.org> wrote:
>
> Anyone? There must be someone using Client with Providers that have
> field injection?
>
> On Sun, May 31, 2015 at 4:11 PM, Martynas Jusevičius
> <martynas_at_graphity.org> wrote:
>> Hey,
>>
>> I'm implementing a specialized HTTP using Jersey Client API.
>>
>> I tried registering singletons from my Application:
>>
>> ClientConfig cc = new DefaultClientConfig();
>> cc.getSingletons().addAll(application.getSingletons());
>> Client client = Client.create(cc);
>> WebResource webResource = client.resource(topicURI);
>>
>> However, this throws exceptions (stack trace bellow). I suspect they
>> are related to IoCComponentProviderFactory which I'm not passing to
>> create(). But I couldn't figure out how to get hold of its instance?
>>
>> Help appreciated.
>>
>>
>> SEVERE: The following errors and warnings have been detected with
>> resource and/or provider classes:
>> SEVERE: Missing dependency for field: javax.ws.rs.core.Request
>> org.graphity.core.provider.SPARQLEndpointProvider.request
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.core.provider.SPARQLEndpointProvider.filtertConfig
>> SEVERE: Missing dependency for field: private
>> javax.ws.rs.core.Request
>> org.graphity.processor.provider.SkolemizingModelProvider.request
>> SEVERE: Missing dependency for field: private
>> javax.ws.rs.core.UriInfo
>> org.graphity.processor.provider.SkolemizingModelProvider.uriInfo
>> SEVERE: Missing dependency for field: javax.ws.rs.core.Request
>> org.graphity.core.provider.GraphStoreProvider.request
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.core.provider.GraphStoreProvider.servletConfig
>> SEVERE: Missing dependency for field:
>> com.sun.jersey.api.core.HttpContext
>> org.graphity.core.provider.QueryParamProvider.httpContext
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.client.provider.DataManagerProvider.servletConfig
>> SEVERE: Missing dependency for field: javax.ws.rs.core.UriInfo
>> org.graphity.client.provider.DataManagerProvider.uriInfo
>> SEVERE: Missing dependency for field: javax.ws.rs.core.UriInfo
>> org.graphity.processor.provider.DatasetProvider.uriInfo
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.processor.provider.DatasetProvider.servletConfig
>> SEVERE: Missing dependency for field: private
>> javax.ws.rs.core.UriInfo
>> org.graphity.client.writer.ModelXSLTWriter.uriInfo
>> SEVERE: Missing dependency for field: private
>> javax.ws.rs.core.HttpHeaders
>> org.graphity.client.writer.ModelXSLTWriter.httpHeaders
>> SEVERE: Missing dependency for field: private
>> javax.servlet.ServletConfig
>> org.graphity.client.writer.ModelXSLTWriter.servletConfig
>> SEVERE: Missing dependency for field: private
>> javax.servlet.http.HttpServletRequest
>> org.graphity.client.writer.ModelXSLTWriter.httpServletRequest
>> SEVERE: Missing dependency for field: private
>> javax.ws.rs.core.UriInfo
>> org.graphity.processor.mapper.ConstraintViolationExceptionMapper.uriInfo
>> SEVERE: Missing dependency for field: private
>> com.sun.jersey.api.core.ResourceContext
>> org.graphity.processor.mapper.ConstraintViolationExceptionMapper.resourceContext
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.core.provider.GraphStoreOriginProvider.filerConfig
>> SEVERE: Missing dependency for field: javax.ws.rs.core.UriInfo
>> org.graphity.core.provider.DataManagerProvider.uriInfo
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.core.provider.DataManagerProvider.servletConfig
>> SEVERE: Missing dependency for field: javax.ws.rs.core.UriInfo
>> org.graphity.processor.provider.ConstraintViolationExceptionProvider.uriInfo
>> SEVERE: Missing dependency for field: private
>> javax.ws.rs.core.UriInfo
>> org.graphity.client.writer.ModelXSLTWriter.uriInfo
>> SEVERE: Missing dependency for field: private
>> javax.ws.rs.core.HttpHeaders
>> org.graphity.client.writer.ModelXSLTWriter.httpHeaders
>> SEVERE: Missing dependency for field: private
>> javax.servlet.ServletConfig
>> org.graphity.client.writer.ModelXSLTWriter.servletConfig
>> SEVERE: Missing dependency for field: private
>> javax.servlet.http.HttpServletRequest
>> org.graphity.client.writer.ModelXSLTWriter.httpServletRequest
>> SEVERE: Missing dependency for field: javax.ws.rs.core.UriInfo
>> org.graphity.processor.provider.OntClassMatcher.uriInfo
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.core.provider.SPARQLEndpointOriginProvider.servletConfig
>> SEVERE: Missing dependency for field: javax.ws.rs.core.UriInfo
>> org.graphity.processor.provider.OntologyProvider.uriInfo
>> SEVERE: Missing dependency for field: javax.ws.rs.core.Request
>> org.graphity.processor.provider.OntologyProvider.request
>> SEVERE: Missing dependency for field: javax.servlet.ServletConfig
>> org.graphity.processor.provider.OntologyProvider.servletConfig
>> May 31, 2015 4:01:39 PM com.sun.jersey.spi.container.ContainerResponse
>> mapMappableContainerException
>> SEVERE: The RuntimeException could not be mapped to a response,
>> re-throwing to the HTTP container
>> com.sun.jersey.spi.inject.Errors$ErrorMessagesException
>> at com.sun.jersey.spi.inject.Errors.processErrorMessages(Errors.java:170)
>> at com.sun.jersey.spi.inject.Errors.postProcess(Errors.java:136)
>> at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:199)
>> at com.sun.jersey.api.client.Client.<init>(Client.java:187)
>> at com.sun.jersey.api.client.Client.<init>(Client.java:170)
>> at com.sun.jersey.api.client.Client.create(Client.java:679)
>> at org.graphity.client.model.impl.ProxyResourceBase.<init>(ProxyResourceBase.java:106)
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
>> at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
>> at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
>> at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
>> at com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:198)
>> at com.sun.jersey.server.spi.component.ResourceComponentConstructor.construct(ResourceComponentConstructor.java:179)
>> at com.sun.jersey.server.impl.resource.PerRequestFactory$PerRequest._getInstance(PerRequestFactory.java:182)
>> at com.sun.jersey.server.impl.resource.PerRequestFactory$AbstractPerRequest.getInstance(PerRequestFactory.java:144)
>> at com.sun.jersey.server.impl.application.WebApplicationContext.getResource(WebApplicationContext.java:238)
>> at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:83)
>> at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:147)
>> at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:84)
>> at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1511)
>> at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:1442)
>> at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1391)
>> at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:1381)
>> at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:416)
>> at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
>> at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:708)
>> at javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:305)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>> at org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:393)
>> at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:243)
>> at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:210)
>> at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:222)
>> at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:123)
>> at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
>> at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
>> at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:99)
>> at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:953)
>> at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:118)
>> at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
>> at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1023)
>> at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:589)
>> at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:310)
>> at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
>> at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
>> at java.lang.Thread.run(Thread.java:724)
>>
>> Martynas