Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
gissuebot opened this issue Oct 31, 2014 · 7 comments
Closed

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

gissuebot opened this issue Oct 31, 2014 · 7 comments

Comments

@gissuebot
Copy link

Original issue created by hsaqallah on 2014-02-14 at 07:48 AM


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.

@gissuebot
Copy link
Author

Original comment posted by LukeISandberg on 2014-02-14 at 07:53 AM


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

@gissuebot
Copy link
Author

Original comment posted by stephan202 on 2014-02-14 at 09:19 AM


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.

@gissuebot
Copy link
Author

Original comment posted by hsaqallah on 2014-02-15 at 07:24 PM


@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.

@lordvlad
Copy link

lordvlad commented Jun 2, 2016

+1

@kungfoo
Copy link

kungfoo commented Nov 23, 2017

This still happens with Glassfish 5.0...

@adeebahmed
Copy link

Also happens on druid 11

@DukeCaesar
Copy link

I've come across this same issue. One possible workaround is to go into the modules directory of glassfish server (../glassfish4/glassfish/modules), rename the original guava.jar to guava-backup.jar, and download the specific version of guava jar, and change its name to "guava.jar". Then restart the glassfish server. Seems to work without any noticeable issues, yet.

@cpovirk cpovirk closed this as completed May 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants