glassfish
  1. glassfish
  2. GLASSFISH-11873

Re-deployment failure for Atmosphere sample

    Details

    • Type: Bug Bug
    • Status: Resolved
    • Priority: Critical Critical
    • Resolution: Incomplete
    • Affects Version/s: V3
    • Fix Version/s: 3.1
    • Component/s: web_container
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: Macintosh

    • Issuezilla Id:
      11,873

      Description

      Re-deployment fails for a simple Atmosphere sample.

      The sample requires Jersey 1.1.5.1 and uses class loader delegation set to false
      to override the version, 1.1.4.1, of Jersey used in GlassFish.

      When first deploying the sample it works fine. On subsequent redeployment it
      always fails (see stack trace below). NetBeans was used to deploy and redeploy.
      It is necessary to restart GlassFish.

      I think this is a class loading error with GlassFish on redeployment.

      SEVERE: com.sun.jersey.api.container.ContainerException: Unable to create resource
      at
      com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:136)
      at
      com.sun.jersey.server.impl.model.ResourceClass.init(ResourceClass.java:206)
      at
      com.sun.jersey.server.impl.model.ResourceClass.init(ResourceClass.java:201)
      at
      com.sun.jersey.server.impl.application.WebApplicationImpl.getResourceClass(WebApplicationImpl.java:460)
      at
      com.sun.jersey.server.impl.application.WebApplicationImpl.initWadlResource(WebApplicationImpl.java:1224)
      at
      com.sun.jersey.server.impl.application.WebApplicationImpl.processRootResources(WebApplicationImpl.java:1194)
      at
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:912)
      at
      com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:589)
      at
      com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:403)
      at
      com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:252)
      at
      com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:550)
      at
      com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:201)
      at
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:307)
      at
      com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:470)
      at javax.servlet.GenericServlet.init(GenericServlet.java:242)
      at
      org.atmosphere.util.AtmosphereFilterChain.init(AtmosphereFilterChain.java:112)
      at
      org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.init(ReflectorServletProcessor.java:249)
      at
      org.atmosphere.handler.ReflectorServletProcessor.init(ReflectorServletProcessor.java:146)
      at
      org.atmosphere.cpr.AtmosphereServlet.initAtmosphereServletProcessor(AtmosphereServlet.java:733)
      at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:535)
      at
      org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
      at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1230)
      at
      org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:4934)
      at org.apache.catalina.core.StandardContext.start(StandardContext.java:5207)
      at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
      at
      org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
      at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
      at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1933)
      at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1605)
      at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
      at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
      at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
      at
      org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
      at
      com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
      at
      com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
      at
      org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
      at
      com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
      at
      com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
      at
      com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
      at
      com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
      at
      com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
      at
      com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
      at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
      at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
      at
      com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
      at
      com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
      at
      com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
      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:637)
      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:177)
      at
      com.sun.jersey.server.spi.component.ResourceComponentConstructor.construct(ResourceComponentConstructor.java:159)
      at
      com.sun.jersey.server.impl.resource.SingletonFactory$Singleton.init(SingletonFactory.java:134)
      ... 61 more
      Caused by: java.lang.NullPointerException
      at
      com.sun.jersey.core.impl.provider.header.WriterUtil.appendQuotedMediaType(WriterUtil.java:56)
      at
      com.sun.jersey.core.impl.provider.header.MediaTypeProvider.toString(MediaTypeProvider.java:65)
      at
      com.sun.jersey.core.impl.provider.header.MediaTypeProvider.toString(MediaTypeProvider.java:50)
      at javax.ws.rs.core.MediaType.toString(MediaType.java:265)
      at
      com.sun.jersey.server.wadl.WadlGeneratorImpl.createResponseRepresentation(WadlGeneratorImpl.java:188)
      at
      com.sun.jersey.server.wadl.WadlGeneratorImpl.createResponse(WadlGeneratorImpl.java:175)
      at
      com.sun.jersey.server.wadl.WadlBuilder.generateResponse(WadlBuilder.java:356)
      at
      com.sun.jersey.server.wadl.WadlBuilder.generateMethod(WadlBuilder.java:160)
      at
      com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:271)
      at
      com.sun.jersey.server.wadl.WadlBuilder.generateResource(WadlBuilder.java:254)
      at com.sun.jersey.server.wadl.WadlBuilder.generate(WadlBuilder.java:102)
      at
      com.sun.jersey.server.impl.wadl.WadlApplicationContextImpl.getApplication(WadlApplicationContextImpl.java:73)
      at com.sun.jersey.server.impl.wadl.WadlResource.<init>(WadlResource.java:73)
      ... 68 more

        Activity

        Hide
        Shing Wai Chan added a comment -

        I have discussed with Paul. We need to add the following
        a) in pom.xml
        <repositories>
        <repository>
        <id>oss.sonatype.org</id>
        <url>http://oss.sonatype.org</url>
        </repository>
        <repository>
        <id>oss.sonatype.org-snapshot</id>
        <url>http://oss.sonatype.org/content/repositories/snapshots</url>
        </repository>
        <repository>
        <id>scala-tools.org</id>
        <name>Scala-Tools Maven2 Repository</name>
        <url>http://scala-tools.org/repo-releases</url>
        </repository>
        <repository>
        <id>jboss</id>
        <url>http://repository.jboss.org/maven2</url>
        </repository>
        <repository>
        <id>codehaus</id>
        <name>repository.codehaus.org</name>
        <url>http://repository.codehaus.org</url>
        </repository>
        <repository>
        <id>glassfish</id>
        <name>GlassFish Repository</name>
        <url>http://maven.glassfish.org/content/groups/glassfish</url>
        </repository>
        </repositories>

        b) in web.xml
        <init-param>
        <param-name>com.sun.jersey.config.property.packages</param-name>
        <param-value>org.atmosphere.samples.pubsub</param-value>
        </init-param>

        After these changes, I can see the error mentioned above during redeployment.
        But in fact, we have an exception in the "first" deployment even we deployed
        without error.

        [#|2010-06-14T15:51:22.154-0700|SEVERE|glassfish3.0.1|com.sun.jersey.core.spi.component.ProviderFactory|_ThreadID=24;_ThreadName=Thread-1;|The
        provider class, class com.sun.jersey.multipart.impl.MultiPartReader, could not
        be instantiated. Processing will continue but the class will not be utilized
        java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is
        not present. Have you registered the MultiPartConfigProvider class?
        at com.sun.jersey.multipart.impl.MultiPartReader.<init>(MultiPartReader.java:100)
        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.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:161)
        at
        com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:141)
        at
        com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:163)
        at
        com.sun.jersey.core.spi.component.ProviderFactory._getComponentProvider(ProviderFactory.java:156)
        at
        com.sun.jersey.core.spi.component.ioc.IoCProviderFactory._getComponentProvider(IoCProviderFactory.java:90)
        at
        com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:150)
        at
        com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:128)
        at
        com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:232)
        at
        com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServices(ProviderServices.java:149)
        at
        com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:153)
        at
        com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:145)
        at
        com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:907)
        at
        com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:589)
        at
        com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:429)
        at
        com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:278)
        at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:566)
        at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:211)
        at
        com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:333)
        at
        com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:497)
        at javax.servlet.GenericServlet.init(GenericServlet.java:242)
        at org.atmosphere.util.AtmosphereFilterChain.init(AtmosphereFilterChain.java:109)
        at
        org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.init(ReflectorServletProcessor.java:248)
        at
        org.atmosphere.handler.ReflectorServletProcessor.init(ReflectorServletProcessor.java:145)
        at
        org.atmosphere.cpr.AtmosphereServlet.initAtmosphereServletProcessor(AtmosphereServlet.java:758)
        at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:534)
        at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428)
        at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1230)
        at
        org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5007)
        at org.apache.catalina.core.StandardContext.start(StandardContext.java:5280)
        at com.sun.enterprise.web.WebModule.start(WebModule.java:499)
        at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928)
        at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912)
        at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947)
        at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619)
        at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90)
        at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126)
        at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241)
        at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236)
        at
        com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339)
        at
        com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183)
        at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272)
        at
        com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305)
        at
        com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320)
        at
        com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176)
        at
        com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83)
        at
        com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235)
        at
        com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224)
        at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365)
        at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204)
        at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166)
        at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100)
        at
        com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245)
        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:637)

        Show
        Shing Wai Chan added a comment - I have discussed with Paul. We need to add the following a) in pom.xml <repositories> <repository> <id>oss.sonatype.org</id> <url> http://oss.sonatype.org </url> </repository> <repository> <id>oss.sonatype.org-snapshot</id> <url> http://oss.sonatype.org/content/repositories/snapshots </url> </repository> <repository> <id>scala-tools.org</id> <name>Scala-Tools Maven2 Repository</name> <url> http://scala-tools.org/repo-releases </url> </repository> <repository> <id>jboss</id> <url> http://repository.jboss.org/maven2 </url> </repository> <repository> <id>codehaus</id> <name>repository.codehaus.org</name> <url> http://repository.codehaus.org </url> </repository> <repository> <id>glassfish</id> <name>GlassFish Repository</name> <url> http://maven.glassfish.org/content/groups/glassfish </url> </repository> </repositories> b) in web.xml <init-param> <param-name>com.sun.jersey.config.property.packages</param-name> <param-value>org.atmosphere.samples.pubsub</param-value> </init-param> After these changes, I can see the error mentioned above during redeployment. But in fact, we have an exception in the "first" deployment even we deployed without error. [#|2010-06-14T15:51:22.154-0700|SEVERE|glassfish3.0.1|com.sun.jersey.core.spi.component.ProviderFactory|_ThreadID=24;_ThreadName=Thread-1;|The provider class, class com.sun.jersey.multipart.impl.MultiPartReader, could not be instantiated. Processing will continue but the class will not be utilized java.lang.IllegalArgumentException: The MultiPartConfig instance we expected is not present. Have you registered the MultiPartConfigProvider class? at com.sun.jersey.multipart.impl.MultiPartReader.<init>(MultiPartReader.java:100) 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.core.spi.component.ComponentConstructor._getInstance(ComponentConstructor.java:161) at com.sun.jersey.core.spi.component.ComponentConstructor.getInstance(ComponentConstructor.java:141) at com.sun.jersey.core.spi.component.ProviderFactory.__getComponentProvider(ProviderFactory.java:163) at com.sun.jersey.core.spi.component.ProviderFactory._getComponentProvider(ProviderFactory.java:156) at com.sun.jersey.core.spi.component.ioc.IoCProviderFactory._getComponentProvider(IoCProviderFactory.java:90) at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:150) at com.sun.jersey.core.spi.component.ProviderFactory.getComponentProvider(ProviderFactory.java:128) at com.sun.jersey.core.spi.component.ProviderServices.getComponent(ProviderServices.java:232) at com.sun.jersey.core.spi.component.ProviderServices.getProvidersAndServices(ProviderServices.java:149) at com.sun.jersey.core.spi.factory.MessageBodyFactory.initReaders(MessageBodyFactory.java:153) at com.sun.jersey.core.spi.factory.MessageBodyFactory.init(MessageBodyFactory.java:145) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:907) at com.sun.jersey.server.impl.application.WebApplicationImpl.initiate(WebApplicationImpl.java:589) at com.sun.jersey.spi.container.servlet.ServletContainer.initiate(ServletContainer.java:429) at com.sun.jersey.spi.container.servlet.ServletContainer$InternalWebComponent.initiate(ServletContainer.java:278) at com.sun.jersey.spi.container.servlet.WebComponent.load(WebComponent.java:566) at com.sun.jersey.spi.container.servlet.WebComponent.init(WebComponent.java:211) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:333) at com.sun.jersey.spi.container.servlet.ServletContainer.init(ServletContainer.java:497) at javax.servlet.GenericServlet.init(GenericServlet.java:242) at org.atmosphere.util.AtmosphereFilterChain.init(AtmosphereFilterChain.java:109) at org.atmosphere.handler.ReflectorServletProcessor$FilterChainServletWrapper.init(ReflectorServletProcessor.java:248) at org.atmosphere.handler.ReflectorServletProcessor.init(ReflectorServletProcessor.java:145) at org.atmosphere.cpr.AtmosphereServlet.initAtmosphereServletProcessor(AtmosphereServlet.java:758) at org.atmosphere.cpr.AtmosphereServlet.init(AtmosphereServlet.java:534) at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1428) at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1230) at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:5007) at org.apache.catalina.core.StandardContext.start(StandardContext.java:5280) at com.sun.enterprise.web.WebModule.start(WebModule.java:499) at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:928) at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:912) at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:694) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1947) at com.sun.enterprise.web.WebContainer.loadWebModule(WebContainer.java:1619) at com.sun.enterprise.web.WebApplication.start(WebApplication.java:90) at org.glassfish.internal.data.EngineRef.start(EngineRef.java:126) at org.glassfish.internal.data.ModuleInfo.start(ModuleInfo.java:241) at org.glassfish.internal.data.ApplicationInfo.start(ApplicationInfo.java:236) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:339) at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:183) at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:272) at com.sun.enterprise.v3.admin.CommandRunnerImpl$1.execute(CommandRunnerImpl.java:305) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:320) at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1176) at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$900(CommandRunnerImpl.java:83) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1235) at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1224) at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:365) at com.sun.enterprise.v3.admin.AdminAdapter.service(AdminAdapter.java:204) at com.sun.grizzly.tcp.http11.GrizzlyAdapter.service(GrizzlyAdapter.java:166) at com.sun.enterprise.v3.server.HK2Dispatcher.dispath(HK2Dispatcher.java:100) at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:245) 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:637)
        Hide
        sandoz added a comment -

        The first exception is expected. It is related to known classloading behavior
        when class loader delegation is set to false (Jersey is loading a component from
        the Jersey jar distributed in GF that uses a different class loader to that of
        the web app class loader).

        The line number for the code i previously presented was incorrect it should be
        line 56 (not 65):

        http://fisheye4.atlassian.com/browse/jersey/tags/jersey-1.1.4.1/jersey/jersey-core/src/main/java/com/sun/jersey/core/impl/provider/header/WriterUtil.java?r=HEAD#l56

        public static void appendQuotedIfWhiteSpaceOrQuote(StringBuilder b, String
        value)

        { if (value==null) return; Matcher m = whitespaceOrQuote.matcher(value); // line 56 boolean quote = m.find(); if (quote) b.append('"'); appendEscapingQuotes(b, value); if (quote) b.append('"'); }
        Show
        sandoz added a comment - The first exception is expected. It is related to known classloading behavior when class loader delegation is set to false (Jersey is loading a component from the Jersey jar distributed in GF that uses a different class loader to that of the web app class loader). The line number for the code i previously presented was incorrect it should be line 56 (not 65): http://fisheye4.atlassian.com/browse/jersey/tags/jersey-1.1.4.1/jersey/jersey-core/src/main/java/com/sun/jersey/core/impl/provider/header/WriterUtil.java?r=HEAD#l56 public static void appendQuotedIfWhiteSpaceOrQuote(StringBuilder b, String value) { if (value==null) return; Matcher m = whitespaceOrQuote.matcher(value); // line 56 boolean quote = m.find(); if (quote) b.append('"'); appendEscapingQuotes(b, value); if (quote) b.append('"'); }
        Hide
        Shing Wai Chan added a comment -

        Per discussion with Paul, including the following in pom.xml will resolve the error:
        <dependency>
        <groupId>com.sun.jersey.contribs</groupId>
        <artifactId>jersey-multipart</artifactId>
        <version>$

        {jersey-version}

        </version>
        </dependency>

        After this, I can deploy without error and then see the exception as described
        in the above.
        The following is my analysis:
        1. javax.ws.rs.core.MediaType has a static reference delegate of type
        HeaderDelegate<MediaType>.
        In the deployment time, it is a class
        com.sun.jersey.core.impl.provider.header.MediaTypeProvider.
        which will invoke com.sun.jersey.core.impl.provider.header.WriterUtil.

        2. Note that all the classes are in GlassFish modules/.jar and WEB-INF/lib/.jar

        3. For javax, we will only load from modules/*.jar.
        So, the one bundled in WEB-INF/lib/*.jar will be ignored.
        (It is a spec requirement that those jars cannot be replaced.
        So, the war file is not valid.)

        4. Since delegate=false in this case, MediaTypeProvider will be loaded by web
        app class loader.
        Note that it is referenced by MediaType as in (1).

        5. During undeployment time, the WriterUtil are static fields are clear explicitly.

        6. When the war is deployed again, delegate still holds all the references that
        they need
        and the classes will not be loaded again. Because of (5), we see the NPE there.

        Show
        Shing Wai Chan added a comment - Per discussion with Paul, including the following in pom.xml will resolve the error: <dependency> <groupId>com.sun.jersey.contribs</groupId> <artifactId>jersey-multipart</artifactId> <version>$ {jersey-version} </version> </dependency> After this, I can deploy without error and then see the exception as described in the above. The following is my analysis: 1. javax.ws.rs.core.MediaType has a static reference delegate of type HeaderDelegate<MediaType>. In the deployment time, it is a class com.sun.jersey.core.impl.provider.header.MediaTypeProvider. which will invoke com.sun.jersey.core.impl.provider.header.WriterUtil. 2. Note that all the classes are in GlassFish modules/ .jar and WEB-INF/lib/ .jar 3. For javax, we will only load from modules/*.jar. So, the one bundled in WEB-INF/lib/*.jar will be ignored. (It is a spec requirement that those jars cannot be replaced. So, the war file is not valid.) 4. Since delegate=false in this case, MediaTypeProvider will be loaded by web app class loader. Note that it is referenced by MediaType as in (1). 5. During undeployment time, the WriterUtil are static fields are clear explicitly. 6. When the war is deployed again, delegate still holds all the references that they need and the classes will not be loaded again. Because of (5), we see the NPE there.
        Hide
        sandoz added a comment -

        Thanks for the excellent detective work!

        The problem arises when one declares a media type with parameters, such as:

        @Produces("text/plain;charset=UTF-8")

        I think because of the way the JAX-RS API is defined and implementations
        registered we are stuck and may require a GlassFish feature enabling the web app
        to inform GlassFish not to delegate to the javax.ws.rs.* classes.

        Show
        sandoz added a comment - Thanks for the excellent detective work! The problem arises when one declares a media type with parameters, such as: @Produces("text/plain;charset=UTF-8") I think because of the way the JAX-RS API is defined and implementations registered we are stuck and may require a GlassFish feature enabling the web app to inform GlassFish not to delegate to the javax.ws.rs.* classes.
        Hide
        Shing Wai Chan added a comment -

        Per discussion with the submitter, from the above investigation, we will close
        the issue as this is not a GlassFish issue.

        Show
        Shing Wai Chan added a comment - Per discussion with the submitter, from the above investigation, we will close the issue as this is not a GlassFish issue.

          People

          • Assignee:
            Shing Wai Chan
            Reporter:
            sandoz
          • Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: