jersey
  1. jersey
  2. JERSEY-660

NPE in com.sun.jersey.core.impl.provider.header.WriterUtil.appendQuotedIfWhiteSpaceOrQuote(WriterUtil.java:59)

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Major Major
    • Resolution: Won't Fix
    • Affects Version/s: 1.5
    • Fix Version/s: 1.18
    • Component/s: core
    • Labels:
      None
    • Environment:

      Netbeans 6.9.1
      Glassfish 3.0.1

      Description

      This issue is 100% reproducible on my end, but I don't have a minimal testcase for it. I can probably produce one if you really need it.

      Repro steps:

      1. Deploy webapp
      2. Jersey launches okay
      3. Modify webapp, compile and redeploy it
      4. Jersey throws the following exception:

      com.sun.jersey.api.container.ContainerException: Unable to create resource
      at com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:139)
      at com.sun.jersey.server.impl.application.WebApplicationImpl$9.f(WebApplicationImpl.java:540)
      at com.sun.jersey.server.impl.application.WebApplicationImpl$9.f(WebApplicationImpl.java:538)
      at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.getResourceComponentProvider(WebApplicationImpl.java:538)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.initiateResource(WebApplicationImpl.java:613)
      at com.sun.jersey.server.impl.application.RootResourceUriRules.initWadlResource(RootResourceUriRules.java:215)
      at com.sun.jersey.server.impl.application.RootResourceUriRules.<init>(RootResourceUriRules.java:193)
      at com.sun.jersey.server.impl.application.WebApplicationImpl._initiate(WebApplicationImpl.java:1184)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.access$600(WebApplicationImpl.java:159)
      at com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebApplicationImpl.java:700)
      at com.sun.jersey.server.impl.application.WebApplicationImpl$12.f(WebApplicationImpl.java:697)
      at com.sun.jersey.spi.inject.Errors.processWithErrors(Errors.java:193)
      at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:697)
      at com.sun.jersey.guice.spi.container.servlet.GuiceContainer.initiate(GuiceContainer.java:118)
      at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:318)
      at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:606)
      at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:213)
      at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:373)
      at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:556)
      at javax.servlet.GenericServlet.init(GenericServlet.java:242)
      at com.google.inject.servlet.ServletDefinition.init(ServletDefinition.java:83)
      at com.google.inject.servlet.ManagedServletPipeline.init(ManagedServletPipeline.java:84)
      at com.google.inject.servlet.ManagedFilterPipeline.initPipeline(ManagedFilterPipeline.java:106)
      at com.google.inject.servlet.GuiceFilter.init(GuiceFilter.java:168)
      at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:259)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:215)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:277)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:188)
      at org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:641)
      at com.sun.enterprise.web.WebPipeline.invoke(WebPipeline.java:97)
      at com.sun.enterprise.web.PESessionLockingStandardPipeline.invoke(PESessionLockingStandardPipeline.java:85)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:185)
      at org.apache.catalina.connector.CoyoteAdapter.doService(CoyoteAdapter.java:325)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:226)
      at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:165)
      at com.sun.grizzly.http.ProcessorTask.invokeAdapter(ProcessorTask.java:791)
      at com.sun.grizzly.http.ProcessorTask.doProcess(ProcessorTask.java:693)
      at com.sun.grizzly.http.ProcessorTask.process(ProcessorTask.java:954)
      at com.sun.grizzly.http.DefaultProtocolFilter.execute(DefaultProtocolFilter.java:170)
      at com.sun.grizzly.DefaultProtocolChain.executeProtocolFilter(DefaultProtocolChain.java:135)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:102)
      at com.sun.grizzly.DefaultProtocolChain.execute(DefaultProtocolChain.java:88)
      at com.sun.grizzly.http.HttpProtocolChain.execute(HttpProtocolChain.java:76)
      at com.sun.grizzly.ProtocolChainContextTask.doCall(ProtocolChainContextTask.java:53)
      at com.sun.grizzly.SelectionKeyContextTask.call(SelectionKeyContextTask.java:57)
      at com.sun.grizzly.ContextTask.run(ContextTask.java:69)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:330)
      at com.sun.grizzly.util.AbstractThreadPool$Worker.run(AbstractThreadPool.java:309)
      at java.lang.Thread.run(Thread.java:662)
      Caused by: java.lang.reflect.InvocationTargetException
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
      at com.sun.jersey.server.spi.component.ResourceComponentConstructor._construct(ResourceComponentConstructor.java:200)
      at com.sun.jersey.server.spi.component.ResourceComponentConstructor.construct(ResourceComponentConstructor.java:182)
      at com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:137)
      ... 50 more
      Caused by: java.lang.NullPointerException
      at com.sun.jersey.core.impl.provider.header.WriterUtil.appendQuotedIfWhiteSpaceOrQuote(WriterUtil.java:59)
      at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.toString(MediaTypeProvider.java:68)
      at com.sun.jersey.core.impl.provider.header.MediaTypeProvider.toString(MediaTypeProvider.java:53)
      at javax.ws.rs.core.MediaType.toString(MediaType.java:265)
      at com.sun.jersey.server.wadl.WadlGeneratorImpl.createResponseRepresentation(WadlGeneratorImpl.java:206)
      at com.sun.jersey.server.wadl.WadlGeneratorImpl.createResponse(WadlGeneratorImpl.java:193)
      at com.sun.jersey.server.wadl.WadlBuilder.generateResponse(WadlBuilder.java:397)
      at com.sun.jersey.server.wadl.WadlBuilder.generateMethod(WadlBuilder.java:166)
      at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:308)
      at com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:271)
      at com.sun.jersey.server.wadl.WadlBuilder.generate(WadlBuilder.java:107)
      at com.sun.jersey.server.impl.wadl.WadlApplicationContextImpl.getApplication(WadlApplicationContextImpl.java:76)
      at com.sun.jersey.server.impl.wadl.WadlResource.<init>(WadlResource.java:76)
      ... 57 more

      Workaround: Restart Glassfish every time the webapp is modified.

        Issue Links

          Activity

            People

            • Assignee:
              Michal Gajdos
              Reporter:
              cowwoc
            • 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:
                0m
                Logged:
                Time Not Required
                1m