jersey
  1. jersey
  2. JERSEY-921

NPE occurs when access to the resource path has resource or provider initialized failed.

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Cannot Reproduce
    • Affects Version/s: 1.8
    • Fix Version/s: 2.0-m07, 2.0
    • Component/s: core
    • Labels:
      None

      Description

      NPE occurs when access to the resource path has resource or provider initialized failed.
      Following stack trace when NPE occured.

      java.lang.NullPointerException
      java.lang.NullPointerException
              at com.sun.jersey.spi.container.ContainerRequest.<init>(ContainerRequest.java:187)
              at com.sun.jersey.spi.container.servlet.WebComponent.createRequest(WebComponent.java:450)
              at com.sun.jersey.spi.container.servlet.WebComponent.service(WebComponent.java:380)
              at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:537)
              at com.sun.jersey.spi.container.servlet.ServletContainer.service(ServletContainer.java:699)
              at javax.servlet.http.HttpServlet.service(HttpServlet.java:847)
              at org.apache.catalina.core.StandardWrapper.service(StandardWrapper.java:1539)
              at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:281)
              at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:175)
              at org.apache.catalina.core.StandardPipeline.doInvoke(StandardPipeline.java:655)
              at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:595)
              at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:98)
              at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:91)
              at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:162)
              at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:330)
              at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:231)
              at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:174)
              at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:828)
              at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:725)
              at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:1019)
              at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:225)
              at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:137)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:104)
              at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:90)
              at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:79)
              at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:54)
              at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:59)
              at com.sun.grizzly.ContextTask.run(ContextTask.java:71)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:532)
              at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:513)
              at java.lang.Thread.run(Thread.java:662)
      

      Following sources is initialization code of Jersey.
      When an exception occurs in the following sources *1, but not processed *2, consequently NPE occurs in *3.

      com.sun.jersey.spi.container.servlet.WebComponent
          public void load() {
              WebApplication _application = create();
              configure(config, resourceConfig, _application);
      *1      initiate(resourceConfig, _application);
      *2      application = _application;
          }
      
      com.sun.jersey.spi.container.ContainerRequest
          public ContainerRequest(
                  WebApplication wa,
                  String method,
                  URI baseUri,
                  URI requestUri,
                  InBoundHeaders headers,
                  InputStream entity) {
              this.wa = wa;
      *3      this.isTraceEnabled = wa.isTracingEnabled();
              this.method = method;
              this.baseUri = baseUri;
              this.requestUri = requestUri;
              this.headers = headers;
              this.headersModCount = headers.getModCount();
              this.entity = entity;
          }
      

        Activity

        Hide
        Jakub Podlesak added a comment -

        Could you please attach a reproducible test case, or at least provide some steps to reproduce?

        Show
        Jakub Podlesak added a comment - Could you please attach a reproducible test case, or at least provide some steps to reproduce?
        Hide
        Jakub Podlesak added a comment -

        Reproduced with JERSEY-881 reproducible test case. Setting fixed version to 2.0 to align with that one.

        Show
        Jakub Podlesak added a comment - Reproduced with JERSEY-881 reproducible test case. Setting fixed version to 2.0 to align with that one.
        Hide
        Michal Gajdos added a comment -

        This problem does not occur in Jersey2 so closing as 'Cannot Reproduce'.
        If you need this fixed in Jersey1 feel free to reopen the issue.

        Show
        Michal Gajdos added a comment - This problem does not occur in Jersey2 so closing as 'Cannot Reproduce'. If you need this fixed in Jersey1 feel free to reopen the issue.

          People

          • Assignee:
            Michal Gajdos
            Reporter:
            hosamu
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved:

              Time Tracking

              Estimated:
              Original Estimate - 3 hours
              3h
              Remaining:
              Remaining Estimate - 0 minutes
              0m
              Logged:
              Time Spent - 30 minutes Time Not Required
              30m