Communicating to remote Glassfish EJBs from a Jetty webapp

Firstly, follow the instructions on the Glassfish site regarding how to modify your code to provide the right set of properties to your InitialContext to permit remote JNDI lookups.

Then, copy the jars required from your Glassfish installation to a new $JETTY_HOME/lib/ext/glassfish directory.

For jetty stand-alone, that is pretty much all you should need to do.

For running your webapp with the convenient maven jetty plugin, you need to put those jars onto the execution path of the plugin, and ensure that your webapp uses parent-first classloading, due to quirks of CORBA classloading. Here's an example of how your pom would look: