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