Quick Fix: Solving org.glassfish.deployment.common.DeploymentException: CDI deployment failure – Cassandra Datastax Java Driver, Maven, Glassfish 4

I have posted this on stackoverflow.com, but I’m posting this here for other readers and myself as a reference just in case anybody bump into this issue. This as a short solution/workaround for those who encounters error in using Datastax’s Java Driver on Glassfish 4 through Maven deployment.

As was written on Datastax’s web site, the dependency of the driver is:

 XML |  copy code |? 
1
<dependency>
2
    <groupId>com.datastax.cassandra</groupId>
3
    <artifactId>cassandra-driver-core</artifactId>
4
    <version>1.0.1</version>
5
</dependency>

Unfortunately, if you deploy this to Glassfish 4 (at the time of writting, it is Glassfish 4.0) through Maven, it will throw org.glassfish.deployment.common.DeploymentException: CDI deployment failure…just like the below:

 Text |  copy code |? 
01
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>)]
02
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:225)
03
at org.glassfish.kernel.event.EventsImpl.send(EventsImpl.java:131)
04
at org.glassfish.internal.data.ApplicationInfo.load(ApplicationInfo.java:328)
05
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:493)
06
at com.sun.enterprise.v3.server.ApplicationLifecycle.deploy(ApplicationLifecycle.java:219)
07
at org.glassfish.deployment.admin.DeployCommand.execute(DeployCommand.java:491)
08
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:527)
09
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2$1.run(CommandRunnerImpl.java:523)
10
at java.security.AccessController.doPrivileged(Native Method)
11
at javax.security.auth.Subject.doAs(Subject.java:356)
12
at com.sun.enterprise.v3.admin.CommandRunnerImpl$2.execute(CommandRunnerImpl.java:522)
13
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:546)
14
at com.sun.enterprise.v3.admin.CommandRunnerImpl.doCommand(CommandRunnerImpl.java:1423)
15
at com.sun.enterprise.v3.admin.CommandRunnerImpl.access$1500(CommandRunnerImpl.java:108)
16
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1762)
17
at com.sun.enterprise.v3.admin.CommandRunnerImpl$ExecutionContext.execute(CommandRunnerImpl.java:1674)
18
at com.sun.enterprise.v3.admin.AdminAdapter.doCommand(AdminAdapter.java:534)
19
at com.sun.enterprise.v3.admin.AdminAdapter.onMissingResource(AdminAdapter.java:224)
20
at org.glassfish.grizzly.http.server.StaticHttpHandler.service(StaticHttpHandler.java:297)
21
at com.sun.enterprise.v3.services.impl.ContainerMapper.service(ContainerMapper.java:246)
22
at org.glassfish.grizzly.http.server.HttpHandler.runService(HttpHandler.java:191)
23
at org.glassfish.grizzly.http.server.HttpHandler.doHandle(HttpHandler.java:168)
24
at org.glassfish.grizzly.http.server.HttpServerFilter.handleRead(HttpServerFilter.java:189)
25
at org.glassfish.grizzly.filterchain.ExecutorResolver$9.execute(ExecutorResolver.java:119)
26
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeFilter(DefaultFilterChain.java:288)
27
at org.glassfish.grizzly.filterchain.DefaultFilterChain.executeChainPart(DefaultFilterChain.java:206)
28
at org.glassfish.grizzly.filterchain.DefaultFilterChain.execute(DefaultFilterChain.java:136)
29
at org.glassfish.grizzly.filterchain.DefaultFilterChain.process(DefaultFilterChain.java:114)
30
at org.glassfish.grizzly.ProcessorExecutor.execute(ProcessorExecutor.java:77)
31
at org.glassfish.grizzly.nio.transport.TCPNIOTransport.fireIOEvent(TCPNIOTransport.java:838)
32
at org.glassfish.grizzly.strategies.AbstractIOStrategy.fireIOEvent(AbstractIOStrategy.java:113)
33
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.run0(WorkerThreadIOStrategy.java:115)
34
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy.access$100(WorkerThreadIOStrategy.java:55)
35
at org.glassfish.grizzly.strategies.WorkerThreadIOStrategy$WorkerThreadRunnable.run(WorkerThreadIOStrategy.java:135)
36
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.doWork(AbstractThreadPool.java:564)
37
at org.glassfish.grizzly.threadpool.AbstractThreadPool$Worker.run(AbstractThreadPool.java:544)
38
at java.lang.Thread.run(Thread.java:724)
39
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>)]
40
at org.jboss.weld.bootstrap.Validator.validateInjectionPointForDeploymentProblems(Validator.java:403)
41
at org.jboss.weld.bootstrap.Validator.validateInjectionPoint(Validator.java:325)
42
at org.jboss.weld.bootstrap.Validator.validateGeneralBean(Validator.java:177)
43
at org.jboss.weld.bootstrap.Validator.validateRIBean(Validator.java:208)
44
at org.jboss.weld.bootstrap.Validator.validateBean(Validator.java:519)
45
at org.jboss.weld.bootstrap.Validator.validateBeans(Validator.java:505)
46
at org.jboss.weld.bootstrap.Validator.validateDeployment(Validator.java:480)
47
at org.jboss.weld.bootstrap.WeldBootstrap.validateBeans(WeldBootstrap.java:536)
48
at org.glassfish.weld.WeldDeployer.event(WeldDeployer.java:216)
49
... 36 more
50
]]

