Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
982 views
in Technique[技术] by (71.8m points)

classloader - Java 9 modules - 3rd party library dependency conflict

Does Java 9 modules can help with solving dependency conflict? I have included two dependencies, protobuf-java and protobuf-lite, they both contains the same classes under the same packages (FQN), the problem is implementations differs a bit from each other. Both dependencies comes from two different jars and i need both in single module. The problem is, that class loader takes just the first one on the classpath which leads to unexpected behavior like NoSuchMethodError or NoClassDefFoundError.

Do you have any idea how can I solve this problem? I guess i have to force loading these dependencies by different class loaders, right? Could you provide some examples which shows how to deal with it?


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)
等待大神答复

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

57.0k users

...