In this case you would need to have separate .war and .jar files. Deploy the .war file in the webserver in 1 machine and deploy the .jar file in the app server in another machine. While accessing the bean from the web application you might have to specify the url of the initial context factory to access to bean. Also you may have to pass the credentials of the LDAP.
If you open the box, you will find Heisenberg strangling Shrodenger's cat. And waving this tiny ad: