Skip Headers

Oracle® Containers for J2EE Enterprise JavaBeans Developer's Guide 10g Release 3 (10.1.3) B14428-01 |
| Home | Solution Area | Contents | Index

Previous | Next |

# Troubleshooting an EJB Application

This section describes:

- Validating XML Files

- Debugging the ejb-jar.xml File

- Debugging Generated Code

## 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-3 shows how to set this option in the `oc4j.cmd` file.

Example 31-3 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

You can configure OC4J to write out the `ejb-jar.xml` file it creates based on your EJB 3.0 annotations (see "Troubleshooting Application Deployment").

See also "Validating XML Files".

## Debugging Generated Code

By default, when OC4J deploys an 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:

- Preserving Generated Code in the Default Directory

- Preserving Generated Code in a Directory You Specify

- Disabling Generated Code Preservation

### Preserving Generated Code in the Default Directory

If you set system property `KeepWrapperCode` to `true`, OC4J preserves the wrapper code it generates in the default directory `<OC4J_HOME>/j2ee/home/application-deployments/<ear-name>/<ejb-name>/generated`.

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

### Preserving Generated 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.

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.

### Disabling Generated Code Preservation

If you set system property `KeepWrapperCode` to `false` (or leave this system property unset), OC4J will not preserve the wrapper code it generates.