Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Invoking EJB from standalone java client in JBoss7  RSS feed

 
Bhavesh Sangwan
Ranch Hand
Posts: 62
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi there ! I'm new to ejb. Using Eclipse and Jboss server. I've deployed an EJB and now want to invoke it using a standalone java program. I know that Eclipse and JBoss do some job to bind JNDI names. I just want to know that how to lookup EJB by which JNDI binding out of 6 options available (shown in deployment console) there.

Here I'm dropping all my java code and server/console logs please help...

LibrarySessionBeanRemote



LibrarySessionBean


jndi.properties


jboss-ejb-client.properties


EJBTester


After deployment, when I run EJBTester.java, I'm getting the following server logs...


Please also observe property files if any mistake I made here...
And I also hv disabled the security-realm of JBoss to remove extra disturbances....
 
Michael Remijan
Author
Ranch Hand
Posts: 131
7
Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Typically if you want to use an EJB you use it inside of the EE server. However, if you are writing an stand alone application what you need to do is run you application inside the EE application client container. This is not something which is used much. Typically (and much more easy) is to expose your EJB functionality as a RESTful or full Web Service and have your client call them. However if you want to use the EJB, your application need to run inside the EE application client container. I don't know how JBoss does it, but basically what you do is execute a command which comes with your EE server to "wrap" your application with the EE server's application client container. You'll need to research how JBoss does this.
 
Rob Spoor
Sheriff
Posts: 21044
85
Chrome Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That's not necessary Michael. If the EJB is running in an existing application, then you can access them from standalone programs (or even other applications) through their remote interfaces. You need to look them up explicitly though, no injection.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!