Announcement Announcement Module
No announcement yet.
Extending App Context duration. Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Extending App Context duration.

    Please excuse what is quite a daft question but I'm curious as to what is the recommended technique (if any) to address the situation below.

    An RmiServiceExporter bean is loaded into a Spring app context as below (this is based on sample source from Craig's SIA2). On running the Java program the log output as below is produced as I'm making Spring load the rmiregistry - (I know how to manually invoke it).

    I want the service to stay loaded and available, but as soon as the call to
    ClassPathXmlApplicationContext() completes then the rmiregistry terminates. If I suspend the main() thread via a sleep or something then the rmiregistry remains. What is the better way to do this - apart from having some other entity manage the rmiregistry - instead of the Spring app context.

    Thank you,

    David Victor.


    Service bean:


    <bean class="org.springframework.remoting.rmi.RmiService Exporter">
    <property name="service" ref="myService"/>

    public static void main(String[] args) {

    new ClassPathXmlApplicationContext("my-service.xml");


    log info:
    INFO - Looking for RMI registry at port '1099'
    INFO - Could not detect RMI registry - creating new one
    INFO - Binding service 'myService' to RMI registry: RegistryImpl[UnicastServerRef [liveRef:

  • #2
    Originally posted by dvb123 View Post
    If I suspend the main() thread via a sleep or something then the rmiregistry remains.

    According to this suspending the thread is a possible approach.

    "Do I understand you correctly, that the problem is to keep the service, provided by a standalone app, available? In that case you just have to ensure that the main method does not exit."