aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Accessing EJB from a Swing Client Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Accessing EJB from a Swing Client" Watch "Accessing EJB from a Swing Client" New topic
Author

Accessing EJB from a Swing Client

Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

Hello ! I have trouble figuring out how to access an EJB from a remote Swing/SE Client running on a different machine. I tried the example in the official tutorial, but its somewhat unclear.

I assume, that i need the Business Interface of the EJB on the client side as well ?

A little example would be awesome

Thank you


OCPJP 6 - 93%
kurt hanni
Ranch Hand

Joined: Aug 11, 2007
Posts: 140

Yes you need the remote business interface on the client side.

put "gf-client.jar" in your classpath, then access the bean using JNDI lookup.


SCJA, SCJP, SCJD, SCMAD, SCWCD, SCBCD, SCDJWS, SCEA, SOA, Spring Certified, OCP MySQL 5 Developer, PMP
kurt hanni
Ranch Hand

Joined: Aug 11, 2007
Posts: 140

Client App

Remote interface


then access the bean using JNDI lookup

Remote interface and bean implementation class should be in "ejb-app" application.

remember put gf-client.jar in your client-app classpath (im using glassfish server for my ejb-app)
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

Thank you very much, that was exactly what i was looking for.

So this can be very server specific ? or is it always some kind of Jar, like for JBoss ?

I also use Glassfish, but im curious
kurt hanni
Ranch Hand

Joined: Aug 11, 2007
Posts: 140

other containers have corresponding client.jar, like for jboss you use the jbossall-client.jar in client applications for JNDI lookups
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

ok great, thank you very much !
Torsten Oppermann
Ranch Hand

Joined: Dec 22, 2010
Posts: 62

i tried your example, slightly modified today and ran into some problems. Here is what i did:

on the glassfish server is deployed:


and



on the client side with gf-client.jar and javaee-api-6.0.jar as additional libraries:



and finally the client:



any ideas ? here the errors i get:

 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Accessing EJB from a Swing Client