javax.ws.rs.WebApplicationException: java.lang.NullPointerException[\n]

Sakai JIRA | Kai St [X] | 7 years ago
tip
Your exception is missing from the Samebug knowledge base.
Here are the best solutions we found on the Internet.
Click on the to mark the helpful solution and get rewards for you help.
  1. 0

    if neither mediaType nor mimeType are provided and the datastream to be added is new, Fedora will throw a NPE because it tries to access the mime type of the nonexisting datastream. see: http://fisheye.fedora-commons.org/browse/FCREPO/trunk/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java?r=8493, line 389 Here is the log: - >> "POST /fedora/objects/changeme:1006/datastreams/FFFFF?versionable=true&controlGroup=R&dsLocation=http%3A%2F%2Flocalhost%3A8080 HTTP/1.1[EOL]" - >> "Accept: */*[EOL]" - >> "Content-Length: 0[EOL]" - >> "Host: localhost:8080[EOL]" - >> "Connection: Keep-Alive[EOL]" - >> "User-Agent: Apache-HttpClient/4.0 (java 1.5)[EOL]" - >> "Cookie: JSESSIONID=DA331916CEDC7FA7365C4071A052C51A[EOL]" - >> "Cookie2: $Version=1[EOL]" - >> "Authorization: Basic xxxx=[EOL]" - >> "Accept-Encoding: gzip,deflate[EOL]" - >> "[EOL]" - << "HTTP/1.1 500 Internal Server Error[EOL]" - << "Server: Apache-Coyote/1.1[EOL]" - << "Content-Type: text/plain[EOL]" - << "Transfer-Encoding: chunked[EOL]" - << "Date: Tue, 06 Apr 2010 14:40:39 GMT[EOL]" - << "Connection: close[EOL]" - << "[EOL]" 2010-04-06 16:40:39,260 DEBUG HTTPBuilder - Parsed data to instance of: class java.io.InputStreamReader - << "1167[EOL]" - << "javax.ws.rs.WebApplicationException: java.lang.NullPointerException[\n]" - << "[0x9]at org.fcrepo.server.rest.BaseRestResource.handleException(BaseRestResource.java:164)[\n]" - << "[0x9]at org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:480)[\n]" - << "[0x9]at org.fcrepo.server.rest.DatastreamResource.addDatastream(DatastreamResource.java:322)[\n]" - << "[0x9]at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)[\n]" - << "[0x9]at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[\n]" - << "[0x9]at java.lang.reflect.Method.invoke(Method.java:597)[\n]" - << "[0x9]at com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$ResponseOutInvoker._dispatch(EntityParamDispatchProvider.java:157)[\n]" - << "[0x9]at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)[\n]" - << "[0x9]at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)[\n]" - << "[0x9]at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)[\n]" - << "[0x9]at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)[\n]" - << "[0x9]at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)[\n]" - << "[0x9]at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:79)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[\n]" - << "[0x9]at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[\n]" - << "[0x9]at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)[\n]" - << "[0x9]at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)[\n]" - << "[0x9]at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[\n]" - << "[0x9]at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[\n]" - << "[0x9]at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)[\n]" - << "[0x9]at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)[\n]" - << "[0x9]at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)[\n]" - << "[0x9]at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)[\n]" - << "[0x9]at java.lang.Thread.run(Thread.java:637)[\n]" - << "Caused by: java.lang.NullPointerException[\n]" - << "[0x9]at org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:389)[\n]"

    Sakai JIRA | 7 years ago | Kai St [X]
    javax.ws.rs.WebApplicationException: java.lang.NullPointerException[\n]
  2. 0

    if neither mediaType nor mimeType are provided and the datastream to be added is new, Fedora will throw a NPE because it tries to access the mime type of the nonexisting datastream. see: http://fisheye.fedora-commons.org/browse/FCREPO/trunk/fcrepo-server/src/main/java/org/fcrepo/server/rest/DatastreamResource.java?r=8493, line 389 Here is the log: - >> "POST /fedora/objects/changeme:1006/datastreams/FFFFF?versionable=true&controlGroup=R&dsLocation=http%3A%2F%2Flocalhost%3A8080 HTTP/1.1[EOL]" - >> "Accept: */*[EOL]" - >> "Content-Length: 0[EOL]" - >> "Host: localhost:8080[EOL]" - >> "Connection: Keep-Alive[EOL]" - >> "User-Agent: Apache-HttpClient/4.0 (java 1.5)[EOL]" - >> "Cookie: JSESSIONID=DA331916CEDC7FA7365C4071A052C51A[EOL]" - >> "Cookie2: $Version=1[EOL]" - >> "Authorization: Basic xxxx=[EOL]" - >> "Accept-Encoding: gzip,deflate[EOL]" - >> "[EOL]" - << "HTTP/1.1 500 Internal Server Error[EOL]" - << "Server: Apache-Coyote/1.1[EOL]" - << "Content-Type: text/plain[EOL]" - << "Transfer-Encoding: chunked[EOL]" - << "Date: Tue, 06 Apr 2010 14:40:39 GMT[EOL]" - << "Connection: close[EOL]" - << "[EOL]" 2010-04-06 16:40:39,260 DEBUG HTTPBuilder - Parsed data to instance of: class java.io.InputStreamReader - << "1167[EOL]" - << "javax.ws.rs.WebApplicationException: java.lang.NullPointerException[\n]" - << "[0x9]at org.fcrepo.server.rest.BaseRestResource.handleException(BaseRestResource.java:164)[\n]" - << "[0x9]at org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:480)[\n]" - << "[0x9]at org.fcrepo.server.rest.DatastreamResource.addDatastream(DatastreamResource.java:322)[\n]" - << "[0x9]at sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)[\n]" - << "[0x9]at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[\n]" - << "[0x9]at java.lang.reflect.Method.invoke(Method.java:597)[\n]" - << "[0x9]at com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$ResponseOutInvoker._dispatch(EntityParamDispatchProvider.java:157)[\n]" - << "[0x9]at com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)[\n]" - << "[0x9]at com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)[\n]" - << "[0x9]at com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)[\n]" - << "[0x9]at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)[\n]" - << "[0x9]at com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)[\n]" - << "[0x9]at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)[\n]" - << "[0x9]at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:79)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]" - << "[0x9]at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]" - << "[0x9]at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[\n]" - << "[0x9]at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[\n]" - << "[0x9]at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)[\n]" - << "[0x9]at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)[\n]" - << "[0x9]at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[\n]" - << "[0x9]at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[\n]" - << "[0x9]at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)[\n]" - << "[0x9]at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)[\n]" - << "[0x9]at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)[\n]" - << "[0x9]at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)[\n]" - << "[0x9]at java.lang.Thread.run(Thread.java:637)[\n]" - << "Caused by: java.lang.NullPointerException[\n]" - << "[0x9]at org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:389)[\n]"

    Sakai JIRA | 7 years ago | Kai St [X]
    javax.ws.rs.WebApplicationException: java.lang.NullPointerException[\n]

    Root Cause Analysis

    1. javax.ws.rs.WebApplicationException

      java.lang.NullPointerException[\n]

      at org.fcrepo.server.rest.BaseRestResource.handleException()
    2. org.fcrepo.server
      DatastreamResource.addDatastream
      1. org.fcrepo.server.rest.BaseRestResource.handleException(BaseRestResource.java:164)[\n]
      2. org.fcrepo.server.rest.DatastreamResource.addOrUpdateDatastream(DatastreamResource.java:480)[\n]
      3. org.fcrepo.server.rest.DatastreamResource.addDatastream(DatastreamResource.java:322)[\n]
      3 frames
    3. Java RT
      Method.invoke
      1. sun.reflect.GeneratedMethodAccessor57.invoke(Unknown Source)[\n]
      2. sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)[\n]
      3. java.lang.reflect.Method.invoke(Method.java:597)[\n]
      3 frames
    4. Jersey
      WebApplicationImpl.handleRequest
      1. com.sun.jersey.server.impl.model.method.dispatch.EntityParamDispatchProvider$ResponseOutInvoker._dispatch(EntityParamDispatchProvider.java:157)[\n]
      2. com.sun.jersey.server.impl.model.method.dispatch.ResourceJavaMethodDispatcher.dispatch(ResourceJavaMethodDispatcher.java:67)[\n]
      3. com.sun.jersey.server.impl.uri.rules.HttpMethodRule.accept(HttpMethodRule.java:124)[\n]
      4. com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)[\n]
      5. com.sun.jersey.server.impl.uri.rules.ResourceClassRule.accept(ResourceClassRule.java:71)[\n]
      6. com.sun.jersey.server.impl.uri.rules.RightHandPathRule.accept(RightHandPathRule.java:111)[\n]
      7. com.sun.jersey.server.impl.uri.rules.RootResourceClassesRule.accept(RootResourceClassesRule.java:63)[\n]
      8. com.sun.jersey.server.impl.application.WebApplicationImpl._handleRequest(WebApplicationImpl.java:555)[\n]
      9. com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:514)[\n]
      10. com.sun.jersey.server.impl.application.WebApplicationImpl.handleRequest(WebApplicationImpl.java:505)[\n]
      10 frames
    5. Jersey
      ServletContainer.service
      1. com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:359)[\n]
      1 frame
    6. JavaServlet
      HttpServlet.service
      1. javax.servlet.http.HttpServlet.service(HttpServlet.java:717)[\n]
      1 frame
    7. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)[\n]
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]
      2 frames
    8. org.fcrepo.server
      FilterRestApiFlash.doFilter
      1. org.fcrepo.server.security.servletfilters.FilterRestApiFlash.doFilter(FilterRestApiFlash.java:79)[\n]
      1 frame
    9. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]
      2 frames
    10. org.fcrepo.server
      FilterSetup.doFilter
      1. org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]
      1 frame
    11. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]
      2 frames
    12. org.fcrepo.server
      FilterSetup.doFilter
      1. org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]
      1 frame
    13. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]
      2 frames
    14. org.fcrepo.server
      FilterSetup.doFilter
      1. org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]
      1 frame
    15. Glassfish Core
      ApplicationFilterChain.doFilter
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]
      2 frames
    16. org.fcrepo.server
      FilterSetup.doFilter
      1. org.fcrepo.server.security.servletfilters.FilterSetup.doFilter(FilterSetup.java:235)[\n]
      1 frame
    17. Glassfish Core
      CoyoteAdapter.service
      1. org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)[\n]
      2. org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)[\n]
      3. org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)[\n]
      4. org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)[\n]
      5. org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:525)[\n]
      6. org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)[\n]
      7. org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)[\n]
      8. org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)[\n]
      9. org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)[\n]
      9 frames
    18. Grizzly HTTP
      JIoEndpoint$Worker.run
      1. org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:849)[\n]
      2. org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)[\n]
      3. org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:454)[\n]
      3 frames