13.07.2015 Views

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

Java™ Application Development on Linux - Dator

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

22.2 EJBs: You D<strong>on</strong>’t Know Beans?501unmarshaled, they d<strong>on</strong>’t have to be serializable. For some applicati<strong>on</strong>s, this isthe <strong>on</strong>ly way that they can use beans.Finally, keep in mind that the choice of local versus remote interfaces isnot necessarily an either-or choice. For our sessi<strong>on</strong> bean we have defined bothkinds of interfaces. Then the deployment can determine which <strong>on</strong>e will be used.22.2.6 Compiling Your BeansIn order to compile these bean-related Java classes, you need to have a J2EEJAR in your classpath. If you’ve installed JBoss into /usr/local/jboss, youcould add the JAR to your classpath this way:export CLASSPATH="/usr/local/jboss/client"\"/jboss-j2ee.jar:.:${CLASSPATH}"If you have the Sun J2EE reference implementati<strong>on</strong> installed <strong>on</strong> yoursystem (in /usr/local), then you could use:export CLASSPATH="/usr/local/SUNWappserver"\"/lib/j2ee.jar:.:${CLASSPATH}"If you have Ger<strong>on</strong>imo installed <strong>on</strong> your system (with an envir<strong>on</strong>mentvariable GHOME to hold its locati<strong>on</strong>), then you would use: 1export CLASSPATH="${GHOME}/repository/ger<strong>on</strong>imo-spec/jars"\"/ger<strong>on</strong>imo-spec-j2ee-1.0-M1.jar:.:${CLASSPATH}"In any case, the point is to have in your classpath the JAR file whichc<strong>on</strong>tains the javax/ejb/ classes, such as EJBObject.class. If you haven’tinstalled <strong>on</strong>e of these c<strong>on</strong>tainers <strong>on</strong> your machine, then download a copy ofthe JAR from the machine where that c<strong>on</strong>tainer is installed. Put your copysomewhere in your classpath, as in the examples above.1. Our JAR is named ger<strong>on</strong>imo-spec-j2ee-1.0-M1.jar but yours will likely have a differentname by the time the J2EE-certified versi<strong>on</strong> of Ger<strong>on</strong>imo is available. It may likely justhave the trailing -M1 dropped from the name; check in the ger<strong>on</strong>imo-spec/jars directory.Another opti<strong>on</strong> is to use any of the J2EE JARs, for example, from the Sun reference implementati<strong>on</strong>.That’s the advantage of standards. Any of them should work for this compilati<strong>on</strong> step.The resulting compiled code should be deployable to any server. “Compile <strong>on</strong>ce, runanywhere,” right?

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!