Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g Release 3 (10.1.3)
B14428-02
  Go To Documentation Library
Home
Go To Product List
Solution Area
Go To Table Of Contents
Contents
Go To Index
Index

Previous
Previous
 
Next
Next
 

27 Packaging an EJB Application

This section describes:

For more information, see:

Packaging an Application with Both EJB 3.0 and EJB 2.1 EJBs

You can combine both EJB 3.0 and EJB 2.1 beans in your application. For example, you could have an application that contains three annotated EJB 3.0 entities without ejb-jar.xml, two EJB 2.1 entity beans with ejb-jar.xml, and three EJB 3.0 session beans with ebj-jar.xml, annotations, or both (in which case, the ejb-jar.xml overrides the annotations).

Sharing Classes Between EJB Applications

If you want to share classes between EJBs, you can do one of the following:

If you want to share classes between EJB and Web applications, you should place the referenced classes in a shared JAR.

If you receive a ClassCastException, then you probably have the following situation:

To solve this problem, either eliminate the copied classes out of the WAR file or turn off the search_local_classes_first attribute. This attribute tells the class loader to load in the classes in the WAR file before loading in any other classes, including the classes within the EJB JAR file. For more information on this attribute, see the "Loading WAR File Classes Before System Classes in OC4J" section in the "Servlet Development" chapter of the Oracle Containers for J2EE Servlet Developer's Guide.

Handling Out of Memory Exceptions at Runtime

If you see that the OC4J memory is growing consistently while executing, then you may have invalid symbolic links in your application.xml file. OC4J loads all resources using the links in the application.xml file. If these links are invalid, then the C heap continues to grow causing OC4J to run out of memory. Ensure that all symbolic links are valid and restart OC4J.

In addition, keep the number of JAR files to a minimum in the directories where the symbolic links point. Eliminate all unused JARs from these directories. OC4J searches all JARs for classes and resources; thus, taking time and memory consumption by the file cache, as well as being mapped into the address space.

Handling Class Cast Exceptions at Runtime

When you have an EJB or Web application that references other shared EJB classes, you should place the referenced classes in a shared JAR. In certain situations, if you copy the shared EJB classes into WAR file or another application that references them, you may receive a ClassCastException because of a class loader issue. To be completely safe, never copy referenced EJB classes into the WAR file of its application or into another application.