Assume:
1. Using Maven, you have found all dependency jar files.
2. These jar files contains different versions of protobuf so your application fails to work. For example, MapMaker.keyEquivalence method is not found.
3. You have Java de-compiler installed.
Solution:
1. Rename Maven repository (for example, rename .m2\repository to .m2\repository_backup)
2. Re-generate Maven repository (mvn test or mvn package on pom.xml file)
3. Under Windows Explorer, go to .m2\repository folder and type '.jar' from search box (top right corner).
4. Now, you get all jar files under the same window.
5. Copy all and paste them into a single folder (i.e. c:\my_jars).
6. Move these jar files into Linux machine since we will need some Linux scripting there.
7. Assume all of these jar files are under your Linux machine now under subdirectory /tmp/myJars
8. Do following scripting(assume you have Java JDK installed so you have jar somewhere under your Linux system; otherwise, install JDK first):
[root@john1 myJars]# for x in `ls`; do jar -tvf $x | grep com.google.common.collect.MapMaker; done
9. Above will find all jar files which contains class MapMaker.
10. Under my case, it found following two jar files:
google-collections-1.0.jar
1479 Wed Dec 30 10:59:50 PST 2009 com/google/common/collect/MapMaker$1.class
1756 Wed Dec 30 10:59:50 PST 2009 com/google/common/collect/MapMaker$ComputationExceptionReference.class
2041 Wed Dec 30 10:59:50 PST 2009 com/google/common/collect/MapMaker$LinkedSoftEntry.class
2055 Wed Dec 30 10:59:50 PST 2009 com/google/common/collect/MapMaker$LinkedStrongEntry.class
guava-14.0.1.jar
227 Thu Mar 14 19:56:56 PDT 2013 com/google/common/collect/MapMaker$1.class
2329 Thu Mar 14 19:56:56 PDT 2013 com/google/common/collect/MapMaker$ComputingMapAdapter.class
2545 Thu Mar 14 19:56:56 PDT 2013 com/google/common/collect/MapMaker$NullComputingConcurrentMap.class
4134 Thu Mar 14 19:56:56 PDT 2013 com/google/common/collect/MapMaker$NullConcurrentMap.class
12. Remove google-collections-1.0.jar from your classpath. Now, there is no complain about method MapMaker.keyEquivalence is not found or similar errors.
No comments:
Post a Comment