Announcement Announcement Module
Collapse
No announcement yet.
Access local servlet via httpinvoker during startup Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Access local servlet via httpinvoker during startup

    Hi all,

    i am rather new to Java, Tomcat and Spring and trying to communicate between an applicationContext and multiple servlets (DispatcherServlets) using the httpinvoker RMI.

    for testing purposes and to eventually running the applicationContext and servlets inside the same tomcat instance, i want to invoke a remote method during startup of the spring applicationcontext. as long as i start the remote request in a new thread, everything works fine (so configuration should be ok).

    now i would like to know if there is a possibility to do this without starting a new thread.

    works:
    Code:
    ...
    @Override
    public void afterPropertiesSet() throws Exception {
      new Thread() {
        public void run() {
          service.register();
        }
      }.start();
    }
    ...
    does not work:
    Code:
    ...
    @Override
    public void afterPropertiesSet() throws Exception {
      service.register();
    }
    ...
    The component issuing the RMI request seems to block the loading process of the tomcat context.

    Thanks in advance!

    Laureen
    Last edited by laureen; Aug 23rd, 2009, 10:43 AM.

  • #2
    Laureen,

    Have you considered using a ServletContextListener to accomplish this? Not sure where in your lifecycle you want to accomplish it exactly, but you might find that a BeanPostProcessor could solve your problem.

    Hope that helps,

    Comment

    Working...
    X