GlassFish 4.0 CDI deployment failure + Apache Spark

1.1k views Asked by At

I'm trying to deploy maven application to GlassFish 4.0 on Eclipse using Java 8 and maven-glassfish-plugin. Simplified version of the application has only 1 resteasy service, and maven dependencies. From the moment I add Apache Spark dependency, application can't be deployed anymore, and the error message is:

     [2015-06-08T19:40:18.575-0700] [glassfish 4.0] [SEVERE] [] [javax.enterprise.system.core] [tid: _ThreadID=33 _ThreadName=admin-listener(1)] [timeMillis: 1433817618575] [levelValue: 1000] [[
  Exception while loading the app : CDI deployment failure:WELD-001408 Unsatisfied dependencies for type [Injector] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public com.sun.jersey.guice.spi.container.servlet.GuiceContainer(Injector)]
org.jboss.weld.exceptions.DeploymentException: WELD-001408 Unsatisfied dependencies for type [Injector] with qualifiers [@Default] at injection point [[BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject public com.sun.jersey.guice.spi.container.servlet.GuiceContainer(Injector)]
    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:360)
    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:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:497)
    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:224)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:271)
    at org.glassfish.jersey.internal.Errors$1.call(Errors.java:267)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:315)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:297)
    at org.glassfish.jersey.internal.Errors.process(Errors.java:267)
    at org.glassfish.jersey.process.internal.RequestScope.runInScope(RequestScope.java:317)
    at org.glassfish.jersey.server.ServerRuntime.process(ServerRuntime.java:198)
    at org.glassfish.jersey.server.ApplicationHandler.handle(ApplicationHandler.java:946)
    at org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpContainer.service(GrizzlyHttpContainer.java:331)
    at org.glassfish.admin.rest.adapter.JerseyContainerCommandService$3.service(JerseyContainerCommandService.java:165)
    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:745)
]]

I tried to exclude google guava from apache spark dependency,

<dependency>
        <groupId>org.apache.spark</groupId>
        <artifactId>spark-core_2.11</artifactId>
        <version>1.3.1</version>
        <exclusions>
        <exclusion>
                <groupId>com.google.guava</groupId>
                <artifactId>guava</artifactId>
        </exclusion>
        </exclusions>
    </dependency>

but the problem persist with injection of another class:

[ERROR] remote failure: Error occurred during deployment: 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 org.spark-project.guava.util.concurrent.ServiceManager(Set<Service>)]. Please see server.log for more details.

My maven dependency tree looks like:

    --- maven-dependency-plugin:2.1:tree (default-cli) @ test ---                                                                                                               
