Purge through Command Line Fails with NoClassDefFoundError

Purge through Command Line Fails with NoClassDefFoundError

book

Article ID: KB0076666

calendar_today

Updated On:

Products Versions
TIBCO MDM ALL

Description

Executing purge script through command line(datacleanup.bat/sh) may experience following errors related to class ref not found.

D:\tibco\mdm\9.1\bin>datacleanup.bat -o record -an XXXXX -rn XXXXX -p XXXXX -mn XXXX -pwd XXXXX
 where --- -an is enterprise name of the repository located -rn is repository name  -p is productkeyid's(You can get the same from catalog table using below query) of the records to be deleted. select cproductkeyid  from MCT_XXXXX where cproductid in ('XXXXX','XXXXX') -mn is the member(user) name of the user who has admin role. -pwd is the password of the respective user


D:\tibco\mdm\9.1\bin>echo off
Invoking Cpath Java program
"D:\java\jre1.8.0_201"\bin\java -DMQ_HOME="D:\tibco\mdm\9.1" -DNODE_ID=Member1 -DMQ_COMMON_DIR="" -DMQ_CONFIG_FILE="D:\tibco\mdm\9.1\config\ConfigValues.xml" -classpath D:\app\IBM\WebSphere\AppServer\lib\j2ee.jar;D:\tibco\mdm\9.1\lib\external\*;;D:\app\IBM\WebSphere\AppServer\lib\websphere.jar;D:\app\IBM\WebSphere\AppServer\runtimes\com.ibm.ws.admin.client_6.1.0.jar;D:\app\IBM\WebSphere\AppServer\lib\naming.jar;D:\app\IBM\WebSphere\AppServer\lib\iwsorb.jar;D:\app\IBM\WebSphere\AppServer\java\jre\lib\ext\mail.jar;D:\app\IBM\WebSphere\AppServer\java\jre\lib\ext\activation.jar;D:\tibco\mdm\9.1\lib\mq\AllECMClasses.jar; com.tibco.mdm.purge.PurgeHelper -o record -an XXXXXX -rn XXXXX -p XXXXX -mn XXXX -pwd password
MqStartup: Main configuration file: D:\tibco\mdm\9.1\config\ConfigValues.xml
****The root directory is : 3 ****C:\Users\XXXXX
Parameters:Exec Mode =record, Enterprise ID =null, Enterprise Name =XXXXX, Repository ID =null, Repository Name =EIMR_MANDATE_DOSE, Data sources ID =null, Data source name =null, Member ID =null, Member Name =XXXXXX, EventID =null, RecordKey ID =3571135, VersionsToRetain =3, Retention Days =90, IsChained =false, Purge Log File =PURGE1574070324208.log, all Enterprises =false, all Data sources =false, all repositories =false, hints =null, bulk mode (reserved) =null, archive data =null, interval =null, Start Date =null, End Date =null, Limit =null, Purge Policy =null, Incremental =null, Purge job name =null, User defined file name =null,Password is not null
Initiating purge for Sydney
Exception in thread "main" java.lang.NoClassDefFoundError: org/hibernate/HibernateException
at com.tibco.mdm.infrastructure.util.InitClassUtil.onLoadClassException(InitClassUtil.java:818)
at com.tibco.mdm.infrastructure.util.InitClassUtil.loadClass(InitClassUtil.java:356)
at com.tibco.mdm.infrastructure.util.InitClassUtil.createObject(InitClassUtil.java:106)
at com.tibco.mdm.infrastructure.util.InitClassUtil.createObject(InitClassUtil.java:85)
at com.tibco.mdm.integration.handlers.CommunicationInitializer.initSSL(CommunicationInitializer.java:206)
at com.tibco.mdm.integration.handlers.CommunicationInitializer.init(CommunicationInitializer.java:109)
at com.tibco.mdm.util.test.InitUtil.initCommInitializer(InitUtil.java:60)
at com.tibco.mdm.purge.PurgeHelper.main(PurgeHelper.java:2340)
Caused by: java.lang.ClassNotFoundException: org.hibernate.HibernateException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)


Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/log4j/Logger
        at com.tibco.mdm.util.logging.MqLog.<clinit>(MqLog.java:50)
        at com.tibco.mdm.infrastructure.globalobj.MqStartup.<clinit>(MqStartup.java:80)
        at com.tibco.mdm.purge.PurgeHelper.main(PurgeHelper.java:2326)
Caused by: java.lang.ClassNotFoundException: org.apache.log4j.Logger
        at java.net.URLClassLoader.findClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
        at java.lang.ClassLoader.loadClass(Unknown Source)
        ... 3 more

User-added image

Issue/Introduction

Executing the Purge Script through command line will throw an error with missing dependencies

Environment

ALL

Resolution

These class references are related to external jars (viz hibernate,Log4j etc..) which would be located under MQ_HOME\lib\external directory.While running the purge script it is unable to locate the references because of missing class path reference.

To avoid these exceptions,we need to set external jar reference(MQ_HOME\lib\external) to the class path.
LINUX:
PATH=$PATH:MQ_HOME/lib/external
export PATH

WINDOWS:
set PATH=MQ_HOME\lib\external

Note: If the Application server is Websphere(WAS),then the JAVA_HOME should point to /apps/IBM/WebSphere9/AppServer/java/8.0(WAS server path) directory.
 By including the jar's reference to the Class Path and setting all Environment variables purge script will execute successfully as below. User-added image For more information about purge using command Line utility and different execution modes refer below System Administration documentation. https://docs.tibco.com/pub/mdm/9.1.0/doc/html/GUID-2AC464D9-FA0D-450A-B26B-0BD9C834F59C.html 

Additional Information

Attachments

Purge through Command Line Fails with NoClassDefFoundError get_app