Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Migrated to Confluence 5.3

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:

Code Block
xml
xml
<plugins>
<plugin>
  <groupId>org.mortbay.jetty</groupId>
  <artifactId>jetty-maven-plugin</artifactId>
  <version>7.0.0pre2</version>
  <configuration>
    <webAppConfig>
      <parentLoaderPriority>true</parentLoaderPriority>
    </webAppConfig>
  </configuration>
  <dependencies>
    <dependency>
     <groupId>com.sun</groupId>
     <artifactId>appserv-rt</artifactId>
     <version>1.0</version>
     <scope>system</scope>
     <systemPath>${glassfish.lib}/appserv-rt.jar</systemPath>
    </dependency>
    <dependency>
     <groupId>com.sun</groupId>
     <artifactId>javaee</artifactId>
     <version>1.0</version>
     <scope>system</scope>
     <systemPath>${glassfish.lib}/javaee.jar</systemPath>
    </dependency>
  </dependencies>
 </plugin>
</plugins>
 <properties>
   <glassfish.lib>your/glassfish/install/lib/goes/here</glassfish.lib>
 </properties>
Contact the core Jetty developers at www.webtide.com
private support for your internal/customer projects ... custom extensions and distributions ... versioned snapshots for indefinite support ... scalability guidance for your apps and Ajax/Comet projects ... development services from 1 day to full product delivery