Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

EJBs and standalone apps

 
Binkie Hayes
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi gang.. am experiencing a bit confusion regarding how standalone applications/applets etc can interact with EJBs. The J2EE spec doesn't require that these sort of applications are able to call EJBs directly (i.e. RMI-IIOP, JNDI etc), however some vendors will provide this capability. This suggests to me that the vendor has to do something special to allow RMI-IIOP to be available to the client. Surely it's just a matter of including the RMI package in the JAR that's downloaded from the web server? If this is not the case, what exactly needs to be provided? Do the new Java extension mechanisms help in any way?
Many thanks for your help
cheers
 
Mohamed Yousuff
Ranch Hand
Posts: 73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Definitely it is possible to access ejb from a standalone application. Even the documentation of EJB kit ( j2sdkee ) from sun has many examples demonstrating this. You will better understand if you read the documentation. Download J2sdkee documentation from www.javasoft.com
 
Binkie Hayes
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mohamed
many thanks for your help, however I haven't been able to find any explanations on the website as to how this is achieved. I have had a good read of a great deal of the J2EE documentation, but I can't seem to find out the information as to how exactly standalone applications can call EJBs. Perhaps I am looking in the wrong place? Any futher information would be greatly appreciated. MAny thanks for your help and support
 
Mike Curwen
Ranch Hand
Posts: 3695
IntelliJ IDE Java Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you go to this link: http://www.javasoft.com/j2ee/j2sdkee/techdocs/guides/ejb/html/DevGuideTOC.html
Almost all of the examples in this developer's guide use "stand alone" clients to access EJB's through RMI-IIOP. A few of them use JSP and "J2EE Clients" as well.. but most are 'stand alone'
 
Binkie Hayes
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Mike
thanks a million for this - there's some great info here. I think I may have caused a lot of confusion over the way I asked my question - not very good at phrasing techie queries I'm afraid. The root of what I want to know is actually connected to applets - I was wondering if it would be possible for an applet to communicate directly with an EJB without going via some sort of JSP or servlet. Based on my (rather hazy!) understanding, the applet would have to use RMI over IIOP, but there's a good chance it wouldn't have the standard extension for this available for use on the client machine, so I think it'd have to download it. However, as far as my understanding goes, extensions that contain native code can't be downloaded, only installed. So I was wondering, does the RMI-IIOP extension contain native code? If so, how would an applet running on a client be able to access this extension to communicate with an EJB directly? Is this possible at all? Or is there any other way that anyone knows of an applet communicating with an EJB? Does this even make sense???!!! Any enlightenment would be greatly appreciated :-)
thanks a mill for the helpful response

 
Tim Holloway
Saloon Keeper
Pie
Posts: 18027
47
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Actually, I'm not sure RMI-IIOP is an essential part of EJB. I think at least some are just basic RMI. Anyway, I had a project that required applet-to-EJB interaction not long ago. My biggest problem was that a lot of places have firewalls! Many of our customers wouldn't even allow FTP, much less RMI.
The solution to this was http tunnelling. The applet opened a URL connection to a servlet running on the host. The servlet then did the actual interaction with the EJBs.
It's a little more overhead, but it saves a whole lot of headaches.
 
Binkie Hayes
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Tim
yep, this is exactly what I had to do as well. It's actually much better as well, cos the business logic was encapsulated in the servlets, which meant that other interfaces could be added on with minimum impact - if the applets were interacting directly with EJBs all this work would have to be recoded for each interface. I know it's not such a good idea, I'm just really interested to know if in theory it's possible, and how it works. I can't seem to find anything on the net about it. It's the same theory with JDBC - can applets interact directly with a database through JDBC, or do they always have to go via servlets or JSPs?
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic