2 Replies Latest reply on Oct 29, 2008 2:59 PM by hcura

    Local and Remote interfaces

    hcura

      Hi.


      I'm new to seam and I was supposed to start using it in a new company project but I came across this problem where I can't use both local a remote interfaces at the same time(mandatory). I've searched a lot and found no answers.


      To explain briefly, I need to access a Bean from outside my application (using a remote interface with jndi) and still be able to use the local interface as usual for seam. I've tried changing jndiPattern and other few suggestions but none worked.


      How is this possible? What's the best approach?


      Best regards.

        • 1. Re: Local and Remote interfaces
          gjeudy

          The local interface and remote interfaces cannot be the same. You have to use different interfaces. Usually I would have the local interface extend the remote interface as what you want to expose remotely is usually a subset of what is available locally. In the end the choice is yours.


          PS: no need to mess with the JNDI pattern in Seam.


          Now if your EJB uses persistence then you are likely to hit a problem with your persistence context management. See my post relating to this subject.


          Example:


          @Stateless
          @Local(WorkspaceServiceLocal.class)
          @Remote(WorkspaceService.class)
          @Name("workspaceService")
          public class WorkspaceServiceImpl implements WorkspaceService, WorkspaceServiceLocal {
          ...
          }
          

          • 2. Re: Local and Remote interfaces
            hcura

            Thanks for your answer. Maybe I didn't make my self clear regarding the interfaces. I know an interface can't be both local and remote at the same time; what I meant was that i needed to have both available and make the bean implement them.


            Back to the problem..


            I've tried your approach before but (with the @Local and @Remote annotations) in reverse order (local interface first) and didn't work. Now with remote first it seams to work. I've made some simple test runs and should be fine.


            Thanks.