Results 1 to 5 of 5

Thread: How to make spring service available through REST and RMI

  1. #1
    Join Date
    Sep 2012
    Posts
    4

    Default How to make spring service available through REST and RMI

    We have a few spring services that should be available through REST (for external client programs) and RMI (for internal client programs). What is the standard way to do this with spring. Can we achieve this with Apache Virgo, dm server or tc server?

  2. #2
    Join Date
    Mar 2007
    Posts
    561

    Default

    For RMI just use Spring Remoting for RMI
    For REST there are serveral ways. Spring MVC with propper annotations, Spring Data REST, Jersey...
    Has nothing to do with your servlet container, pure tomcat or jetty are doing the job too.

  3. #3
    Join Date
    Sep 2012
    Posts
    4

    Default

    Thanks for you swift reply! We are already using Spring MVC for the REST communication under tomcat. For RMI we already use spring remoting, but we need to start a separate process for the RMI server, to listen on the RMI port (1099). We do that by running the following main method, which was inspired by http://snehaprashant.blogspot.nl/2009/05/rmi-using-spring.html :
    Code:
    public static void main(String[] args) {
            new ClassPathXmlApplicationContext("classpath:/META-INF/application-context.xml");
        }
    What we are looking for is a single application that handles both the REST part and the RMI part. Can we do this with one of the aforementioned servers (eclipse Virgo, dm server or tc server)?

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,625

    Default

    As mentioned before by spgmx it doesn't matter which server your on... Simply expose your services by using the RMI remoting support, not sure why you want to start that in a seperate instance it will work in every environment (btw eclipse virgo is dm server the latter isn't supported anymore).
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5
    Join Date
    Sep 2012
    Posts
    4

    Default

    Very useful answer once more! As a reaction to it we now included the RMI configuration in the application-context of the war we already used for the REST communication, and indeed the RMI and REST work OK when we deploy this archive to tomcat. The reason why we are stressing the virgo/tc server deployment is that it would be great if we could deploy the RMI and REST 'handler' as separate OSGI bundles to this type of server. This link already seems to suggest that RMI doesn't combine well with OSGI: http://stackoverflow.com/questions/1...osgi-container, but we want to be sure that this type of solution is 'impossible'.

Tags for this Thread

Posting Permissions

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