javax.servlet.ServletException: java.lang.IllegalArgumentException: Failure parsing MediaType string: application/xhtml+xml application/pdf

JBoss Issue Tracker | Evgeny Denisov | 7 years ago
  1. 0

    RestEasy throws java.lang.IllegalArgumentException when processing GET request with ACCEPT mediatype string: "application/xhtml+xml application/pdf": javax.servlet.ServletException: java.lang.IllegalArgumentException: Failure parsing MediaType string: application/xhtml+xml application/pdf at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:74) at org.jboss.seam.resteasy.ResteasyResourceAdapter.getResource(ResteasyResourceAdapter.java:121) at org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427) at org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:560) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:490) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382) at org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:549) at org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:438) at org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:249) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:649) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648) at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593) at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587) at org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096) at org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579) at com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263) at com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214) at com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380) at com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265) at com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106) Caused by: java.lang.IllegalArgumentException: Failure parsing MediaType string: application/xhtml+xml application/pdf at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.parse(MediaTypeHeaderDelegate.java:42) at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.fromString(MediaTypeHeaderDelegate.java:18) at javax.ws.rs.core.MediaType.valueOf(MediaType.java:226) at org.jboss.resteasy.util.MediaTypeHelper.parseHeader(MediaTypeHelper.java:204) at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractAccepts(ServletUtil.java:119) at org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractHttpHeaders(ServletUtil.java:82) at org.jboss.seam.resteasy.ResteasyResourceAdapter$1.process(ResteasyResourceAdapter.java:127) at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53) ... 31 more This error occures regularly when processing requests from some WEB-crawlers. It should be "HTTP Error 400 Bad request" instead.

    JBoss Issue Tracker | 7 years ago | Evgeny Denisov
    javax.servlet.ServletException: java.lang.IllegalArgumentException: Failure parsing MediaType string: application/xhtml+xml application/pdf
  2. 0

    Username: (logged in) Time: 10820465858 Thread: http-/127.0.0.1:8080-31 Level: ERROR Category: org.zanata.rest.RestLimitingSynchronousDispatcher Message: Failed to process REST request NDC: java.lang.IllegalArgumentException: Failure parsing MediaType string: text/html,application/xhtml+xml,application/xml at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.parse(MediaTypeHeaderDelegate.java:42) at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.fromString(MediaTypeHeaderDelegate.java:18) at org.jboss.resteasy.core.StringParameterInjector.extractValue(StringParameterInjector.java:292) at org.jboss.resteasy.core.StringParameterInjector.extractValues(StringParameterInjector.java:261) at org.jboss.resteasy.core.HeaderParamInjector.inject(HeaderParamInjector.java:28) at org.jboss.resteasy.core.PropertyInjectorImpl.inject(PropertyInjectorImpl.java:209) at org.jboss.seam.resteasy.ResteasyContextInjectionInterceptor.aroundInvoke(ResteasyContextInjectionInterceptor.java:57) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.transaction.RollbackInterceptor.aroundInvoke(RollbackInterceptor.java:28) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.BijectionInterceptor.aroundInvoke(BijectionInterceptor.java:79) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.transaction.TransactionInterceptor$1.work(TransactionInterceptor.java:97) at org.jboss.seam.util.Work.workInTransaction(Work.java:61) at org.jboss.seam.transaction.TransactionInterceptor.aroundInvoke(TransactionInterceptor.java:91) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.core.MethodContextInterceptor.aroundInvoke(MethodContextInterceptor.java:44) at org.jboss.seam.intercept.SeamInvocationContext.proceed(SeamInvocationContext.java:68) at org.jboss.seam.intercept.RootInterceptor.invoke(RootInterceptor.java:107) at org.jboss.seam.intercept.JavaBeanInterceptor.interceptInvocation(JavaBeanInterceptor.java:196) at org.jboss.seam.intercept.JavaBeanInterceptor.invoke(JavaBeanInterceptor.java:114) at org.zanata.rest.service.ProjectIterationService_$$_javassist_seam_174.get(ProjectIterationService_$$_javassist_seam_174.java) at sun.reflect.GeneratedMethodAccessor89597.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:167) at org.jboss.resteasy.core.ResourceMethod.invokeOnTarget(ResourceMethod.java:269) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:227) at org.jboss.resteasy.core.ResourceMethod.invoke(ResourceMethod.java:216) at org.jboss.resteasy.core.SynchronousDispatcher.getResponse(SynchronousDispatcher.java:542) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:524) at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:126) at org.zanata.rest.RestLimitingSynchronousDispatcher.access$001(RestLimitingSynchronousDispatcher.java:58) at org.zanata.rest.RestLimitingSynchronousDispatcher$1.run(RestLimitingSynchronousDispatcher.java:120) at org.zanata.limits.RestCallLimiter.acquireActivePermit(RestCallLimiter.java:91) at org.zanata.limits.RestCallLimiter.tryAcquireAndRun(RestCallLimiter.java:66) at org.zanata.limits.RateLimitingProcessor.process(RateLimitingProcessor.java:55) at org.zanata.limits.RateLimitingProcessor.processForApiKey(RateLimitingProcessor.java:36) at org.zanata.rest.RestLimitingSynchronousDispatcher.invoke(RestLimitingSynchronousDispatcher.java:137) at org.jboss.seam.resteasy.ResteasyResourceAdapter$1.process(ResteasyResourceAdapter.java:145) at org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:65) at org.jboss.seam.resteasy.ResteasyResourceAdapter.getResource(ResteasyResourceAdapter.java:120) at org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80) at javax.servlet.http.HttpServlet.service(HttpServlet.java:847) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:295) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:832) at org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:620) at org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:553) at org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:482) at org.tuckey.web.filters.urlrewrite.NormalRewrittenUrl.doRewrite(NormalRewrittenUrl.java:213) at org.tuckey.web.filters.urlrewrite.RuleChain.handleRewrite(RuleChain.java:171) at org.tuckey.web.filters.urlrewrite.RuleChain.doRules(RuleChain.java:145) at org.tuckey.web.filters.urlrewrite.UrlRewriter.processRequest(UrlRewriter.java:92) at org.tuckey.web.filters.urlrewrite.UrlRewriteFilter.doFilter(UrlRewriteFilter.java:389) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:83) at org.jboss.seam.web.LoggingFilter.doFilter(LoggingFilter.java:60) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:73) at org.jboss.seam.web.ExceptionFilter.doFilter(ExceptionFilter.java:64) at org.jboss.seam.servlet.SeamFilter$FilterChainImpl.doFilter(SeamFilter.java:69) at org.jboss.seam.servlet.SeamFilter.doFilter(SeamFilter.java:158) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.zanata.seam.interceptor.MonitoringWrapper.doFilter(MonitoringWrapper.java:67) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.zanata.servlet.GWTCacheControlFilter.doFilter(GWTCacheControlFilter.java:61) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.zanata.servlet.MDCInsertingServletFilter.doFilter(MDCInsertingServletFilter.java:58) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:246) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:214) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:231) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:149) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) at org.jboss.as.jpa.interceptor.WebNonTxEmCloserValve.invoke(WebNonTxEmCloserValve.java:50) at org.jboss.security.negotiation.NegotiationAuthenticator$WrapperValve.invoke(NegotiationAuthenticator.java:491) at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:420) at org.jboss.as.web.security.SecurityContextAssociationValve.invoke(SecurityContextAssociationValve.java:169) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:145) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:97) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:102) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:856) at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:653) at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:926) at java.lang.Thread.run(Thread.java:745)

    JIRA | 1 year ago | Damian Jansen
    java.lang.IllegalArgumentException: Failure parsing MediaType string: text/html,application/xhtml+xml,application/xml
  3. 0

    Printing a PDF from JSF

    Oracle Community | 1 decade ago | 843842
    javax.portlet.PortletException
  4. Speed up your debug routine!

    Automated exception search integrated into your IDE

  5. 0

    PDF downloading from server in struts2

    Stack Overflow | 4 years ago | user2594235
    java.lang.IllegalArgumentException: application/pdf is not a supported mime type
  6. 0
    URI part of the request contains invalid characters. You may try to encode the path from the URI. Check RFC7230 and RFC3986 documentation below. https://www.ietf.org/rfc/rfc3986.txt and https://tools.ietf.org/html/rfc7230

    1 unregistered visitors
    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. java.lang.IllegalArgumentException

      Failure parsing MediaType string: application/xhtml+xml application/pdf

      at org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.parse()
    2. RESTEasy JAX-RS Implementation
      MediaTypeHeaderDelegate.fromString
      1. org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.parse(MediaTypeHeaderDelegate.java:42)
      2. org.jboss.resteasy.plugins.delegates.MediaTypeHeaderDelegate.fromString(MediaTypeHeaderDelegate.java:18)
      2 frames
    3. JavaEE 7
      MediaType.valueOf
      1. javax.ws.rs.core.MediaType.valueOf(MediaType.java:226)
      1 frame
    4. RESTEasy JAX-RS Implementation
      ServletUtil.extractHttpHeaders
      1. org.jboss.resteasy.util.MediaTypeHelper.parseHeader(MediaTypeHelper.java:204)
      2. org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractAccepts(ServletUtil.java:119)
      3. org.jboss.resteasy.plugins.server.servlet.ServletUtil.extractHttpHeaders(ServletUtil.java:82)
      3 frames
    5. org.jboss.seam
      SeamResourceServlet.service
      1. org.jboss.seam.resteasy.ResteasyResourceAdapter$1.process(ResteasyResourceAdapter.java:127)
      2. org.jboss.seam.servlet.ContextualHttpServletRequest.run(ContextualHttpServletRequest.java:53)
      3. org.jboss.seam.resteasy.ResteasyResourceAdapter.getResource(ResteasyResourceAdapter.java:121)
      4. org.jboss.seam.servlet.SeamResourceServlet.service(SeamResourceServlet.java:80)
      4 frames
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
      1 frame
    7. Glassfish Core
      ContainerBase.invoke
      1. org.apache.catalina.core.ApplicationFilterChain.servletService(ApplicationFilterChain.java:427)
      2. org.apache.catalina.core.ApplicationDispatcher.doInvoke(ApplicationDispatcher.java:875)
      3. org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:723)
      4. org.apache.catalina.core.ApplicationDispatcher.processRequest(ApplicationDispatcher.java:560)
      5. org.apache.catalina.core.ApplicationDispatcher.doForward(ApplicationDispatcher.java:490)
      6. org.apache.catalina.core.ApplicationDispatcher.forward(ApplicationDispatcher.java:382)
      7. org.apache.catalina.core.StandardHostValve.custom(StandardHostValve.java:549)
      8. org.apache.catalina.core.StandardHostValve.status(StandardHostValve.java:438)
      9. org.apache.catalina.core.StandardHostValve.postInvoke(StandardHostValve.java:249)
      10. org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:649)
      11. org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
      12. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
      13. org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
      14. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:166)
      15. org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:648)
      16. org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:593)
      17. org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:587)
      18. org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:1096)
      18 frames
    8. org.apache.coyote
      CoyoteAdapter.service
      1. org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:288)
      1 frame
    9. Glassfish Core
      DefaultReadTask.doTask
      1. com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.invokeAdapter(DefaultProcessorTask.java:647)
      2. com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.doProcess(DefaultProcessorTask.java:579)
      3. com.sun.enterprise.web.connector.grizzly.DefaultProcessorTask.process(DefaultProcessorTask.java:831)
      4. com.sun.enterprise.web.connector.grizzly.DefaultReadTask.executeProcessorTask(DefaultReadTask.java:341)
      5. com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:263)
      6. com.sun.enterprise.web.connector.grizzly.DefaultReadTask.doTask(DefaultReadTask.java:214)
      6 frames
    10. Grizzly HTTP
      PortUnificationPipeline$PUTask.doTask
      1. com.sun.enterprise.web.portunif.PortUnificationPipeline$PUTask.doTask(PortUnificationPipeline.java:380)
      1 frame
    11. Glassfish Core
      TaskBase.run
      1. com.sun.enterprise.web.connector.grizzly.TaskBase.run(TaskBase.java:265)
      1 frame
    12. Grizzly HTTP
      SSLWorkerThread.run
      1. com.sun.enterprise.web.connector.grizzly.ssl.SSLWorkerThread.run(SSLWorkerThread.java:106)
      1 frame