javanetbeansglassfishejbapplication-client

EJB remote application-client


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


Solution

  • 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.