aspose file tools*
The moose likes JBoss/WildFly and the fly likes How to generate stubs Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "How to generate stubs" Watch "How to generate stubs" New topic
Author

How to generate stubs

Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
Hi,

As we know the clients would interact with the stubs of Home and Remote interface implementation objects. But how do we generate the stubs after the beans, Home and Remote interfaces are created from a JBoss server. I have my Bean,Home, Remote interfaces , ejb-jar.xml and Jboss.xml are all packaged to a jar file and deployed in JBoss. But how does an application client communicate with these beans with out having the stubs. Please let me know, if there is any command or mechanism to generate stubs which can be provided to client.


Thanks & Regards, SK
SCJP 5.0, DB2 - 800, DB2 - 803, SCDJWS (On the way)
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

I am going to guess that you are talking about EJB 2.x (you never said).

The client does not need stubs. All the client needs are the Remote and Remote Home interfaces. Your client looks up the remote home proxy using JNDI and from the proxy obtains the the home proxy.


JBoss In Action
Schandha Ravi
Ranch Hand

Joined: Oct 20, 2007
Posts: 167
Hi Peter ,

Yes I meant to use ejb 2.1. But would you mind elaborating on your statement


All the client needs are the Remote and Remote Home interfaces. Your client looks up the remote home proxy using JNDI and from the proxy obtains the the home proxy.


In many books I read, it is mentioned that client needs a stub to communicate to the remote objects as client and remote objects do not share a common heap and stubs play a vital role in passing the request , attributes to the remote objects and they are network aware objects.

Please explain your statement.

Thanks
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5823
    
    7

I think what you are reading concerns the underlying "plumbing" provided by the client JARs for the EJB container. So what the JBoss client code is doing for you is creating stubs. But the code you write does not have to be concerned with that.

For example, my client code looks something like this:

SomeEjbRemoteHome rh = (SomeEjbRemoteHome)context.lookup(SomeEjbRemoteHome.JNDI_NAME);
SomeEjbRemote ejb = rh.create();
// at this point I can call the methods declared on the EJB
ejb.someMethod();

Notice the my code doesn't have to worry about any stubs, and that the two interfaces, SomeEjbRemoteHome and SomeEjbRemote, are the same interfaces used by my EJB on the server.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to generate stubs