NoClassDefFoundError occurs after running embed-server or jdr.sh alongside an active JBoss EAP 7.x/8.x server

Solution Verified - Updated

Environment

  • Red Hat JBoss Enterprise Application Platform (EAP)
    • 7.x
    • 8.x

Issue

  • Application error such as NoClassDefFoundError happens on JBoss EAP 7.x/8.x after starting embed-server in JBoss-CLI (or executing $JBOSS_HOME/bin/jdr.sh) beside running server
  • Starting embed-server (either directly via JBoss-CLI or indirectly via $JBOSS_HOME/bin/jdr.sh with incorrect connection details) while a JBoss EAP instance is running will delete the active server's tmp/vfs directory. This action removes critical class files, causing application failures with NoClassDefFoundError.
  • Your application running on JBoss EAP unexpectedly fails with NoClassDefFoundError after you use the JBoss-CLI embed-server command or run the $JBOSS_HOME/bin/jdr.sh diagnostic script.

Resolution

Root Cause

  • By design, JBoss EAP clears the tmp/vfs/ directory upon startup. This behavior also applies to the embed-server.
  • If embed-server is started while another JBoss EAP server instance is running, it can delete the same "tmp/vfs" directory that the running server is currently using. This directory contains extracted JARs with application classes and libraries.
  • The removal of these files can lead to NoClassDefFoundError if the application attempts to load a class that is no longer present.
  • Similarly, JDR ($JBOSS_HOME/bin/jdr.sh) may internally start the embed-server to gather information if it fails to connect to the specified management IP address/port (localhost:9990 by default). An incorrect IP address or port will trigger this behavior, causing it to delete the active server's tmp/vfs/ directory and potentially leading to the same error.

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.