Results 1 to 4 of 4
  1. #1
    justinschw is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default tomcat + inter-process communication?

    Hi all,

    I have a web application running on a tomcat server and I wanted to write beans that would communicate with another java application that runs on the server. I'd like for the bean code in the jsp server to be able to call methods from the running java application. Is there some sort of inter-process communication (IPC) that would allow me to do this? Is there some easier way of doing it? The back-end application needs to run all the time (has a 'main' method), and is multithreaded. I am kind of new to these sort of things and would appreciate any kind of feedback.

    Thanks in advance,
    -Justin

  2. #2
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    Default

    Tomcat uses multiple ClassLoader instances to separate each application it is running. This allows applications to use different versions of the same classes and for the server to reload individual applications without having to shut down the entire JVM. This makes communication between applications more complicated.

    If you create classes and put them only in the /common/ directory tree, then all processes will share these class definitions. You can then use static methods to access these classes.

    Note that if you put these classes in /common/ and also in your /WEB-INF/ directories, you will end up with two separate classes with two separate sets of static methods.

  3. #3
    justinschw is offline Member
    Join Date
    Mar 2010
    Posts
    2
    Rep Power
    0

    Default

    I'm sorry, I should have been more clear in my first post: the second application that I am running is not a tomcat application. It is entirely separate from tomcat. The first application is the tomcat application, and I want this application to be able to get information from the second application's memory space. I am thinking about using sockets for this, though I don't know if there might be an easier solution.

  4. #4
    Steve11235's Avatar
    Steve11235 is offline Senior Member
    Join Date
    Dec 2008
    Posts
    1,046
    Rep Power
    8

    Default

    Yes, you can use raw sockets to communicate between two JVM's, even if they are on separate servers. Another approach is to run the server application inside a Web application server and to use Web services to allow clients to access the application.

    You might also consider moving the "other" application into the Tomcat container. You would need a means to start the application when Tomcat starts, which shouldn't be too hard. This is the idea used in JEE servers.

Similar Threads

  1. A place to post beginner/inter exercises/scenarios
    By helpisontheway in forum New To Java
    Replies: 0
    Last Post: 01-27-2010, 10:03 AM
  2. tomcat can not process request
    By sclsch in forum Web Frameworks
    Replies: 0
    Last Post: 04-17-2009, 09:26 AM
  3. inter process communication
    By ibtehal in forum Networking
    Replies: 5
    Last Post: 06-23-2008, 02:35 AM
  4. How to use pipes for inter-thread I/O
    By Java Tip in forum java.lang
    Replies: 0
    Last Post: 04-09-2008, 07:37 PM
  5. Tomcat In Eclipse - Sysdeo Tomcat Plug-in
    By JavaForums in forum Eclipse
    Replies: 1
    Last Post: 02-13-2008, 11:33 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •