permaculture playing cards*
The moose likes JBoss/WildFly and the fly likes web & application server Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "web & application server" Watch "web & application server" New topic
Author

web & application server

John Pradeep.v
Ranch Hand

Joined: Jul 21, 2008
Posts: 59
Hello All,
I am new to Jboss... i am trying to understand the high level architecture of Jboss to start with, what i understood is that Jboss integrates tomcat into Jboss as a service to support web applications. But i do want to understand how does a web application deployed in tomcat (jboss service) can identify and interact with the EJBs deployed separately on the same Jboss server.
What would happen if i use EJB annotations like "@Resource" in classes present in the web application? since the tomcat will have its own class loader structure, how does the dependency injection will work for the classes present in the web application (loaded by tomcat) when we try to inject EJBs?

Another question - how does the web server generally interact with the application sever? is it always through sockets? or is it different for different types of EJBs (local & remote)?


Thanks
John
Peter Johnson
author
Bartender

Joined: May 14, 2008
Posts: 5836
    
    7

When you use @Resource (or @EJB) in your web app, JBoss AS gives you a proxy object for the referenced object. Elsewhere, JBoss AS instantiates the EJB. When your web app makes method calls on the EJB, the call is handled by the proxy and passed to the EJB. If the EJB is @Local, this is usally suimpky a pointer handoff. If the EJB is @Remote this might involve marshaling and unmarshaliing the parameters and return value but usually JBioss AS is smart enough to see that the web app and servelet are running in the same JVM and thus handles it like @Local.

If you need more detail than that, Jaikiran will have to provide it - he works on the EJB team and can provide specifics (and also tell you where I am wrong...)


JBoss In Action
Jaikiran Pai
Marshal

Joined: Jul 20, 2005
Posts: 10202
    
166

Peter's right (nothing new about that ) on how the EJB container and the web container work internally.

[My Blog] [JavaRanch Journal]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: web & application server