This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
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
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
Joined: Mar 14, 2001
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
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
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.
An IDE is no substitute for an Intelligent Developer.
Joined: Mar 14, 2001
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?