Jetty has moved!
Jetty is a project at the Eclipse Foundation.
Homepage:http://www.eclipse.org/jetty
Downloads: http://download.eclipse.org/jetty/
Documentation:http://www.eclipse.org/jetty/documentation/current/
About:http://www.eclipse.org/jetty/about.php
Jetty Powered:http://www.eclipse.org/jetty/powered/
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
Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Next »

Jetty and Spring EJB3 (Pitchfork)

Pitchfork is an add-on for the Spring Framework performing JSR-250 dependency injection, annotation processing and EJB 3.0-style interception, developed jointly by Interface21 and BEA Systems.

It is simple to use in conjunction with Jetty.

At the time of writing, the integration with Pitchfork is checked in to jetty svn trunk, but will be released with 6.1.0 final. Until then, it will be first necessary to checkout and build jetty.

Once jetty is built, make a new directory: $jetty.home/lib/ext/spring. Copy the jar from $jetty.home/extras/spring/target into it. Also copy all of the jars from the Pitchfork download into it.

Developing a webapp using EJB3

The JEE tutorial will take you through how to create EJB3 classes.

Here's an extremely simple example of a stateless session bean showing some of the JEE annotations:

We would declare this class in a META-INF/spring-ejb-jar.xml file. That file can reside in a jar if you're packaging your ejbs into jars, or you can make a WEB-INF/classes/META-INF/ directory if your ejbs are just part of your webapp.

The spring-ejb-jar.xml file for the above bean looks like:

Next, you can make some classes that use @EJB notation to inject references to your beans. Here's another stupidly simple class that uses the com.acme.EchoBean ejb:

In order to have Pitchfork notice that the com.acme.EchoTest class wants to reference the com.acme.EchoBean ejb, we declare it in the Spring WEB-INF/applicationContext.xml file:

  • No labels
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