javax.ws.rs.NotAcceptableException: HTTP 406 Not Acceptable

Stack Overflow | Rob | 5 days ago
  1. 0

    Multiple GET operations in REST differentiated by queryparam and pathparam is possible?

    Stack Overflow | 10 months ago | bkrish
    javax.ws.rs.NotAcceptableException: HTTP 406 Not Acceptable
  2. 0

    Spec. Section 3.1.2, says: {quote} If more than one public constructor is suitable then an implementation MUST use the one with the most parameters. {quote} However, the following code: {code:java} @Path("Resource") public class Resource { private HttpHeaders headers; private UriInfo info; private Application application; private Request request; private Providers provider; public Resource(){ } public Resource(@Context HttpHeaders headers){ this.headers = headers; } public Resource(@Context HttpHeaders headers, @Context UriInfo info){ this.headers = headers; this.info = info; } public Resource(@Context HttpHeaders headers, @Context UriInfo info, @Context Application application){ this.application = application; this.headers = headers; this.info = info; } public Resource(@Context HttpHeaders headers, @Context UriInfo info, @Context Application application, @Context Request request){ this.application = application; this.headers = headers; this.info = info; this.request = request; } protected Resource(@Context HttpHeaders headers, @Context UriInfo info, @Context Application application, @Context Request request, @Context Providers provider){ this.application = application; this.headers = headers; this.info = info; this.request = request; this.provider = provider; } @GET @Path("mostAttributes") public Response isUsedConstructorWithMostAttributes(){ boolean ok = application != null; ok &= headers != null; ok &= info != null; ok &= request != null; ok &= provider == null; Status status = ok ? Status.OK : Status.NOT_ACCEPTABLE; return Response.status(status).build(); } } {code} Throws : {quote} MultiException stack 1 of 1 java.lang.IllegalArgumentException: There is more than one constructor on class Resource at org.jvnet.hk2.internal.Utilities.findProducerConstructor(Utilities.java:824) at org.jvnet.hk2.internal.Utilities.justCreate(Utilities.java:632) at org.jvnet.hk2.internal.ServiceLocatorImpl.create(ServiceLocatorImpl.java:601) at org.jvnet.hk2.internal.ServiceLocatorImpl.createAndInitialize(ServiceLocatorImpl.java:657) at org.glassfish.jersey.internal.inject.Injections.getOrCreate(Injections.java:186) at org.glassfish.jersey.server.model.MethodHandler$ClassBasedMethodHandler.getInstance(MethodHandler.java:185) at org.glassfish.jersey.server.internal.routing.PushMethodHandlerRouter.apply(PushMethodHandlerRouter.java:102) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:115) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:118) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:118) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:118) at org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:118) at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:101) at org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61) at org.glassfish.jersey.process.internal.Stages.process(Stages.java:197) at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:189) at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:316) at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:174) at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:761) at org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:309) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:349) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:312) at org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:195) {quote}

    Java.net JIRA | 4 years ago | jan.supol
    java.lang.IllegalArgumentException: There is more than one constructor on class Resource
  3. 0

    Apache Shiro: GET /login results in 406 HTTP Response

    Stack Overflow | 5 days ago | Rob
    javax.ws.rs.NotAcceptableException: HTTP 406 Not Acceptable
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    Re: Testing a REST service implemented using Jersey 2.17 and OWB 1.2.17

    openwebbeans-user | 2 years ago | l.penet@senat.fr
    java.lang.IllegalArgumentException: While attempting to resolve the dependencies of fr.senat.presences.rest.api.v1.ActivitesRestService errors were found
  6. 0

    Re: Testing a REST service implemented using Jersey 2.17 and OWB 1.2.17

    openwebbeans-user | 2 years ago | l.penet@senat.fr
    java.lang.IllegalArgumentException: While attempting to resolve the dependencies of fr.senat.presences.rest.api.v1.ActivitesRestService errors were found

    Not finding the right solution?
    Take a tour to get the most out of Samebug.

    Tired of useless tips?

    Automated exception search integrated into your IDE

    Root Cause Analysis

    1. javax.ws.rs.NotAcceptableException

      HTTP 406 Not Acceptable

      at org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.getMethodRouter()
    2. jersey-core-server
      RoutingStage.apply
      1. org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.getMethodRouter(MethodSelectingRouter.java:529)
      2. org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.access$000(MethodSelectingRouter.java:94)
      3. org.glassfish.jersey.server.internal.routing.MethodSelectingRouter$4.apply(MethodSelectingRouter.java:779)
      4. org.glassfish.jersey.server.internal.routing.MethodSelectingRouter.apply(MethodSelectingRouter.java:371)
      5. org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:109)
      6. org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
      7. org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
      8. org.glassfish.jersey.server.internal.routing.RoutingStage._apply(RoutingStage.java:112)
      9. org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:92)
      10. org.glassfish.jersey.server.internal.routing.RoutingStage.apply(RoutingStage.java:61)
      10 frames
    3. Jersey Core
      Stages.process
      1. org.glassfish.jersey.process.internal.Stages.process(Stages.java:197)
      1 frame
    4. jersey-core-server
      ServerRuntime$2.run
      1. org.glassfish.jersey.server.ServerRuntime$2.run(ServerRuntime.java:318)
      1 frame
    5. Jersey Core
      RequestScope.runInScope
      1. org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
      2. org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
      3. org.glassfish.jersey.internal.Errors.process(Errors.java:315)
      4. org.glassfish.jersey.internal.Errors.process(Errors.java:297)
      5. org.glassfish.jersey.internal.Errors.process(Errors.java:267)
      6. org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      6 frames
    6. jersey-core-server
      ApplicationHandler.handle
      1. org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:305)
      2. org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:1154)
      2 frames
    7. jersey-container-servlet-core
      ServletContainer.service
      1. org.glassfish.jersey.servlet.WebComponent.serviceImpl(WebComponent.java:471)
      2. org.glassfish.jersey.servlet.WebComponent.service(WebComponent.java:425)
      3. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:383)
      4. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:336)
      5. org.glassfish.jersey.servlet.ServletContainer.service(ServletContainer.java:223)
      5 frames
    8. Dropwizard Jetty Support
      NonblockingServletHolder.handle
      1. io.dropwizard.jetty.NonblockingServletHolder.handle(NonblockingServletHolder.java:49)
      1 frame
    9. Jetty
      GzipFilter.doFilter
      1. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
      2. org.eclipse.jetty.servlets.UserAgentFilter.doFilter(UserAgentFilter.java:83)
      3. org.eclipse.jetty.servlets.GzipFilter.doFilter(GzipFilter.java:364)
      3 frames
    10. Dropwizard Jetty Support
      BiDiGzipFilter.doFilter
      1. io.dropwizard.jetty.BiDiGzipFilter.doFilter(BiDiGzipFilter.java:132)
      1 frame
    11. Jetty
      ServletHandler$CachedChain.doFilter
      1. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      1 frame
    12. Dropwizard Servlet Support
      ThreadNameFilter.doFilter
      1. io.dropwizard.servlets.ThreadNameFilter.doFilter(ThreadNameFilter.java:29)
      1 frame
    13. Jetty
      ServletHandler$CachedChain.doFilter
      1. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      1 frame
    14. Dropwizard Jersey Support
      AllowedMethodsFilter.doFilter
      1. io.dropwizard.jersey.filter.AllowedMethodsFilter.handle(AllowedMethodsFilter.java:43)
      2. io.dropwizard.jersey.filter.AllowedMethodsFilter.doFilter(AllowedMethodsFilter.java:38)
      2 frames
    15. Jetty
      ServletHandler$CachedChain.doFilter
      1. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      1 frame
    16. com.example.shiro
      SessionFilter.doFilter
      1. com.example.shiro.dropwizard.SessionFilter.doFilter(SessionFilter.java:75)
      1 frame
    17. Jetty
      ServletHandler$CachedChain.doFilter
      1. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      1 frame
    18. Shiro
      OncePerRequestFilter.doFilter
      1. org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61)
      2. org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108)
      3. org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137)
      4. org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
      5. org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66)
      6. org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449)
      7. org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365)
      8. org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90)
      9. org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83)
      10. org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383)
      11. org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362)
      12. org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125)
      12 frames
    19. Jetty
      HandlerWrapper.handle
      1. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      2. org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:256)
      3. org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:219)
      4. org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
      5. org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
      6. org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:221)
      7. org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
      8. org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
      9. org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:185)
      10. org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
      11. org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
      12. org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      12 frames
    20. Metrics Integration for Jetty 9.1 and higher
      InstrumentedHandler.handle
      1. com.codahale.metrics.jetty9.InstrumentedHandler.handle(InstrumentedHandler.java:240)
      1 frame
    21. Dropwizard Jetty Support
      RoutingHandler.handle
      1. io.dropwizard.jetty.RoutingHandler.handle(RoutingHandler.java:51)
      1 frame
    22. Jetty
      QueuedThreadPool$3.run
      1. org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      2. org.eclipse.jetty.server.handler.StatisticsHandler.handle(StatisticsHandler.java:159)
      3. org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
      4. org.eclipse.jetty.server.Server.handle(Server.java:499)
      5. org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
      6. org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
      7. org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
      8. org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
      9. org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
      9 frames
    23. Java RT
      Thread.run
      1. java.lang.Thread.run(Thread.java:745)[na:1.8.0_111]
      1 frame