This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
Correct me if I m wrong. First thing I wanted to clear you. Two JVM's need not be two seperate machines, it can be two managed servers too. So bind those managed servers in to a cluster and delpoy your ear on to that Cluster.
If you are not looking for that... You can't directly deploy ear on two JVM's which leads to ClassLoader problem. So, bind your beans to a .jar and your client to .war then deploy it noramlly. Now add the .jar to your server class path which resolves the issue. Or we have some tools which creates a client ".jar" meaning the files which are required by client. That will also resolve the things I belive.
So when we deploy ear then both client part and bean part will be on the same machine��then application will not de deployed on two or more jvms.
Most of the time ear file is used for deployment then mostly client part and ejb part both will be deployed on one server one jvm.
I think you want your JSP/Servlet code and EJB Code to be deployed in different servers. You can do it. Have all the EJB code in an EAR an deployed in "Server1". Have the Home, Remote Interfaces and Stubs (EJB client jar) along with the JSP, Servlets in a seperate war and deploy it in the "server2". When the Servlets or Business Delegates call the EJB use the JNDI and url of "Server1" for EJB lookup. You could use properties file in the classpath to read the ejb server url. Hope ths helps.