undera / perfmon-agent

Server metrics fetching agent, based on SIGAR
Apache License 2.0
397 stars 138 forks source link

Cant start the agent - NoClassDefFoundError #22

Open spleshakov opened 3 years ago

spleshakov commented 3 years ago

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
NathanVss commented 2 years ago

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

Kavabungoz commented 2 years ago

Same problem on Windows 10

ilcors-dev commented 1 year ago

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:

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.