How to diagnose classloading issues in JBoss EAP 5.x with Tattletale

Solution Verified - Updated

Environment

  • JBoss Enterprise Application Platform (EAP) 5.x
  • JBoss Service Oriented Architecture (SOA-P) 5.x

Issue

  • What are some methods of diagnosing classloading issues such as ClassNotFoundException, LinkageError, UnsupportedClassVersionError, and others in JBoss EAP 5.x?
  • ERROR: JAR file confilct
  • Can I use jmx-console or admin console to list the application's effective classpath? As I am debugging a Class Not Found Error

Resolution

Review the full server.log and locate the first classloading exception.

Please run the attached JBoss Tattletale jar. JBoss Tattletale is a project started on jboss.org that generates reports about the classes and dependencies of a jar/war/ear.

To run the report:

  • Download the tattletale-eap5.jar attached to this article.
  • Then execute Tattletale (with JDK 1.6 or later):
    java -Xmx512m -jar tattletale-eap5.jar yourapplication.war report
    zip -r report.zip report/

It will output several reports in the report folder as html pages. If you are running Tattletale for a support case, please zip up the report directory and attach it to your case.

NOTE: Tattletale looks for classes in application, if there are no classes available in application then it would make sense that it would not generate a report, hence there must be a class in your application while creating tattletale report.

ClassNotFoundException and NoClassDefFoundError typically are thrown because the class is not in the classpath, which could be because of the packaging of the application or the classloader isolation settings specified. Look at the Tattletale Report: Class Location to locate where it is packaged and compare to the isolation settings & Java EE classpath defined for the particular deployment type.

ClassCastException typically is thrown because a class is loaded in two different classloaders, and an object is being created from one classloader and passed to an application using the other. Look at the Tattletale Report: Class Location to see if the API/IMPL class is packaged more than once in the application. Look at the Tattletale Report: Packaged JDK / J2EE Classes, Packaged JBoss Classes to see if JBoss is packaging the API / IMPL and check your isolation settings.

LinkageError typically is from a mismatch between an API jar & Implementation jar. Look at Tattletale Report: Packaged JDK / J2EE Classes, Packaged JBoss Classes.

UnsupportedClassVersionError thrown because JBoss is being run with an older version of Java than JBoss was compiled on. JBoss EAP 5.x must be run on JDK 6. JBoss EAP 5.2 and JBoss EAP 6 are certified on JDK 7.

Do not use symlinks in the JBoss path if possible. VFS has issues with this and can cause ClassNotFoundException and NoClassDefFoundError. There is a KCS here describing a bug that was fixed and configuration to avoid issues with symlinks.

Trace logging could be enabled on org.jboss.classloader.spi.base.BaseClassLoader, but it logs quite a bit of information.

Related Solutions

How to diagnose ClassNotFoundException / NoClassDefFoundError issues in JBoss EAP 6.x

Components
Category

This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.