Anyway, the error seems to be caused by a conflict with Google’s Guava library, which somehow is part of the dependency of Datastax’s Cassandra Java Drievr. So, what I did was just exclude the Guava library as part of the dependency like the below and the application worked fine:

 XML |  copy code |? 
01
<dependency>
02
    <groupId>com.datastax.cassandra</groupId>
03
    <artifactId>cassandra-driver-core</artifactId>
04
    <version>1.0.1</version>
05
    <exclusions>
06
        <exclusion>
07
            <groupId>com.google.guava</groupId>
08
            <artifactId>guava</artifactId>
09
        </exclusion>
10
    </exclusions>
11
</dependency>

Hope you find this useful.

Max Lam

Born and currently resides in Malaysia, a seasoned Java developer whom had held positions as Senior Developer, Consultant and Technical Architect in various enterprise software development companies.

Facebook Twitter LinkedIn Google+ 

Previous Posts

Building and Deploying Java EE EAR with Maven to Java EE Application Server (Part 2) – Where to put your source codes and pom.xml (EJB, MDB, Web & Enterprise Application Client)
Building and Deploying Java EE EAR with Maven to Java EE Application Server (Part 1) – Project Directory Structure & Module Generation Through archetype:generate

Building and Deploying Java EE EAR with Maven to Java EE Application Server (Part 1) - Project Directory Structure & Module Generation Through archetype:generate

December 1st, 2012

Maven wasn’t very popular and wide used when it was first released, but after version 2, it had ga[...]

Java LDAP/JNDI: 2 Ways Of Decoding And Using The objectGUID From Windows Active Directory

Java LDAP/JNDI: 2 Ways Of Decoding And Using The objectGUID From Windows Active Directory

October 13th, 2012

Windows Active Directory is a good way for many corporations to be used as a means of user managemen[...]

Quick Note: Unable To Perform LDAP Wildcard “*” Search On Windows Active Directory

Quick Note: Unable To Perform LDAP Wildcard "*" Search On Windows Active Directory

October 9th, 2012

In case you are searching high and low for a solution or an answer to why Windows Active Directory d[...]

Java JNDI/LDAP: Windows Active Directory Authentication, Organizational Unit, Group & Other Information Access

Java JNDI/LDAP: Windows Active Directory Authentication, Organizational Unit, Group & Other Information Access

October 4th, 2012

In today's IT environment, most mid-size corporation and above will have some form of centralized em[...]

MySQL Cluster NDB 7.2 on Solaris 10 Part 3 – Testing The Cluster

MySQL Cluster NDB 7.2 on Solaris 10 Part 3 - Testing The Cluster

September 22nd, 2012

We are back again to have fun with our cluster that we've setup written in our previous articles on [...]

MySQL Cluster NDB 7.2 on Solaris 10 Part 2 – Starting, Distributed Synchronized Users Management And Stopping The Cluster

MySQL Cluster NDB 7.2 on Solaris 10 Part 2 - Starting, Distributed Synchronized Users Management And Stopping The Cluster

September 18th, 2012

This is the continuation from the previous part of the tutorial MySQL Cluster NDB 7.2 on Solaris 10 [...]

MySQL Cluster NDB 7.2 on Solaris 10 Part 1 – How To Install, Setup and Configure

MySQL Cluster NDB 7.2 on Solaris 10 Part 1 - How To Install, Setup and Configure

September 18th, 2012

If you have landed on this page, we believe you might either had a bumpy ride in getting the MySQL c[...]

Quick Fix: How to Solve “Unable to read the logging configuration” on Netbeans7 with JBoss6

Quick Fix: How to Solve "Unable to read the logging configuration" on Netbeans7 with JBoss6

September 8th, 2012

This is just a quick fix post for those whom are having this problem when running JBoss 6.x with Net[...]