tailorlala / guava-libraries

Automatically exported from code.google.com/p/guava-libraries
Apache License 2.0
0 stars 0 forks source link

guava 14.0.1 cannot be deployed in a JEE7 Container #1433

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
In JEE7 CDI (CDI 2.0) is enabled by default (without a beans.xml needing to be 
present), with no standardized way of disable it.

com.google.common.util.concurrent.ServiceManager is annotated with @Singleton 
and has a constructor...

  @Inject ServiceManager(Set<Service> services) {
    this((Iterable<Service>) services);
  }

So any war or ear that contains a guava 14.0.1 jar suffers from CDI seeing this 
and trying to create the bean but failing and thus failing the entire war from 
loading.

This error is from Glassfish 4.0

[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>)]

The same WAR also fails to deploy on Firefly 8.0 with a similar error.

Can guava be modified to not use the @Singleton and @Inject annotations?

Original issue reported on code.google.com by AaronJWh...@gmail.com on 28 May 2013 at 9:34

GoogleCodeExporter commented 9 years ago
Guava 16 and 16.0.1 still have the same problem with glassfish 4.0. What am I 
missing?

Original comment by hsaqal...@gmail.com on 14 Feb 2014 at 7:00

GoogleCodeExporter commented 9 years ago
What error are you getting?

Both the @Inject and @Singleton annotations were removed from
ServiceManager due to this issue, so I'm surprised there is still a problem.

Is it possible you have more than one copy of guava on your class path?

in a JEE7 Container

am I missing?

Original comment by lu...@google.com on 14 Feb 2014 at 7:22

GoogleCodeExporter commented 9 years ago
The error message is: java.lang.NoSuchMethodError: 
com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/
List;

My mvn dependency:tree is showing exactly one guava 16.0 and I don't have 
google collections. This is the tree (minus our own packages):
[INFO] +- org.springframework:spring-core:jar:3.2.5.RELEASE:compile
[INFO] |  \- commons-logging:commons-logging:jar:1.1.1:compile
[INFO] +- org.springframework:spring-web:jar:3.2.5.RELEASE:compile
[INFO] |  +- aopalliance:aopalliance:jar:1.0:compile
[INFO] |  +- org.springframework:spring-aop:jar:3.2.5.RELEASE:compile
[INFO] |  +- org.springframework:spring-beans:jar:3.2.5.RELEASE:compile
[INFO] |  \- org.springframework:spring-context:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework:spring-webmvc:jar:3.2.5.RELEASE:compile
[INFO] |  \- org.springframework:spring-expression:jar:3.2.5.RELEASE:compile
[INFO] +- org.springframework.data:spring-data-mongodb:jar:1.3.2.RELEASE:compile
[INFO] |  +- org.springframework:spring-tx:jar:3.1.4.RELEASE:compile
[INFO] |  +- 
org.springframework.data:spring-data-commons:jar:1.6.2.RELEASE:compile
[INFO] |  +- org.mongodb:mongo-java-driver:jar:2.10.1:compile
[INFO] |  \- org.slf4j:jcl-over-slf4j:jar:1.7.1:runtime
[INFO] +- junit:junit:jar:4.11:test
[INFO] |  \- org.hamcrest:hamcrest-core:jar:1.3:test
[INFO] +- org.mockito:mockito-all:jar:1.9.5:compile
[INFO] +- org.springframework:spring-test:jar:3.2.5.RELEASE:compile
[INFO] +- org.easytesting:fest-assert-core:jar:2.0M10:compile
[INFO] |  \- org.easytesting:fest-util:jar:1.2.5:compile
[INFO] +- org.apache.tomcat:tomcat-servlet-api:jar:7.0.47:provided
[INFO] +- javax.servlet.jsp:jsp-api:jar:2.2:provided
[INFO] +- javax.servlet.jsp.jstl:jstl-api:jar:1.2:compile
[INFO] +- org.glassfish.web:jstl-impl:jar:1.2:compile
[INFO] +- com.google.code.gson:gson:jar:2.2.4:compile
[INFO] +- com.google.guava:guava:jar:16.0:compile
[INFO] +- org.slf4j:slf4j-api:jar:1.7.5:compile
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.7.5:compile
[INFO] |  \- log4j:log4j:jar:1.2.17:compile
[INFO] +- opensymphony:sitemesh:jar:2.4.2:compile
[INFO] +- commons-codec:commons-codec:jar:1.4:compile
[INFO] +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.13:compile
[INFO] |  \- org.codehaus.jackson:jackson-core-asl:jar:1.9.13:compile
[INFO] +- javax.mail:mail:jar:1.4.5:compile
[INFO] |  \- javax.activation:activation:jar:1.1:compile
[INFO] +- joda-time:joda-time:jar:2.3:compile
[INFO] \- org.ocpsoft.prettytime:prettytime:jar:3.2.4.Final:compile
-------------------------------------------------------------------------

The same error is happening with guava 15.0.x and 16.0.1
Unless GlassFish 4.0 is including its own guava. 

Original comment by hsaqal...@gmail.com on 14 Feb 2014 at 7:36

GoogleCodeExporter commented 9 years ago
Glassfish bundles its own Guava.

Original comment by pjpi...@gmail.com on 14 Feb 2014 at 7:38

GoogleCodeExporter commented 9 years ago
Any idea how to remove it?
Thanks.

Original comment by hsaqal...@gmail.com on 14 Feb 2014 at 7:39

GoogleCodeExporter commented 9 years ago
This appears to be a different issue.  Can you open a new bug?

Original comment by lu...@google.com on 14 Feb 2014 at 7:40

GoogleCodeExporter commented 9 years ago
Done: 
https://code.google.com/p/guava-libraries/issues/detail?id=1668&thanks=1668&ts=1
392364120

Original comment by hsaqal...@gmail.com on 14 Feb 2014 at 7:48

GoogleCodeExporter commented 9 years ago
This issue has been migrated to GitHub.

It can be found at https://github.com/google/guava/issues/<issue id>

Original comment by cgdecker@google.com on 1 Nov 2014 at 4:12

GoogleCodeExporter commented 9 years ago

Original comment by cgdecker@google.com on 3 Nov 2014 at 9:08