Is it possible to make Guava work on Java 8 and Wildfly?

1,085 views
Skip to first unread message

federic...@gmail.com

unread,
Jun 19, 2014, 4:22:34 PM6/19/14
to guava-...@googlegroups.com

Hello guys, we have a application built on Java 7 and running on JBoss 7.1, and we want to migrate it to Java 8 and Wildfly (Jboss 8.1).

My code compiles but when I deploy it to Wildfly I go Guava errors:

Caused by: org.jboss.weld.exceptions.DeploymentException: WELD-001408: Unsatisfied dependencies for type Set with qualifiers @Default at injection point [BackedAnnotatedParameter] Parameter 1 of [BackedAnnotatedConstructor] @Inject com.google.common.util.concurrent.ServiceManager(Set) at com.google.common.util.concurrent.ServiceManager.(ServiceManager.java:0)

This ServiceManager class belongs to Google Guava. I have tried Guava 17, 16 and 15 and the problem still persists.

Does anybody know how to solve this conflict?

Thanks a lot in advance.

Regards,


Colin Decker

unread,
Jun 19, 2014, 4:35:25 PM6/19/14
to federic...@gmail.com, guava-...@googlegroups.com
Answered your StackOverflow question: http://stackoverflow.com/questions/24313370/guava-conflict-with-jboss-8-wildfly-and-java-8/24315782#24315782
--
--
guava-...@googlegroups.com
Project site: http://guava-libraries.googlecode.com
This group: http://groups.google.com/group/guava-discuss
 
This list is for general discussion.
To report an issue: http://code.google.com/p/guava-libraries/issues/entry
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/cddb7fa4-ee7c-4c53-9081-a82e8e15b2f1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Luke Sandberg

unread,
Jun 19, 2014, 4:35:55 PM6/19/14
to federic...@gmail.com, guava-...@googlegroups.com
The @Inject and @Singleton annotations were removed from ServiceManager back in december due to this issue with jboss.  So the latest release should not have them.  Are you sure you don't have more than one copy of guava on your classpath?


Federico Piazza

unread,
Jun 19, 2014, 5:21:51 PM6/19/14
to Luke Sandberg, guava-...@googlegroups.com
Thank for the response.

This is very weird since my pom.xml I have:
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>17.0</version>
        </dependency>

But I've checked on Wildfly deployment directory what jar were there and actually found two:
guava-15.0-cdi1.0.jar
guava-17.0.jar

So, definitely you were right. I'm wondering why and how this strange guava-15.0-cdi1.0 jar is there.

Any though?

Thank a lot for giving me a hand.



Christian Gruber

unread,
Jun 19, 2014, 5:31:15 PM6/19/14
to Federico Piazza, Luke Sandberg, guava-...@googlegroups.com
Try running

"mvn dependency:tree"

It'll show you the tree of dependencies and show you the path to the
stray dep.

Christian.
>>> <https://groups.google.com/d/msgid/guava-discuss/cddb7fa4-ee7c-4c53-9081-a82e8e15b2f1%40googlegroups.com?utm_medium=email&utm_source=footer>
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>>
>
> --
> --
> guava-...@googlegroups.com
> Project site: http://guava-libraries.googlecode.com
> This group: http://groups.google.com/group/guava-discuss
>
> This list is for general discussion.
> To report an issue:
> http://code.google.com/p/guava-libraries/issues/entry
> To get help: http://stackoverflow.com/questions/ask?tags=guava
> ---
> You received this message because you are subscribed to the Google
> Groups "guava-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to guava-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/guava-discuss/CALTwF%2BVTqDci-iy2FzDr-SYwvOA22unQdeuTag87xV2XNJHAEg%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.


Christian Gruber :: Google, Inc. :: Java Core Libraries :: Dependency
Injection
email: cgr...@google.com :::: mobile: +1 (646) 807-9839

Colin Decker

unread,
Jun 19, 2014, 5:32:17 PM6/19/14
to Federico Piazza, Luke Sandberg, guava-...@googlegroups.com
I don't know why/how guava-15.0-cdi1.0.jar was there, but it was a special version of Guava 15.0 that we released to work around the fact that a change we made to make Guava work with CDI 1.1 had the unintended effect of making it not work with CDI 1.0. Guava 16.0 and on have no issue with either version of CDI.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/CALTwF%2BVTqDci-iy2FzDr-SYwvOA22unQdeuTag87xV2XNJHAEg%40mail.gmail.com.

Federico Piazza

unread,
Jun 19, 2014, 5:57:18 PM6/19/14
to Christian Gruber, Luke Sandberg, guava-...@googlegroups.com
Christian,

thanks that was very useful and showed where that strange guava-15.0-cdi1.0.jar appeared from.

The dependency is:
$ mvn dependency:tree
...
[INFO] +- Engine:common:jar:1.0.0-SNAPSHOT:compile
[INFO] |  +- com.sun.xml.ws:jaxws-tools:jar:2.1.5:compile
[INFO] |  |  \- com.sun.xml.bind:jaxb-xjc:jar:2.1.9:compile
[INFO] |  \- com.google.guava:guava:jar:cdi1.0:15.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 minutes 23 seconds
[INFO] Finished at: Thu Jun 19 15:40:07 CST 2014
[INFO] Final Memory: 39M/345M
[INFO] ------------------------------------------------------------------------

So, it seems the problem comes from jaxws-tools:jar:2.1.5. It seems to be a very old jar.

I'll try compiling the old project with a newer version of jaxws-tools to see what happen.

I'll really appreciate any opinion from you on this topic.

Thanks again.


--
--
guava-...@googlegroups.com
Project site: http://guava-libraries.googlecode.com
This group: http://groups.google.com/group/guava-discuss

