vendredi 2 décembre 2016

Class loading via reflection using a single class loader

I have a webapp project, which I am running through tomcat. The webapp project has a dependency of a core project. (The core project jar is present in WEB-INF/lib folder).

I have another sample project which has same core project dependency. I need to load a class and invoke a particular method present in the sample project jar via reflection.

I need to load core project's classes that are being used in the sample project as well as web app project via common class loader.

The problem is :- I am unable to load core project classes and sample project classes in a common class loader.

I have tried a lot from past two days like loading up classes using a custom class loader and system class loader, but I always end up getting either NoSuchMethodException or ClassCastException or ClassNotFoundException.

How should I handle this situation of having a common class loader?





Aucun commentaire:

Enregistrer un commentaire