• Post Reply Bookmark Topic Watch Topic
  • New Topic

EJB @Remote, @Local, and Interfaces

 
Kevin Cloutier
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ok, I've posted a few questions to the Java Sun EJB forums over the last few weeks but it looks like JavaRanch is much more active for questions regarding EJBs... so, here it goes.

I am new to EJB3 (actually EJB) and two questions have arisen while studying this topic.

1) If my application requires both Remote and Local access, and the interfaces are identical, can I use one interface with the following annotation? If so, is this good practice?




2) When creating a client application, I understand from the text I am reading I must include the Interface class file within my client.jar in order for it to work correctly (i.e. InterfaceClassNameLocal.class or InterfaceClassNameRemote.class). Is there any other way? What if I were building an application which utilized EJBs that I did not have access to the source, but were deployed on the server? (by the way, this isn't the case, but it struck me as limiting so I thought I would ask.)
 
Jaikiran Pai
Sheriff
Posts: 10447
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Kevin Cloutier:


1) If my application requires both Remote and Local access, and the interfaces are identical, can I use one interface with the following annotation? If so, is this good practice?




This is not allowed in EJB3.0 as per the spec. But this is being proposed in EJB3.1.

Originally posted by Kevin Cloutier:
2) When creating a client application, I understand from the text I am reading I must include the Interface class file within my client.jar in order for it to work correctly (i.e. InterfaceClassNameLocal.class or InterfaceClassNameRemote.class). Is there any other way? What if I were building an application which utilized EJBs that I did not have access to the source, but were deployed on the server? (by the way, this isn't the case, but it struck me as limiting so I thought I would ask.)


You should have the bean interfaces in the client classpath. However, you need not have the bean implementation class in the client's classpath.
 
Kevin Cloutier
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Awesome, thanks. That was quick!
 
Bill Shirley
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can access a remote interface locally (it may non-ideally message the request, I'm not sure).

You should define a different local interface for something you only want to be able to access from the server.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!