0

Currently, I am developing a Vaadin web app project on Netbeans using a Glassfish 4 server. The server deploys WITHOUT error, but when I try to go to another page via a link on the project (basically I just click a button), it runs into the following error:

java.lang.NoSuchMethodError: com.google.common.base.Splitter.splitToList(Ljava/lang/CharSequence;)Ljava/util/List;

After doing some research online, I found the following useful:

https://github.com/firebase/firebase-admin-java/issues/50

(a similar response exists on StackOverflow)

Basically, there's some sort of conflict versions of Guava that end up on the classpath. On Netbeans itself, I made sure to check that my version of Guava is 18.0 (I can't go above 19.0 since I make use of FutureCallback, which is gone after 19.0), which SHOULD support splitToList. This isn't just from verifying online; I literally looked into the Netbeans dependencies, found the Splitter class, and made sure that method existed (which it did).

Thus, my suspicions about conflicting guava files led me to check out my maven repositories (inside my .m2 file). I then saw that there were multiple versions: specifically 10.0.0, 18.0, 19.0, 20.0, and the most recent one (25); I thought these might be the offenders, so I just deleted 10.0, 20.0, and 25 (since they wouldn't work for my purposes - splitToList has only existed since 15.0, if my online research has been correct). However, when I built and ran the Netbeans project again, the .m2 folder simply repopulated those deleted elements. Thus, I'm strongly inclined to believe "two versions of Guava ended up in the classpath" (as the responder in the first link said); my way of checking only involved two things:

1) Checking the dependencies listed on the Netbeans project to make sure guava-18.0.jar was being used 2) Verifying that guava-18.0 was the only version being used in the pom.xml file

Unfortunately, these two were apparently not enough, since I still run into the NoSuchMethodError... If anyone has any suggestions as to how I can

1) Find (potentially) multiple versions of Guava on the classpath and eliminate them if that's the case 2) Do anything else to try and solve the NoSuchMethodError

Please let me know.


MY SOLUTION TO THE ABOVE ISSUES:

So, I ended up going through all the dependencies manually, which was a pain, but that still didn't really explain how the issues were arising, since it didn't seem like any of the Guava dependencies displayed in Netbeans (right click on any dependency, select artifact properties, click on class path) were sources of issues. So it turned out that instead, the issue was with the glassfish jar files... Inside glassfish's modules, there is a guava.jar, which for Glassfish 4.1.2 (the one I'm using for the project) is only guava version 13. SplitToList only occurs on version 15 and later, as mentioned above. To fix this issue, I simply replaced that jar file with a more up to date one from my .m2 repository (specifically, I replaced it with guava-18.0.jar)


UPDATE:

Trying mvn dependency:tree makes me run into this error (using mvn clean install to build the project gives a very similar output):

