I have a jar (xyz.jar) which is pluggable to 5 projects , all project creates a object in session when anyone login to any of those 5 application named "loginObject" , I have to use this object from session in "xyz.jar" but LoginObject class is in main project , because of which i am unable to typecast it to "loginObject" class.
EGlobalLoginBean loginObject=(EGlobalLoginBean ) httpSession.getAttribute("loginObject");
Now that class "EGlobalLoginBean " is in main project not "xyz" , so i am unable to typecast it , and as i can't typecast i am unable to call it's method. I can't add main project as dependent project into "xyz" because it's suppose to happen the other way around.
All suggestion are highly appreciated.
You will have to work around it IMHO
Copy the .class file to the web-inf/classes of xyz.jar (if its a web application) or else add it to the server's classpath (bad, but it will work). Either way you have to extract the .class file (and its dependencies) out.
Load the .class file using a URL class loader, have it implement a common interface and invoke it's methods using the interface.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments