calling method of webapplication1 from webapplication2
Can any one please help me by driving me to solution for below requirement:
I'm having webapplication1 & webapplication2 belongs to a common tomcat instance.
I need to call method a method of class1 of webapplication1
method of class2 of webapplication2.
Any idea will be appreciated.
Re: calling method of webapplication1 from webapplication2
You can't directly. They are totally different classloaders and you won't be able to access classes from one in the other.
You have two choices:
- Create a common library (jar file) that will be installed in both web apps that contains the methods you need.
- Use something like HttpClient and call the method as if you were a browser or other client. If you're structured in a SOA (Service oriented architecture) manner this shouldn't be too bad. If you're not it will be somewhat harder.