File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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
JavaRanch » Java Forums » Products » JBoss/WildFly
Bookmark "web & application server" Watch "web & application server" New topic

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)?

Peter Johnson

Joined: May 14, 2008
Posts: 5852

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

Joined: Jul 20, 2005
Posts: 10441

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:
subject: web & application server
It's not a secret anymore!