Recommended: Sing it, brah! 5 fabulous songs for developers
JW's Top 5
Optimize with a SATA RAID Storage Solution
Range of capacities as low as $1250 per TB. Ideal if you currently rely on servers/disks/JBODs
Page 6 of 6
-Djava.naming.factory.initial=
com.evermind.server.ApplicationClientInitialContextFactory
-Djava.naming.provider.url=ormi://localhost:23791/myapplication
-Djava.naming.security.principal=admin
-Djava.naming.security.credentials=password
The above command line arguments specify that OC4J is the JNDI provider. Furthermore, it tells OC4J to expose the resources
within the application myapplication.
OC4J provides two different classes as the JNDI provider:
com.evermind.server.ApplicationClientInitialContextFactorycom.evermind.server.rmi.RMIInitialContextFactoryFor a discussion about which class to choose, see the chapter on JNDI from the Oracle9iAS Containers for J2EE Services Guide.
Here is how CarEjbTest is run for OC4J in Eclipse:
Figure 5. VM arguments are provided to a JUnit test that calls a remote OC4J server. Click on thumbnail to view full-sized image.
OpenEJB's boot time is just a few seconds. You may recall that in the project I work on, we have 300 classes and 10 EJB components. In embedded mode, OpenEJB runs within the test's JVM. On our laptop, it takes almost three seconds for OpenEJB and the tests to start. There is no need to redeploy or empty the cache when the same test runs repeatedly.
To save even more time, you can use XStream to generate input data in XML for the tests. When testing, XStream simply saves you from punching the same input data repeatedly.
Frequently testing EJB components usually proves time-consuming. Several frameworks try to reduce the time it takes to test EJB components, but these frameworks often require you to learn framework-specific features. As illustrated in this article, using OpenEJB as an embedded container not only significantly reduces the time it takes to test EJB components, but also build and deploy them as well.
Thanks to David Blevins and Fredrik Harloff for reviewing and commenting on this article.
Read more about Enterprise Java in JavaWorld's Enterprise Java section.
Archived Discussions (Read only)