glassfish
  1. glassfish
  2. GLASSFISH-20579

cannot deploy war with google guava lib

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Blocker Blocker
    • Resolution: Works as designed
    • Affects Version/s: 4.0_b85
    • Fix Version/s: None
    • Component/s: cdi
    • Labels:
      None

      Description

      My war contains

      WEB-INF/lib/guava-14.0.jar
      

      and NO beans.xml. But it seems CDI is being enabled.. and trying to do something with a class inside the guava-14.0.jar that contains a @Singleton annotation.

      Why is CDI being enabled without a beans.xml?

      [2013-05-23T15:08:32.159-0700] [glassfish 4.0] [INFO] [] [org.jboss.weld.Version] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346912159] [levelValue: 800] [[
        WELD-000900 2.0.0 (CR2)]]
      
      [2013-05-23T15:08:34.987-0700] [glassfish 4.0] [WARNING] [] [org.jboss.weld.interceptor.util.InterceptionTypeRegistry] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346914987] [levelValue: 900] [[
        Class 'javax.ejb.PostActivate' not found, interception based on it is not enabled]]
      
      [2013-05-23T15:08:34.988-0700] [glassfish 4.0] [WARNING] [] [org.jboss.weld.interceptor.util.InterceptionTypeRegistry] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346914988] [levelValue: 900] [[
        Class 'javax.ejb.PrePassivate' not found, interception based on it is not enabled]]
      
      [2013-05-23T15:08:35.617-0700] [glassfish 4.0] [WARNING] [] [org.jboss.weld.Bootstrap] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346915617] [levelValue: 900] [[
        WELD-001473 javax.enterprise.inject.spi.Bean implementation org.glassfish.jms.injection.JMSCDIExtension$LocalBean@626186cf declared a normal scope but does not implement javax.enterprise.inject.spi.PassivationCapable. It won't be possible to inject this bean into a bean with passivating scope (@SessionScoped, @ConversationScoped). This can be fixed by assigning the Bean implementation a unique id by implementing the PassivationCapable interface.]]
      
      [2013-05-23T15:08:35.645-0700] [glassfish 4.0] [SEVERE] [NCLS-CORE-00026] [javax.enterprise.system.core] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346915645] [levelValue: 1000] [[
        Exception during lifecycle processing
      org.glassfish.deployment.common.DeploymentException: CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]
      	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
      	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
      	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:356)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      	at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396)
      	at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
      	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
      	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:217)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:231)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:227)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:275)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:257)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:227)
      	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:191)
      	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:819)
      	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:325)
      	at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:161)
      	at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:722)
      Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]
      	at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
      	at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:325)
      	at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:177)
      	at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:208)
      	at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:519)
      	at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:505)
      	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:480)
      	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
      	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
      	... 58 more
      ]]
      
      [2013-05-23T15:08:35.648-0700] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346915648] [levelValue: 1000] [[
        Exception while loading the app]]
      
      [2013-05-23T15:08:35.649-0700] [glassfish 4.0] [SEVERE] [AS-WEB-GLUE-00192] [javax.enterprise.web] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346915649] [levelValue: 1000] [[
        Undeployment failed for context ]]
      
      [2013-05-23T15:08:35.664-0700] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=34 _ThreadName=admin-listener(2)] [timeMillis: 1369346915664] [levelValue: 1000] [[
        Exception while loading the app : CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]
      org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Set<Service>] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set<Service>)]
      	at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
      	at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:325)
      	at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:177)
      	at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:208)
      	at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:519)
      	at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:505)
      	at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:480)
      	at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
      	at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
      	at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
      	at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
      	at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
      	at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
      	at java.security.AccessController.doPrivileged(Native Method)
      	at javax.security.auth.Subject.doAs(Subject.java:356)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
      	at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
      	at org.glassfish.admin.rest.resources.admin.CommandResource.executeCommand(CommandResource.java:396)
      	at org.glassfish.admin.rest.resources.admin.CommandResource.execCommandSimpInMultOut(CommandResource.java:234)
      	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
      	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.lang.reflect.Method.invoke(Method.java:601)
      	at org.glassfish.jersey.server.model.internal.ResourceMethodInvocationHandlerFactory$1.invoke(ResourceMethodInvocationHandlerFactory.java:81)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.invoke(AbstractJavaResourceMethodDispatcher.java:125)
      	at org.glassfish.jersey.server.model.internal.JavaResourceMethodDispatcherProvider$ResponseOutInvoker.doDispatch(JavaResourceMethodDispatcherProvider.java:152)
      	at org.glassfish.jersey.server.model.internal.AbstractJavaResourceMethodDispatcher.dispatch(AbstractJavaResourceMethodDispatcher.java:91)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:346)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:341)
      	at org.glassfish.jersey.server.model.ResourceMethodInvoker.apply(ResourceMethodInvoker.java:101)
      	at org.glassfish.jersey.server.ServerRuntime$1.run(ServerRuntime.java:217)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:231)
      	at org.glassfish.jersey.internal.Errors$1.call(Errors.java:227)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:275)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:257)
      	at org.glassfish.jersey.internal.Errors.process(Errors.java:227)
      	at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
      	at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:191)
      	at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:819)
      	at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:325)
      	at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:161)
      	at org.glassfish.admin.rest.adapter.RestAdapter.service(RestAdapter.java:181)
      	at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
      	at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
      	at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
      	at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
      	at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
      	at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
      	at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
      	at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
      	at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
      	at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
      	at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
      	at java.lang.Thread.run(Thread.java:722)
      ]]
      
      

        Activity

        Hide
        aaronjwhiteside added a comment -
        Show
        aaronjwhiteside added a comment - Tested on the latest nightly build, the issue still appears.. Below is the class in question. http://code.google.com/p/guava-libraries/source/browse/guava/src/com/google/common/util/concurrent/ServiceManager.java?r=824719231c4358700e669014a86987dea7341e3e
        Hide
        jjsnyder83 added a comment -

        As per spec implicit CDI is enabled by default. To turn it off do the following

        asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=false

        Show
        jjsnyder83 added a comment - As per spec implicit CDI is enabled by default. To turn it off do the following asadmin set configs.config.server-config.cdi-service.enable-implicit-cdi=false
        Hide
        aaronjwhiteside added a comment -

        That sounds almost absurd (not blaming you personally).

        There must be a way to specify to CDI what to scan and what not to scan. Enabling it by default without a way to control what is decides to scan and what it doesn't is going to cause a lot of issues with a lot of libraries.

        Show
        aaronjwhiteside added a comment - That sounds almost absurd (not blaming you personally). There must be a way to specify to CDI what to scan and what not to scan. Enabling it by default without a way to control what is decides to scan and what it doesn't is going to cause a lot of issues with a lot of libraries.
        Hide
        jjsnyder83 added a comment -

        We are working on enhancing this right now for GlassFish so that you can specify exactly which archives should not be processed by CDI (as per spec.) Keep an eye on https://java.net/jira/browse/GLASSFISH-20483.

        Show
        jjsnyder83 added a comment - We are working on enhancing this right now for GlassFish so that you can specify exactly which archives should not be processed by CDI (as per spec.) Keep an eye on https://java.net/jira/browse/GLASSFISH-20483 .
        Hide
        aaronjwhiteside added a comment - - edited

        http://docs.jboss.org/weld/reference/latest/en-US/html/configure.html this does not seem to work.

        If Glassfish is using WELD shouldn't this work?

        my beans.xml contains:

        <?xml version="1.0" encoding="UTF-8"?>
        <beans xmlns="http://java.sun.com/xml/ns/javaee"
               xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
               xmlns:weld="http://jboss.org/schema/weld/beans"
               xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd
                                   http://jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd">
        
            <weld:scan>
                <weld:exclude name="com.google.**"/>
            </weld:scan>
        </beans>
        
        Show
        aaronjwhiteside added a comment - - edited http://docs.jboss.org/weld/reference/latest/en-US/html/configure.html this does not seem to work. If Glassfish is using WELD shouldn't this work? my beans.xml contains: <?xml version= "1.0" encoding= "UTF-8" ?> <beans xmlns= "http: //java.sun.com/xml/ns/javaee" xmlns:xsi= "http: //www.w3.org/2001/XMLSchema-instance" xmlns:weld= "http: //jboss.org/schema/weld/beans" xsi:schemaLocation="http: //java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/beans_1_0.xsd http: //jboss.org/schema/weld/beans http://jboss.org/schema/weld/beans_1_1.xsd"> <weld:scan> <weld:exclude name= "com.google.**" /> </weld:scan> </beans>
        Hide
        phil.zampino added a comment -

        If you were to add a beans.xml, with the cited exclude config, to the guava jar, then you should see the behavior you're expecting.

        Assuming that you don't want to modify the guava archive, I think you'll find the following asadmin deployment property to be useful:

        --property implicitCdiEnabled=false

        (Example: asadmin deploy --property implicitCdiEnabled=false <archive>)

        This property will force the CDI 1.0 behavior wrt implicit bean discovery for the archive being deployed, rather than the aforementioned server-wide configuration.

        Show
        phil.zampino added a comment - If you were to add a beans.xml, with the cited exclude config, to the guava jar, then you should see the behavior you're expecting. Assuming that you don't want to modify the guava archive, I think you'll find the following asadmin deployment property to be useful: --property implicitCdiEnabled=false (Example: asadmin deploy --property implicitCdiEnabled=false <archive>) This property will force the CDI 1.0 behavior wrt implicit bean discovery for the archive being deployed, rather than the aforementioned server-wide configuration.

          People

          • Assignee:
            jjsnyder83
            Reporter:
            aaronjwhiteside
          • Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: