Solutions
Archived

Embedded OpenDJ tools fail in OpenAM 13.5.x with an Unable to load class or Could not find or load main class error

Last updated Jan 5, 2021

The purpose of this article is to provide assistance if you receive an "Unable to load class org.opends.server.backends.jeb.JEBackend" or "Could not find or load main class org.opends.server.tools" error when attempting to use embedded OpenDJ tools (such as dsreplication, import-ldif or ldapsearch) in OpenAM.


1 reader recommends this article

Archived

This article has been archived and is no longer maintained by ForgeRock.

Symptoms

The following error is shown when embedded OpenDJ tools such as import-ldif fail in OpenAM:

[25/08/2016:17:19:43 +0000] category=TOOLS seq=0 severity=SEVERE msg=Unable to load class org.opends.server.backends.jeb.JEBackend referenced in configuration entry ds-cfg-backend-id=userRoot,cn=Backends,cn=config for use as a Directory Server backend: ClassNotFoundException(org.opends.server.backends.jeb.JEBackend)

You may also see errors similar to the following when embedded OpenDJ tools such as dsreplication or ldapsearch fail if you have upgraded to OpenAM 13.5.x:

Error: Could not find or load main class org.opends.server.tools.dsreplication.ReplicationCliMain Error: Could not find or load main class org.opends.server.tools.LDAPSearch

Recent Changes

Upgraded to, or installed OpenAM 13.5.x.

Causes

The necessary JE libraries are missing from the embedded OpenDJ installation in OpenAM 13.5.x, which cause the embedded OpenDJ tools to fail with the "Unable to load class" error.

  • OpenAM 13.5 - missing both the opendj-je-backend.jar and je.jar files.
  • OpenAM 13.5.1 and 13.5.2 - missing the opendj-je-backend.jar file only. The je.jar file has been replaced with a forgerock-je.jar file, which is included in the install.

The opendj.jar file is missing from the embedded OpenDJ installation in OpenAM 13.5.x if you have upgraded to OpenAM (instead of doing a fresh install); this can cause the "Could not find or load main class" errors when attempting to use the embedded OpenDJ tools.

Solution

These issues can be resolved as follows depending on which error(s) you are encountering and your version:

"Unable to load class" error (OpenAM 13.5.1 and 13.5.2):

  1. Copy the opendj-je-backend.jar file from the /path/to/tomcat/webapps/openam/WEB-INF/lib/ directory where OpenAM is deployed to the $HOME/[openam_instance]/opends/lib directory.

"Unable to load class" error (OpenAM 13.5):

  1. Copy the opendj-je-backend.jar and je-5.0.104.jar files from the /path/to/tomcat/webapps/openam/WEB-INF/lib/ directory where OpenAM is deployed to the $HOME/[openam_instance]/opends/lib directory.
  2. Rename the je-5.0.104.jar to je.jar.

"Could not find or load main class" error (OpenAM 13.5.x)

  1. Navigate to the following directory: /path/to/tomcat/webapps/openam/WEB-INF/template/opendj
  2. Unzip the opendj.zip file: $ unzip opendj.zip
  3. Copy the opendj.jar file from the exploded lib directory to the embedded OpenDJ lib directory: $HOME/[am_instance]/opends/opends/lib/
Note

You can also prepare the original OpenAM 13.5.x war file to include these files to ensure any future installs are not affected by this issue. You should add the required files to the WEB-INF/template/opendj/opendj.zip and recompile the OpenAM 13.5.x war file.

See Also

N/A

Related Training

N/A

Related Issue Tracker IDs

OPENAM-9715 (Embedded OpenDJ backup and verify-index fails in OpenAM 13.5.0)

OPENAM-9593 (Embedded OpenDJ installation is missing JE libraries)


Copyright and Trademarks Copyright © 2021 ForgeRock, all rights reserved.