org.test.rest:test:war:0.0.1-SNAPSHOT                                                                                                                                       
+- org.jboss.resteasy:resteasy-json-p-provider:jar:3.0.9.Final:compile                                                                                                      
|  +- javax.json:javax.json-api:jar:1.0:compile                                                                                                                             
|  \- org.glassfish:javax.json:jar:1.0.3:compile                                                                                                                            
+- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.9.Final:compile                                                                                                                
|  +- org.jboss.resteasy:jaxrs-api:jar:3.0.9.Final:compile                                                                                                                  
|  +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.1_spec:jar:1.0.1.Final:compile
|  +- javax.activation:activation:jar:1.1:compile
|  +- org.apache.httpcomponents:httpclient:jar:4.2.6:compile
|  |  +- org.apache.httpcomponents:httpcore:jar:4.2.5:compile
|  |  +- commons-logging:commons-logging:jar:1.1.1:compile
|  |  \- commons-codec:commons-codec:jar:1.6:compile
|  +- commons-io:commons-io:jar:2.1:compile
|  \- net.jcip:jcip-annotations:jar:1.0:compile
+- org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.9.Final:compile
|  +- org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
|  +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.12:compile
|  +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.12:compile
|  \- org.codehaus.jackson:jackson-xc:jar:1.9.12:compile
+- log4j:log4j:jar:1.2.17:compile
+- javax.servlet:javax.servlet-api:jar:3.1.0:provided (scope not updated to compile)
+- org.apache.kafka:kafka_2.11:jar:0.8.2.0:compile
|  +- org.apache.kafka:kafka-clients:jar:0.8.2.0:compile
|  +- org.scala-lang.modules:scala-xml_2.11:jar:1.0.2:compile
|  +- org.scala-lang.modules:scala-parser-combinators_2.11:jar:1.0.2:compile
|  \- org.scala-lang:scala-library:jar:2.11.5:compile
+- com.yammer.dropwizard:dropwizard-core:jar:0.6.2:compile
|  +- com.yammer.metrics:metrics-servlet:jar:2.2.0:compile
|  +- com.yammer.metrics:metrics-jetty:jar:2.2.0:compile
|  +- com.yammer.metrics:metrics-logback:jar:2.2.0:compile
|  +- com.yammer.metrics:metrics-jersey:jar:2.2.0:compile
|  +- com.fasterxml.jackson.core:jackson-databind:jar:2.1.4:compile
|  |  +- com.fasterxml.jackson.core:jackson-annotations:jar:2.1.4:compile
|  |  \- com.fasterxml.jackson.core:jackson-core:jar:2.1.4:compile
|  +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.1.4:compile
|  |  \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.1.4:compile
|  +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.1.4:compile
|  +- com.fasterxml.jackson.datatype:jackson-datatype-guava:jar:2.1.2:compile
|  +- net.sourceforge.argparse4j:argparse4j:jar:0.4.0:compile
|  +- org.slf4j:jul-to-slf4j:jar:1.7.4:compile
|  +- ch.qos.logback:logback-core:jar:1.0.10:compile
|  +- ch.qos.logback:logback-classic:jar:1.0.10:compile
|  +- org.eclipse.jetty:jetty-server:jar:8.1.10.v20130312:compile
|  |  \- org.eclipse.jetty:jetty-continuation:jar:8.1.10.v20130312:compile
|  +- org.eclipse.jetty:jetty-servlet:jar:8.1.10.v20130312:compile
|  |  \- org.eclipse.jetty:jetty-security:jar:8.1.10.v20130312:compile
|  +- org.eclipse.jetty:jetty-http:jar:8.1.10.v20130312:compile
|  |  \- org.eclipse.jetty:jetty-io:jar:8.1.10.v20130312:compile
|  |     \- org.eclipse.jetty:jetty-util:jar:8.1.10.v20130312:compile
|  +- com.google.code.findbugs:jsr305:jar:2.0.1:compile
|  +- org.hibernate:hibernate-validator:jar:4.3.1.Final:compile
|  |  +- javax.validation:validation-api:jar:1.0.0.GA:compile
|  |  \- org.jboss.logging:jboss-logging:jar:3.1.0.CR2:compile
|  +- joda-time:joda-time:jar:2.2:compile
|  \- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.1.2:compile
+- com.101tec:zkclient:jar:0.3:compile
+- org.apache.zookeeper:zookeeper:jar:3.3.4:compile
|  \- jline:jline:jar:0.9.94:compile
+- com.yammer.metrics:metrics-annotation:jar:2.2.0:compile
+- com.yammer.metrics:metrics-core:jar:2.2.0:compile
+- junit:junit:jar:4.11:test (scope not updated to compile)
|  \- org.hamcrest:hamcrest-core:jar:1.3:test
+- net.sf.jopt-simple:jopt-simple:jar:3.2:compile
+- org.easymock:easymock:jar:3.0:compile
|  \- cglib:cglib-nodep:jar:2.2:compile
+- org.objenesis:objenesis:jar:1.2:compile
+- com.rabbitmq:amqp-client:jar:3.3.5:compile
+- org.apache.logging.log4j.adapters:log4j-to-slf4j:jar:2.0-beta4:compile
|  \- org.apache.logging.log4j:log4j-api:jar:2.0-beta4:compile
+- org.slf4j:slf4j-api:jar:1.7.10:compile
+- com.datastax.cassandra:cassandra-driver-core:jar:2.1.4:compile
|  \- com.codahale.metrics:metrics-core:jar:3.0.2:compile
+- com.googlecode.json-simple:json-simple:jar:1.1:compile
+- com.google.code.gson:gson:jar:2.2.2:compile
+- org.simpleframework:simple-xml:jar:2.7.1:compile
|  +- stax:stax-api:jar:1.0.1:compile
|  +- stax:stax:jar:1.2.0:compile
|  \- xpp3:xpp3:jar:1.1.3.3:compile
+- org.apache.commons:commons-lang3:jar:3.3.2:compile
+- mysql:mysql-connector-java:jar:5.1.19:compile
\- org.apache.spark:spark-core_2.11:jar:1.3.1:compile
   +- com.twitter:chill_2.11:jar:0.5.0:compile
   |  \- com.esotericsoftware.kryo:kryo:jar:2.21:compile
   |     +- com.esotericsoftware.reflectasm:reflectasm:jar:shaded:1.07:compile
   |     \- com.esotericsoftware.minlog:minlog:jar:1.2:compile
   +- com.twitter:chill-java:jar:0.5.0:compile
   +- org.apache.hadoop:hadoop-client:jar:2.2.0:compile
   |  +- org.apache.hadoop:hadoop-common:jar:2.2.0:compile
   |  |  +- commons-cli:commons-cli:jar:1.2:compile
   |  |  +- org.apache.commons:commons-math:jar:2.1:compile
   |  |  +- xmlenc:xmlenc:jar:0.52:compile
   |  |  +- commons-lang:commons-lang:jar:2.5:compile
   |  |  +- commons-configuration:commons-configuration:jar:1.6:compile
   |  |  |  +- commons-collections:commons-collections:jar:3.2.1:compile
   |  |  |  +- commons-digester:commons-digester:jar:1.8:compile
   |  |  |  |  \- commons-beanutils:commons-beanutils:jar:1.7.0:compile
   |  |  |  \- commons-beanutils:commons-beanutils-core:jar:1.8.0:compile
   |  |  +- org.apache.avro:avro:jar:1.7.4:compile
   |  |  +- com.google.protobuf:protobuf-java:jar:2.5.0:compile
   |  |  +- org.apache.hadoop:hadoop-auth:jar:2.2.0:compile
   |  |  \- org.apache.commons:commons-compress:jar:1.4.1:compile
   |  |     \- org.tukaani:xz:jar:1.0:compile
   |  +- org.apache.hadoop:hadoop-hdfs:jar:2.2.0:compile
   |  |  \- org.mortbay.jetty:jetty-util:jar:6.1.26:compile
   |  +- org.apache.hadoop:hadoop-mapreduce-client-app:jar:2.2.0:compile
   |  |  +- org.apache.hadoop:hadoop-mapreduce-client-common:jar:2.2.0:compile
   |  |  |  +- org.apache.hadoop:hadoop-yarn-client:jar:2.2.0:compile
   |  |  |  \- org.apache.hadoop:hadoop-yarn-server-common:jar:2.2.0:compile
   |  |  \- org.apache.hadoop:hadoop-mapreduce-client-shuffle:jar:2.2.0:compile
   |  +- org.apache.hadoop:hadoop-yarn-api:jar:2.2.0:compile
   |  +- org.apache.hadoop:hadoop-mapreduce-client-core:jar:2.2.0:compile
   |  |  \- org.apache.hadoop:hadoop-yarn-common:jar:2.2.0:compile
   |  +- org.apache.hadoop:hadoop-mapreduce-client-jobclient:jar:2.2.0:compile
   |  \- org.apache.hadoop:hadoop-annotations:jar:2.2.0:compile
   +- org.apache.spark:spark-network-common_2.11:jar:1.3.1:compile
   +- org.apache.spark:spark-network-shuffle_2.11:jar:1.3.1:compile
   +- net.java.dev.jets3t:jets3t:jar:0.7.1:compile
   |  \- commons-httpclient:commons-httpclient:jar:3.1:compile
   +- org.apache.curator:curator-recipes:jar:2.4.0:compile
   |  +- org.apache.curator:curator-framework:jar:2.4.0:compile
   |  |  \- org.apache.curator:curator-client:jar:2.4.0:compile
   |  \- com.google.guava:guava:jar:14.0.1:compile
   +- org.eclipse.jetty.orbit:javax.servlet:jar:3.0.0.v201112011016:compile
   +- org.apache.commons:commons-math3:jar:3.1.1:compile
   +- org.slf4j:jcl-over-slf4j:jar:1.7.10:compile
   +- org.slf4j:slf4j-log4j12:jar:1.7.10:compile
   +- com.ning:compress-lzf:jar:1.0.0:compile
   +- org.xerial.snappy:snappy-java:jar:1.1.1.6:compile
   +- net.jpountz.lz4:lz4:jar:1.2.0:compile
   +- org.roaringbitmap:RoaringBitmap:jar:0.4.5:compile
   +- commons-net:commons-net:jar:2.2:compile
   +- org.spark-project.akka:akka-remote_2.11:jar:2.3.4-spark:compile
   |  +- org.spark-project.akka:akka-actor_2.11:jar:2.3.4-spark:compile
   |  |  \- com.typesafe:config:jar:1.2.1:compile
   |  +- io.netty:netty:jar:3.8.0.Final:compile
   |  +- org.spark-project.protobuf:protobuf-java:jar:2.5.0-spark:compile
   |  \- org.uncommons.maths:uncommons-maths:jar:1.2.2a:compile
   +- org.spark-project.akka:akka-slf4j_2.11:jar:2.3.4-spark:compile
   +- org.json4s:json4s-jackson_2.11:jar:3.2.10:compile
   |  \- org.json4s:json4s-core_2.11:jar:3.2.10:compile
   |     +- org.json4s:json4s-ast_2.11:jar:3.2.10:compile
   |     \- org.scala-lang:scalap:jar:2.11.0:compile
   |        \- org.scala-lang:scala-compiler:jar:2.11.0:compile
   +- org.apache.mesos:mesos:jar:shaded-protobuf:0.21.0:compile
   +- io.netty:netty-all:jar:4.0.23.Final:compile
   +- com.clearspring.analytics:stream:jar:2.7.0:compile
   +- io.dropwizard.metrics:metrics-core:jar:3.1.0:compile
   +- io.dropwizard.metrics:metrics-jvm:jar:3.1.0:compile
   +- io.dropwizard.metrics:metrics-json:jar:3.1.0:compile
   +- io.dropwizard.metrics:metrics-graphite:jar:3.1.0:compile
   +- com.fasterxml.jackson.module:jackson-module-scala_2.11:jar:2.4.4:compile
   |  +- org.scala-lang:scala-reflect:jar:2.11.2:compile
   |  \- com.thoughtworks.paranamer:paranamer:jar:2.6:compile
   +- org.apache.ivy:ivy:jar:2.4.0:compile
   +- oro:oro:jar:2.0.8:compile
   +- org.tachyonproject:tachyon-client:jar:0.5.0:compile
   |  \- org.tachyonproject:tachyon:jar:0.5.0:compile
   +- org.spark-project:pyrolite:jar:2.0.1:compile
   +- net.sf.py4j:py4j:jar:0.8.2.1:compile
   \- org.spark-project.spark:unused:jar:1.0.0:compile

I already tried all possible solutions that I found across the web, but nothing worked for me. Does anyone have idea what should be the problem and how to solve it?

Thanks, Zoran

1

There are 1 answers

0
anhdv On

I also have similar problems.
In my investigation, the cause by libraries spark-network-common_2.10-1.5.0.jar.
the name of the library directory is the "spark-apache" not valid for package name.
In this folder contains guava google library, its version 14.0.1, guava also defective CDI - you can refer here: https://github.com/google/guava/issues/1433 Summary, I fixed this bug by exclusion spark-network-common_2.10 by maven. please notify me if you have other way :(.
sorry if my english is not enough good.