Win a copy of Learn Spring Security (video course) this week in the Spring forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Accessing EJB from a Swing Client

 
Torsten Oppermann
Ranch Hand
Posts: 62
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
kurt hanni
Ranch Hand
Posts: 140
Eclipse IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
kurt hanni
Ranch Hand
Posts: 140
Eclipse IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 140
Eclipse IDE Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 62
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok great, thank you very much !
 
Torsten Oppermann
Ranch Hand
Posts: 62
Android Java PHP
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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:

 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic