Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 2 of 2

Thread: calling method of webapplication1 from webapplication2

  1. #1
    Junior Member
    Join Date
    May 2012
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default calling method of webapplication1 from webapplication2

    Hi,

    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
    from,
    method of class2 of webapplication2.

    Any idea will be appreciated.

    Thanks,
    Namrata Shah


  2. #2
    Member
    Join Date
    Apr 2012
    Location
    Superior, CO, USA
    Posts
    80
    Thanks
    0
    Thanked 14 Times in 14 Posts

    Default 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:
    1. Create a common library (jar file) that will be installed in both web apps that contains the methods you need.
    2. 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.
    Need Java help? Check out the HotJoe Java Help forums!

Similar Threads

  1. Calling method cant get the parameters right
    By frozen java in forum What's Wrong With My Code?
    Replies: 3
    Last Post: October 22nd, 2011, 02:23 PM
  2. calling a method from other object: thred
    By Sudheera in forum What's Wrong With My Code?
    Replies: 2
    Last Post: July 18th, 2011, 05:19 AM
  3. [SOLVED] method calling
    By javapenguin in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 4th, 2010, 01:43 AM
  4. Help Calling Method From Another Class
    By CheekySpoon in forum What's Wrong With My Code?
    Replies: 2
    Last Post: February 15th, 2010, 10:24 AM
  5. Java Code Help - Calling Method
    By KevinGreen in forum Object Oriented Programming
    Replies: 5
    Last Post: September 18th, 2009, 12:55 AM