Skip Headers
Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide
10g (10.1.3.5.0)

Part Number E13981-01
Go to Documentation Home
Home
Go to Book List
Book List
Go to Table of Contents
Contents
Go to Index
Index
Go to Feedback page
Contact Us

Go to previous page
Previous
Go to next page
Next
View PDF

Troubleshooting an EJB Application

This section describes the following:

Validating XML Files

To configure OC4J to validate XML files, add the -validateXML option to the command line used in the OC4J start up script (<OC4J_HOME>/BIN/oc4j.cmd or oc4j).

Example 31-7 shows how to set this option in the oc4j.cmd file.

Example 31-7 Setting -validateXML in oc4j.cmd

...
"%JAVA_HOME%\bin\java" %JVMARGS% -jar %OC4J_JAR% %CMDARGS% -validateXML
...

With this option set, OC4J strictly validates XML files against their specified schema when OC4J reads them. OC4J logs any errors (see "Configuring EJB Logging").

Debugging the ejb-jar.xml File

When you deploy an EJB 3.0 application with one or more annotations, OC4J will automatically write its in-memory ejb-jar.xml file to the same location as the orion-ejb-jar.xml file in the deployment directory: <ORACLE_HOME>/j2ee/home/application-deployments/my_application/META-INF.

This ejb-jar.xml file represents configuration obtained from both annotations and a deployed ejb-jar.xml file (if present).

When you deploy an EJB 2.1 application, to preserve generated wrapper code, you musts set system property KeepWrapperCode (see "Debugging Generated Wrapper Code").

See also "Validating XML Files".

Debugging Generated Wrapper Code

By default, when OC4J deploys an EJB 2.1 CMP application, it generates wrapper code in <OC4J_HOME>/j2ee/home/application-deployments/<ear-name>/<ejb-name>/generated, compiles it, creates a JAR file that contains the compiled classes, and then deletes the wrapper code it generates.

You can configure OC4J to preserve the wrapper code that it generates. Examining the wrapper code can aid in debugging some application problems.

This section describes the following:

Note:

Debugging generated wrapper code is deprecated in this release.

These options apply only to EJB 2.1 entity beans with container-managed persistence: they do not apply to session beans, message-driven beans, or EJB 3.0 entities. OC4J generates only one file for each EJB 2.1 entity bean with container-managed persistence. OC4J does not generate any artifacts if you use only EJB 3.0 entities.

Preserving Generated Wrapper Code in the Default Directory

To configure OC4J to preserve generated code, set system property KeepWrapperCode to true on the OC4J startup command line, as Example 31-8 shows for the <OC4J_HOME>/bin/oc4j.cmd file.

Example 31-8 Setting KeepWrapperCode in oc4j.cmd

...
"%JAVA_HOME%\bin\java" %JVMARGS% -DKeepWrapperCode=true -jar "%OC4J_JAR%" %CMDARGS% 
...

When KeepWrapperCode is true, OC4J preserves the wrapper code it generates in the default directory <OC4J_HOME>/j2ee/home/application-deployments/<ear-name>/<ejb-name>/generated. Alternatively, you can specify the directory OC4J uses to preserve wrapper code (see "Preserving Generated Wrapper Code in a Directory You Specify").

If you undeploy your application, OC4J deletes the wrapper code in this directory.

Preserving Generated Wrapper Code in a Directory You Specify

If you set both system property KeepWrapperCode to true and system property WrapperCodeDir to a directory (call it <specified-wrapper-dir>), OC4J generates wrapper code to this directory and preserves the wrapper code even if you undeploy the application, as Example 31-9 shows for the <OC4J_HOME>/bin/oc4j.cmd file.

Example 31-9 Setting KeepWrapperCode and WrapperCodeDir in oc4j.cmd

...
"%JAVA_HOME%\bin\java" %JVMARGS% -DKeepWrapperCode=true -DWrapperCodeDir=C:\wrappers -jar "%OC4J_JAR%" %CMDARGS% 
...

The <specified-wrapper-dir> may be absolute (such as C:\wrappers) or relative (such as ./wrappers): relative paths are relative to <OC4J_HOME>/j2ee/home.

If OC4J cannot generate to the directory you specify (for example, due to a permission problem or lack of space), OC4J generates wrapper code to the default directory <OC4J_HOME>/j2ee/home/application-deployments/<ear-name>/<ejb-name>/generated and preserves this wrapper code even if you undeploy the application.

Modifying Generated Wrapper Code

If you set both system property KeepWrapperCode to true and system property DoNotReGenerateWrapperCode to true, OC4J generates wrapper code and preserves the wrapper code even if you undeploy the application, as Example 31-10 shows for the <OC4J_HOME>/bin/oc4j.cmd file. In this case, when you redeploy, OC4J will not regenerate wrapper code, but instead will use the version of wrapper code in the default directory ("Preserving Generated Wrapper Code in the Default Directory") or in the directory you specified (see "Preserving Generated Wrapper Code in a Directory You Specify").

Example 31-10 Setting KeepWrapperCode and DoNotReGenerateWrapperCode in oc4j.cmd

...
"%JAVA_HOME%\bin\java" %JVMARGS% -DKeepWrapperCode=true -DDoNotReGenerateWrapperCode=true -jar "%OC4J_JAR%" %CMDARGS% 
...

Using these system properties, you can modify wrapper code, for example, to add debugging statements, and when you redeploy, OC4J recompiles and uses the preserved version of wrapper code that you modified.

Disabling Generated Wrapper Code Preservation

To disable generated wrapper code perservation, set system property KeepWrapperCode to false and system property DoNotReGenerateWrapperCode to false, or leave these system properties unset.