7 Replies Latest reply on Oct 29, 2010 2:40 AM by lvdberg

    Accessing remote ejbs from another jboss server instance

    marcio.dantas

      Gentlemen,


      I've been searching through the seam docs and forum to find out if there's a way to access from a JBoss server instance A remote ejbs in a JBoss instance B.


      I know the only thing that I need is changing the IP adress of the naming provider to point instance's B naming service at port 1099, but I didn't find out if seam gives any support to do this (like spring does).


      Does it? Or I have to do something else, like creating a jndi.properties file?
      It would be reaaly good if this example was available in the official documentation.


      Please someone point me out an answer or direction here.
      thx

        • 1. Re: Accessing remote ejbs from another jboss server instance
          marcio.dantas

          If I find out something useful, I'll share here with you all.


          best regards,
          mpd

          • 2. Re: Accessing remote ejbs from another jboss server instance
            cash1981

            I don't know about jndi.properties, but remote access should work by creating a Webservice.

            • 3. Re: Accessing remote ejbs from another jboss server instance
              lvdberg

              Hi,


              you an make a simple component which gets the object and provides it to the rest of the application. The Spring helper class is the same simple wrapper. Most Spring components can be used without a problem with Seam.


              One of the big issues here is that you need to restart (or even re-compile) when you change the configuarion. Consider using JMX for configuration or make a configuration-component


              Leo

              • 4. Re: Accessing remote ejbs from another jboss server instance
                marcio.dantas

                Leo,


                if I understood well, you're suggesting to use org.springframework.jndi.JndiObjectFactoryBean, right?


                I was willing to find a pure seam solution, but I don't know if it exists.
                It would be great if you could simply pass the jnp provider in componentes.xml.



                Shervin, I think plain remote ejbs (rcp/rmi) would be really best than webservices in my case.
                thx

                • 5. Re: Accessing remote ejbs from another jboss server instance
                  lvdberg

                  Hi,


                  the components.xml file can be used to create instances of any POJO, so Spring classes are no exception. The only problem is that Spring beans sometimes depend on its own functioanlity, so you must kickstart that. Dan Allen has written the excellent (free) SeamInAction chapter on this issue.


                  If you're just using the Spring bean, you can sublass it and add the hooks (basically the create and unwrap annotations, which in turn call the Spring methods).


                  Adding the Jndi.properties to the instance is just the way of injecting parameters. a component descriptor with only the bean-name and the attributes you want. Just as simple as it sounds.


                  Leo


                  P.S. As mentioned before have a look at JMX (Spring has great support for that) and use it to configure your properties. Things in components.xml do NOT need a re-compile, but it does need an rebuild and deploy!! With JMX you can do without these steps, so you basically get a Hot-configurable system (well, sort of)

                  • 6. Re: Accessing remote ejbs from another jboss server instance
                    marcio.dantas

                    thanks, leo! very good and insigthful post.


                    I already knew the spring way of doing this. I will now try using JMX.


                    Is there some good article or book that covers this example with JMX?
                    thx again

                    • 7. Re: Accessing remote ejbs from another jboss server instance
                      lvdberg

                      Hi,


                      Manning has some great Java books. There is also a JMX in Action book which provides you with all the information. Be aware that since Java 6 the creation of JMX-beans got a lot simpler for the regular beans (just annotations) so peek also in the JRE's provided functionality.


                      Leo