views:

126

answers:

1

Hello guys!

I am starting a new enterprise project and use Glassfish 3 as an application server and NetBeans 6.9 as an IDE. I have some EJBs which I want to access remotely from a desktop Swing application. AFAIK there are two options - either use plain JNDI lookup or run the Swing application in an application-client container and use @EJB annotations. I tried successfully the first option but I had to copy all glassfish libraries to satisfy the dependencies(about 50MB, which I don't find normal). Now I try the second option. In NetBeans, I create a new Enterprise Application Client project, add the EJB project as a dependency and press run. I get the following exception: Sniffers with type [ejb] and type [appclient] should not claim the archive at the same time. Now if I remove the package checkbox, next to the EJB project in the Project properties of application client, I get a different ClassNotFound exception of my remote interface.

I feel kind of stuck:( Could some more experienced guys, tell me how do they access their EJBs remotely, using Glassfish 3? As I have written above, I succeed with the first option, but 50MB are too much in my opinion for a simple client.

Edit: What approach would you choose for deployment and remote access from the client, if you have the business logic in ejbs on a remote server?

Thanks for any suggestions you have!

Wish you all the best, Petar

A: 

I think the best approach in your case is to create a Servlet (or some other light simple component) in your server and make this guy talk to your EJB. If you choose this case, you will isolate your client/server comunication and your business logic implementation.

Plínio Pantaleão
Thanks for the answer. But I have chosen EJB, so the remote communication is easier through a well defined @Remote interface. Also I won't have a web GUI, why create a servlet then and use HTTP communication? Isn't it too low level and artifical?
Petar Minchev
Yes, it is. But if you want to avoid all the application server dependencies, i think this may be an approach. Of course, the best way is have a true EJB communication with all dependencies in your client application. In some cases it may be a problem (I have an client WebStart application with 87MB, but our customer use it in a private network, so its not a problem here).
Plínio Pantaleão