DaveAKing / guava-libraries

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

Guava 15 and Guava 16 causing NoSuchMethodError in GlassFish 4.0 #1668

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I'm using Guava 16 in my project and having problems with GlassFish 4.0

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
If GlassFish bundles its own guava, any idea how I can fix this issue?

Thanks in advance. 

Original issue reported on code.google.com by hsaqal...@gmail.com on 14 Feb 2014 at 7:48

GoogleCodeExporter commented 9 years ago
Looks like there are a number of people dealing with similar issues.  I found 
this glassfish bug that may help.

https://java.net/jira/browse/GLASSFISH-20850

Original comment by LukeISan...@gmail.com on 14 Feb 2014 at 7:53

GoogleCodeExporter commented 9 years ago
General Maven remark: `mvn dependency:tree` will list only the *selected* 
dependencies. Thus you'll always see Guava at most once (provided it was not 
shaded under another GAV). Add the -Dverbose flag to see which dependencies 
(versions) were suppressed. This should tell you against which version of Guava 
other third party dependencies are built.

Original comment by stephan...@gmail.com on 14 Feb 2014 at 9:19

GoogleCodeExporter commented 9 years ago
@Stephan...I used the -Dverbose. No other dependency is including Guava. 
Checking at other forums, including the one Luke posted, we made a decision to 
move to Tomcat. GlassFish's own dependencies leak into apps classpath (and GF 
uses an older Guava.) Fixing the issue requires meddling with GF's own 
libraries and is error-prone. Such errors are a disaster waiting to happen. 
Thanks all for the help. 

Original comment by hsaqal...@gmail.com on 15 Feb 2014 at 7:24

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:10

GoogleCodeExporter commented 9 years ago

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

GoogleCodeExporter commented 9 years ago

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