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.
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop