Skip to Content

To find the root cause for NoClassDefFoundError logged in the default trace files you have to do the following:

1.  Use the exception stacktrace to find the name of the classloader which has tried to load the class definition.

 2. Use the exception stacktrace to find the name of the class which definition is missing.

 3. Open the SAP Telnet Console and use llr telnet command to check whether the missing class is already loaded from some JAR file. Using this information you can find also and the application which loads that class.

 4. The root cause for NoClassDefFoundError is that the application which tries to load the class has WEAK reference (defined in /META-INF/application-j2ee-engine.xml) to the component which provides this class.

 5. Find all WEAK references form this application using app_refs_graph telnet command

 6. If some of the WEAK referenced components are not started, start them and check on every step whether the class is already loaded. So you will find which application provides the missing class.

 7. You have 2 options here:

 –          Redeploy the application, after changing the WEAK references to HARD

 –          Add the referenced application to startup filters using the configtool.

For example lets imagine that we have the following exception stacktrace:

com.sap.engine.services.deploy.exceptions.ServerDeploymentException: Exception while [preparing start of application sap.com/tc~kmc~bc.rf.ws~rfws~ear].

at com.sap.engine.services.deploy.server.application.StartTransaction.prepareCommon(StartTransaction.java:378)

Caused by: java.lang.NoClassDefFoundError: com/sapportals/wcm/repository/IPropertyNameList

Now you can use the telnet console command llr to find the JAR from where this class is loaded:

>llr -all -f com/sapportals/wcm/repository/IPropertyNameList.class

This command returned the location of the JAR file from where the class was loaded. It starts with:

/usr/sap/E50/J50/j2ee/cluster/apps/sap.com/com.sap.netweaver.bc.rf/servlet_jsp…

So we found that this class was provided by sap.com/com.sap.netweaver.bc.rf application.

Now you can use app_refs_graph command to list the WEAK references of sap.com/tc~kmc~bc.rf.ws~rfws~ear application:

app_refs_graph sap.com/tc~kmc~bc.rf.ws~rfws~ear -dir=to -printRes |grep WEAK

This will list the application sap.com/com.sap.netweaver.bc.rf and it status is STARTED.

The NoClassDefFoundError was caused by the fact that the Deploy Service does not guaratee the start of applications referenced with WEAK references and even that it is STARTED now, it was STOPPED during the start of sap.com/tc~kmc~bc.rf.ws~rfws~ear.

As a workaround you can add sap.com/com.sap.netweaver.bc.rf to the startup filters using the config tool.

To report this post you need to login first.

3 Comments

You must be Logged on to comment or reply to a post.

Leave a Reply