This list is for general discussion.
To report an issue: http://code.google.com/p/guava-libraries/issues/entry
To get help: http://stackoverflow.com/questions/ask?tags=guava
---
You received this message because you are subscribed to the Google Groups "guava-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email to guava-discuss+unsubscribe@googlegroups.com.

Jens

unread,
Jun 19, 2014, 6:28:16 PM6/19/14
to guava-...@googlegroups.com, cgr...@google.com, lu...@google.com, federic...@gmail.com
[INFO] +- Engine:common:jar:1.0.0-SNAPSHOT:compile
[INFO] |  +- com.sun.xml.ws:jaxws-tools:jar:2.1.5:compile
[INFO] |  |  \- com.sun.xml.bind:jaxb-xjc:jar:2.1.9:compile
[INFO] |  \- com.google.guava:guava:jar:cdi1.0:15.0:compile
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESSFUL
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3 minutes 23 seconds
[INFO] Finished at: Thu Jun 19 15:40:07 CST 2014
[INFO] Final Memory: 39M/345M
[INFO] ------------------------------------------------------------------------

So, it seems the problem comes from jaxws-tools:jar:2.1.5. It seems to be a very old jar.

It is not jaxws-tools. It's common.jar:1.0.0-SNAPSHOT that depends on Guava 15 CDI.

-- J.

Federico Piazza

unread,
Jun 19, 2014, 6:48:11 PM6/19/14
to Jens, guava-...@googlegroups.com, Christian Gruber, Luke Sandberg
Thanks Jens to point that.

After some time struggling with this I'm seeing pink elephants flying on the office.

Thanks again for the help.

Joachim Durchholz

unread,
Jun 20, 2014, 4:37:50 AM6/20/14
to guava-...@googlegroups.com
Am 19.06.2014 23:56, schrieb Federico Piazza:
> [INFO] +- Engine:common:jar:1.0.0-SNAPSHOT:compile
> [INFO] | +- com.sun.xml.ws:jaxws-tools:jar:2.1.5:compile
> [INFO] | | \- com.sun.xml.bind:jaxb-xjc:jar:2.1.9:compile
> [INFO] | \- com.google.guava:*guava:jar:cdi1.0:15.0*:compile

common:jar:1.0.0-SNAPSHOT depends on
com.google.guava:*guava:jar:cdi1.0:15.0* (I'll name it guava-cdi from
now on).

Reading
https://code.google.com/p/google-web-toolkit/issues/detail?id=8590 , I
suspect that guava-cdi is a fork of Guava 15.0 that serves to fix the
incompatibility; since the issue has been fixed in Guava 16, guava-cdi
isn't needed anymore.

There are several ways to fix this. What way is best depends on your
situation:

1) Maybe there's a newer version of guava-cdi. (Unlikely if I'm right
about the reasons for the existence of guava-cdi, quite possible otherwise.)

2) Maybe you can ask the author of common.jar to upgrade to a newer
version of common.jar. (Unlikely since it's a SNAPSHOT version, which
tends to get deleted. BTW if you don't control a library, depending on a
SNAPSHOT version is a bad idea because it makes your build
non-repeatable, i.e. you never know whether a rebuild will give you the
same version as it gave you a while ago.)

3) You can fork common.jar and do (1) yourself.

4) You can exclude the dependency from common.jar to guava:jar:cdi1.0 in
your POM. See http://maven.apache.org/pom.html#Exclusions .

Federico Piazza

unread,
Jun 20, 2014, 11:06:08 AM6/20/14
to Joachim Durchholz, guava-...@googlegroups.com
Thank Joachim for your response.

Fortunately I have access to common project so could upgrade guava to 17. It solved my issue on wildfly, don't know if that changed introduced new bugs but I am analyzing this. My next steps will be to deploy the project built on java 8 on wildfly, run integration tests and ask QA to test too.

Thank you guys for your answers. They were really useful specially the "mvn dependency:tree" I didn't know about this feature it's excellent.

Regards,



--- You received this message because you are subscribed to a topic in the Google Groups "guava-discuss" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/guava-discuss/hBZdkU5LyWM/unsubscribe.
To unsubscribe from this group and all its topics, send an email to guava-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/guava-discuss/53A3F2DA.2070805%40durchholz.org.

Christian Gruber

unread,
Jun 20, 2014, 12:06:19 PM6/20/14
to Federico Piazza, Joachim Durchholz, guava-...@googlegroups.com
Any time.

As a side note, if common is part of your project, and you are mixing
these artifacts together, you might want to consider using maven's
dependency management feature, where you set a version for each known
dependency the whole multi-module build in a parent pom.xml, and then
you simply omit the version in each lower-level project that inherits
it. Then you can just change versions in one place.

You still have to guard against version skew in your upstream
dependencies, but you can use <excludes> in your dependencies to prune
the tree, so your versions work. That should usually be safe for Guava,
unless you're using a really really old library that depends on guava..

c.
>> guava-discus...@googlegroups.com.
>> To view this discussion on the web visit https://groups.google.com/d/
>> msgid/guava-discuss/53A3F2DA.2070805%40durchholz.org.
>>
>> For more options, visit https://groups.google.com/d/optout.
>>
>
> You received this message because you are subscribed to the Google
> Groups "guava-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send
> an email to guava-discus...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/guava-discuss/CALTwF%2BWJijFwe0sKZLy%3D81rhH80z%2BFZM9HfZe78dQcgGXkAb0w%40mail.gmail.com.
> For more options, visit https://groups.google.com/d/optout.


Reply all
Reply to author
Forward
0 new messages