lab@SIT-Dev:~/NetBeansProjects/nchandlerv2$ mvn dependency:tree
[WARNING]
[WARNING] Some problems were encountered while building the effective settings
[WARNING] 'proxies.proxy.id' must be unique but found duplicate proxy with id default @ /usr/share/maven/conf/settings.xml
[WARNING] 'proxies.proxy.id' must be unique but found duplicate proxy with id default @ /home/lab/.m2/settings.xml
[WARNING]
[INFO] Scanning for projects...
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.2/maven-compiler-plugin-3.2.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.2/maven-compiler-plugin-3.2.pom (12 KB at 38.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.2/maven-compiler-plugin-3.2.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-compiler-plugin/3.2/maven-compiler-plugin-3.2.jar (45 KB at 2111.2 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.17/maven-surefire-plugin-2.17.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.17/maven-surefire-plugin-2.17.pom (5 KB at 348.8 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire/2.17/surefire-2.17.pom
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/surefire/surefire/2.17/surefire-2.17.pom (17 KB at 889.5 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.17/maven-surefire-plugin-2.17.jar
Downloaded: https://repo.maven.apache.org/maven2/org/apache/maven/plugins/maven-surefire-plugin/2.17/maven-surefire-plugin-2.17.jar (34 KB at 1671.4 KB/sec)
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building nchandlerv2 1.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-model-util/0.8.3-Beryllium-SR3/yang-model-util-0.8.3-Beryllium-SR3.pom
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-model-util/0.8.3-Beryllium-SR3/yang-model-util-0.8.3-Beryllium-SR3.pom
[WARNING] The POM for org.opendaylight.yangtools:yang-model-util:jar:0.8.3-Beryllium-SR3 is missing, no dependency information available
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-parser-api/0.8.3-Beryllium-SR3/yang-parser-api-0.8.3-Beryllium-SR3.pom
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-parser-api/0.8.3-Beryllium-SR3/yang-parser-api-0.8.3-Beryllium-SR3.pom
[WARNING] The POM for org.opendaylight.yangtools:yang-parser-api:jar:0.8.3-Beryllium-SR3 is missing, no dependency information available
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-parser-impl/0.8.3-Beryllium-SR3/yang-parser-impl-0.8.3-Beryllium-SR3.pom
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-parser-impl/0.8.3-Beryllium-SR3/yang-parser-impl-0.8.3-Beryllium-SR3.pom
[WARNING] The POM for org.opendaylight.yangtools:yang-parser-impl:jar:0.8.3-Beryllium-SR3 is missing, no dependency information available
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-model-api/0.8.3-Beryllium-SR3/yang-model-api-0.8.3-Beryllium-SR3.pom
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-model-api/0.8.3-Beryllium-SR3/yang-model-api-0.8.3-Beryllium-SR3.pom
[WARNING] The POM for org.opendaylight.yangtools:yang-model-api:jar:0.8.3-Beryllium-SR3 is missing, no dependency information available
Downloading: http://maven.vaadin.com/vaadin-addons/io/grpc/grpc-core/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/io/grpc/grpc-core/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/io/grpc/grpc-core/maven-metadata.xml (2 KB at 112.2 KB/sec)
Downloading: http://maven.vaadin.com/vaadin-addons/io/netty/netty-codec-http2/maven-metadata.xml
Downloading: https://repo.maven.apache.org/maven2/io/netty/netty-codec-http2/maven-metadata.xml
Downloaded: https://repo.maven.apache.org/maven2/io/netty/netty-codec-http2/maven-metadata.xml (2 KB at 117.1 KB/sec)
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-model-util/0.8.3-Beryllium-SR3/yang-model-util-0.8.3-Beryllium-SR3.jar
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-parser-api/0.8.3-Beryllium-SR3/yang-parser-api-0.8.3-Beryllium-SR3.jar
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-parser-impl/0.8.3-Beryllium-SR3/yang-parser-impl-0.8.3-Beryllium-SR3.jar
Downloading: http://maven.vaadin.com/vaadin-addons/org/opendaylight/yangtools/yang-model-api/0.8.3-Beryllium-SR3/yang-model-api-0.8.3-Beryllium-SR3.jar
Downloading: http://maven.vaadin.com/vaadin-addons/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar
Downloading: http://maven.vaadin.com/vaadin-addons/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-model-util/0.8.3-Beryllium-SR3/yang-model-util-0.8.3-Beryllium-SR3.jar
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-parser-impl/0.8.3-Beryllium-SR3/yang-parser-impl-0.8.3-Beryllium-SR3.jar
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-model-api/0.8.3-Beryllium-SR3/yang-model-api-0.8.3-Beryllium-SR3.jar
Downloading: https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar
Downloading: https://repo.maven.apache.org/maven2/org/opendaylight/yangtools/yang-parser-api/0.8.3-Beryllium-SR3/yang-parser-api-0.8.3-Beryllium-SR3.jar
Downloaded: https://repo.maven.apache.org/maven2/org/slf4j/slf4j-api/1.7.21/slf4j-api-1.7.21.jar (41 KB at 786.4 KB/sec)
Downloading: https://repo.maven.apache.org/maven2/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar
Downloaded: https://repo.maven.apache.org/maven2/org/antlr/antlr4-runtime/4.5.3/antlr4-runtime-4.5.3.jar (296 KB at 3107.0 KB/sec)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 3.715 s
[INFO] Finished at: 2018-07-10T03:22:13-07:00
[INFO] Final Memory: 20M/485M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal on project nchandlerv2: Could not resolve dependencies for project com.mycompany:nchandlerv2:war:1.0-SNAPSHOT: The following artifacts could not be resolved: org.opendaylight.yangtools:yang-model-util:jar:0.8.3-Beryllium-SR3, org.opendaylight.yangtools:yang-parser-api:jar:0.8.3-Beryllium-SR3, org.opendaylight.yangtools:yang-parser-impl:jar:0.8.3-Beryllium-SR3, org.opendaylight.yangtools:yang-model-api:jar:0.8.3-Beryllium-SR3: Could not find artifact org.opendaylight.yangtools:yang-model-util:jar:0.8.3-Beryllium-SR3 in vaadin-addons (http://maven.vaadin.com/vaadin-addons) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

This is particularly confusing to me since the NetBeans project builds just fine (as stated before, it even deploys on the server fine); it is true that there were some dependencies that had to be resolved earlier on in this project's life, but certainly now in NetBeans, no errors similar to these ones are issued when I build the project. Also, as for the errors (and warnings) that appeared, I don't understand why they would be the case:

1) For the warnings saying that certain pom files are missing, I can literally see them right in the correct subfolder inside my .m2 folders. There are 4 such warnings, but I'll just post one screen capture since all of them look exactly the same (though obviously with different names). Here's the yang-model-api:

enter image description here

Once again, I checked yang-model-api, yang-model-util, yang-parser-api, and yang-parser-impl, and all of them had the pom files as seen above.

2) As for the errors, these are highly similar to the warnings: the jar files are all in there, as can be seen from the previous image.

NOTE: I'll try a scope = provided tag to these 4 inside the project's pom, and see if it does anything; if not, I'll mention it here.

If it helps anyone, here's the successful build output on NetBeans:

cd /home/lab/NetBeansProjects/nchandlerv2; JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64 /home/lab/.netbeans/8.1/maven/bin/mvn clean install
Scanning for projects...

------------------------------------------------------------------------
Building nchandlerv2 1.0-SNAPSHOT
------------------------------------------------------------------------

--- maven-clean-plugin:3.0.0:clean (default-clean) @ nchandlerv2 ---
Deleting /home/lab/NetBeansProjects/nchandlerv2/target
Deleting /home/lab/NetBeansProjects/nchandlerv2/src/main/webapp/VAADIN/themes (includes = [**/styles.css, **/styles.scss.cache], excludes = [])

--- vaadin-maven-plugin:8.0.4:update-theme (default) @ nchandlerv2 ---
Updating theme VAADIN/themes/mytheme
Widgetsets found from classpath:
        com.vaadin.DefaultWidgetSet in jar:file:/home/lab/.m2/repository/com/vaadin/vaadin-client/8.0.4/vaadin-client-8.0.4.jar!/
Addon styles found from classpath:

Search took 9ms
Theme "VAADIN/themes/mytheme" updated
Updating theme VAADIN/themes/adtportal
Widgetsets found from classpath:
        com.vaadin.DefaultWidgetSet in jar:file:/home/lab/.m2/repository/com/vaadin/vaadin-client/8.0.4/vaadin-client-8.0.4.jar!/
Addon styles found from classpath:

Search took 4ms
Theme "VAADIN/themes/adtportal" updated

--- vaadin-maven-plugin:8.0.4:update-widgetset (default) @ nchandlerv2 ---
GWT plugin is configured to detect modules, but none were found.
No widgetsets found - generating AppWidgetset if necessary.
Updating widgetset AppWidgetset
Adding resource directory to command classpath: /home/lab/NetBeansProjects/nchandlerv2/src/main/resources
Adding resource directory to command classpath: /home/lab/NetBeansProjects/nchandlerv2/target/generated-resources/gwt
Using com.vaadin:vaadin-client-compiler version 8.4.2
Widgetsets found from classpath:
        com.vaadin.DefaultWidgetSet in jar:file:/home/lab/.m2/repository/com/vaadin/vaadin-client/8.4.2/vaadin-client-8.4.2.jar!/
Addon styles found from classpath:

Search took 4ms

--- vaadin-maven-plugin:8.0.4:compile-theme (default) @ nchandlerv2 ---
Updating theme VAADIN/themes/mytheme
Theme "VAADIN/themes/mytheme" compiled
Updating theme VAADIN/themes/adtportal
Theme "VAADIN/themes/adtportal" compiled

--- maven-resources-plugin:2.5:resources (default-resources) @ nchandlerv2 ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
Copying 1 resource
Copying 0 resource

--- maven-compiler-plugin:2.3.2:compile (default-compile) @ nchandlerv2 ---
Compiling 230 source files to /home/lab/NetBeansProjects/nchandlerv2/target/classes

--- vaadin-maven-plugin:8.0.4:compile (default) @ nchandlerv2 ---
GWT plugin is configured to detect modules, but none were found.
Using com.vaadin:vaadin-client-compiler version 8.4.2

--- maven-resources-plugin:2.5:testResources (default-testResources) @ nchandlerv2 ---
[debug] execute contextualize
Using 'UTF-8' encoding to copy filtered resources.
skip non existing resourceDirectory /home/lab/NetBeansProjects/nchandlerv2/src/test/resources

--- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) @ nchandlerv2 ---
Nothing to compile - all classes are up to date

--- maven-surefire-plugin:2.10:test (default-test) @ nchandlerv2 ---
No tests to run.
Surefire report directory: /home/lab/NetBeansProjects/nchandlerv2/target/surefire-reports

-------------------------------------------------------
 T E S T S
-------------------------------------------------------

Results :

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0


--- maven-war-plugin:3.0.0:war (default-war) @ nchandlerv2 ---
Packaging webapp
Assembling webapp [nchandlerv2] in [/home/lab/NetBeansProjects/nchandlerv2/target/nchandlerv2-1.0-SNAPSHOT]
Processing war project
Copying webapp resources [/home/lab/NetBeansProjects/nchandlerv2/src/main/webapp]
Webapp assembled in [167 msecs]
Building war: /home/lab/NetBeansProjects/nchandlerv2/target/nchandlerv2-1.0-SNAPSHOT.war

--- maven-install-plugin:2.3.1:install (default-install) @ nchandlerv2 ---
Installing /home/lab/NetBeansProjects/nchandlerv2/target/nchandlerv2-1.0-SNAPSHOT.war to /home/lab/.m2/repository/com/mycompany/nchandlerv2/1.0-SNAPSHOT/nchandlerv2-1.0-SNAPSHOT.war
Installing /home/lab/NetBeansProjects/nchandlerv2/pom.xml to /home/lab/.m2/repository/com/mycompany/nchandlerv2/1.0-SNAPSHOT/nchandlerv2-1.0-SNAPSHOT.pom
------------------------------------------------------------------------
BUILD SUCCESS
------------------------------------------------------------------------
Total time: 10.572s
Finished at: Tue Jul 10 03:47:22 PDT 2018
Final Memory: 46M/1027M
------------------------------------------------------------------------
  • Have you tried `mvn dependency:tree` already to see all transitive dependencies for Guava? – eeq Jul 10 '18 at 11:02
  • That kind of ties back to a certain error I had in an earlier question I asked; I'll update the post with that detail. – Jiasheng Qin Jul 10 '18 at 16:34
  • Ok, I found the solution to that post; re-updating the error log accordingly – Jiasheng Qin Jul 10 '18 at 17:34
  • Looks like there it at leat problem with dependency org.opendaylight.yangtools:yang-parser-impl:jar:0.8.3-Beryllium-SR3, maybe check that manually first. – eeq Jul 11 '18 at 13:30
  • Hm, I saw that, but I'm not sure why that one in particular is an issue; there are a lot more imports in my project than just the ones from opendaylight, and the first usage of opendaylight certainly isn't the first usage of an import in the project. I just double checked to make sure that all of the opendaylight jars were inside the appropriate locations in .m2, which they seem to be. I'll post some more details above. – Jiasheng Qin Jul 11 '18 at 16:43
  • OK, so I found the solution to my issues ABOVE the update; however, I would still like to have my updated questions answered, so I'll leave this post unanswered; I'll update my solution above. – Jiasheng Qin Jul 11 '18 at 22:18

0 Answers0