perfmon-agent icon indicating copy to clipboard operation
perfmon-agent copied to clipboard

Cant start the agent - NoClassDefFoundError

Open spleshakov opened this issue 4 years ago • 3 comments

Using either version of the agent 2.2.3 or 2.2.1, I get the following error which running startAgent.sh

spleshakov-MacBook-Pro:ServerAgent-2.2.3 spleshakov$ java -version
java version "11.0.2" 2019-01-15 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.2+9-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.2+9-LTS, mixed mode)

spleshakov-MacBook-Pro:ServerAgent-2.2.3 spleshakov$ sh ./startAgent.sh 
ERROR: java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
*** Problem's technical details go below ***
Home directory was detected as: /Users/spleshakov/Downloads/ServerAgent-2.2.3
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
	at org.apache.jorphan.logging.LoggingManager.getLoggerForClass(LoggingManager.java:122)
	at kg.apc.perfmon.AgentTool.<clinit>(AgentTool.java:17)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.base/java.lang.Class.newInstance(Class.java:584)
	at kg.apc.cmdtools.PluginsCMD.getToolInstance(PluginsCMD.java:113)
	at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:51)
	at kg.apc.cmdtools.PluginsCMD.processParams(PluginsCMD.java:23)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
	at kg.apc.cmd.UniversalRunner.main(UniversalRunner.java:174)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
	at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:471)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:588)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:521)
	... 15 more

spleshakov avatar Aug 30 '21 20:08 spleshakov

I'm facing the same issue on my mac mini Big Sur :(

NathanVss avatar Jan 14 '22 12:01 NathanVss

Same problem on Windows 10

Kavabungoz avatar Apr 04 '22 18:04 Kavabungoz

Not knowing if anyone is still interested in the matter, today I had the same problem. Here's how I fixed it.

The error message you are seeing indicates that the required class org.slf4j.LoggerFactory is not found in the classpath.

To resolve this issue, you need to add the required SLF4J JAR files to the classpath of the server agent.

Here are the steps you can follow:

  • Download the latest version of the SLF4J framework from the official website (http://www.slf4j.org/download.html).
  • Extract the downloaded archive and locate the slf4j-api-x.x.x.jar and slf4j-simple-x.x.x.jar files.
  • Copy the two JAR files to the lib folder of the PerfMon Metrics Collector plugin directory.
  • Restart the server agent.

After performing these steps, the server agent should be able to load the org.slf4j.LoggerFactory class and the PerfMon Metrics Collector plugin should be able to collect the required system-level metrics.

ilcors-dev avatar Mar 09 '23 17:03 ilcors-dev