{"action":"created","issue":{"url":"https://api.github.com/repos/realityforge/gelf4j/issues/11","labels_url":"https://api.github.com/repos/realityforge/gelf4j/issues/11/labels{/name}","comments_url":"https://api.github.com/repos/realityforge/gelf4j/issues/11/comments","events_url":"https://api.github.com/repos/realityforge/gelf4j/issues/11/events","html_url":"https://github.com/realityforge/gelf4j/issues/11","id":93607377,"number":11,"title":"How to track down the root cause of a ClassNotFoundException","user":{"login":"gtaylor","id":75556,"avatar_url":"https://avatars.githubusercontent.com/u/75556?v=3","gravatar_id":"","url":"https://api.github.com/users/gtaylor","html_url":"https://github.com/gtaylor","followers_url":"https://api.github.com/users/gtaylor/followers","following_url":"https://api.github.com/users/gtaylor/following{/other_user}","gists_url":"https://api.github.com/users/gtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/gtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtaylor/subscriptions","organizations_url":"https://api.github.com/users/gtaylor/orgs","repos_url":"https://api.github.com/users/gtaylor/repos","events_url":"https://api.github.com/users/gtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/gtaylor/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2015-07-07T19:18:49Z","updated_at":"2015-07-07T21:54:05Z","closed_at":"2015-07-07T21:54:05Z","body":"Hello,\r\n\r\nI am attempting to set up gelf4j with datastax-agent, which is a daemon that the commercial version of Cassandra (DataStax Enterprise) uses to manage nodes in a cluster. It uses log4j 1.2.17 and Java 8.\r\n\r\nHere is the command my startup script runs:\r\n\r\n```\r\n/usr/lib/jvm/java-8-oracle/jre/bin/java -Xmx128M -Djclouds.mpu.parts.magnitude=100000 -Djclouds.mpu.parts.size=16777216 -cp /usr/share/datastax-agent/lib/json-simple-1.1.jar -cp /usr/share/datastax-agent/lib/getopt4j-1.1.jar -cp /usr/share/datastax-agent/lib/gelf4j-1.9.jar -Dopscenter.ssl.trustStore=/var/lib/datastax-agent/ssl/agentKeyStore -Dopscenter.ssl.keyStore=/var/lib/datastax-agent/ssl/agentKeyStore -Dopscenter.ssl.keyStorePassword=opscenter -Dagent-pidfile=/var/run/datastax-agent/datastax-agent.pid -Dlog4j.configuration=file:/etc/datastax-agent/log4j.properties -Djava.security.auth.login.config=/etc/datastax-agent/kerberos.config -jar /usr/share/datastax-agent/datastax-agent-5.1.3-standalone.jar /var/lib/datastax-agent/conf/address.yaml\r\n```\r\n\r\nHere is the error I'm seeing:\r\n```\r\nlog4j:ERROR Could not instantiate class [gelf4j.log4j.GelfAppender].\r\njava.lang.ClassNotFoundException: gelf4j.log4j.GelfAppender\r\n\tat java.net.URLClassLoader.findClass(URLClassLoader.java:381)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:424)\r\n\tat sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:331)\r\n\tat java.lang.ClassLoader.loadClass(ClassLoader.java:357)\r\n\tat java.lang.Class.forName0(Native Method)\r\n\tat java.lang.Class.forName(Class.java:264)\r\n\tat org.apache.log4j.helpers.Loader.loadClass(Loader.java:198)\r\n\tat org.apache.log4j.helpers.OptionConverter.instantiateByClassName(OptionConverter.java:327)\r\n\tat org.apache.log4j.helpers.OptionConverter.instantiateByKey(OptionConverter.java:124)\r\n\tat org.apache.log4j.PropertyConfigurator.parseAppender(PropertyConfigurator.java:785)\r\n\tat org.apache.log4j.PropertyConfigurator.parseCategory(PropertyConfigurator.java:768)\r\n\tat org.apache.log4j.PropertyConfigurator.configureRootCategory(PropertyConfigurator.java:648)\r\n\tat org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:514)\r\n\tat org.apache.log4j.PropertyConfigurator.doConfigure(PropertyConfigurator.java:580)\r\n\tat org.apache.log4j.helpers.OptionConverter.selectAndConfigure(OptionConverter.java:526)\r\n\tat org.apache.log4j.LogManager.<clinit>(LogManager.java:127)\r\n\tat org.slf4j.impl.Log4jLoggerFactory.getLogger(Log4jLoggerFactory.java:66)\r\n\tat org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:270)\r\n\tat org.slf4j.LoggerFactory.getLogger(LoggerFactory.java:281)\r\n\tat com.datastax.driver.core.Cluster.<clinit>(Cluster.java:65)\r\n\tat java.lang.Class.forName0(Native Method)\r\n\tat java.lang.Class.forName(Class.java:264)\r\n\tat clojurewerkz.cassaforte.client__init.__init0(Unknown Source)\r\n\tat clojurewerkz.cassaforte.client__init.<clinit>(Unknown Source)\r\n\tat java.lang.Class.forName0(Native Method)\r\n\tat java.lang.Class.forName(Class.java:348)\r\n\tat clojure.lang.RT.loadClassForName(RT.java:2098)\r\n\tat clojure.lang.RT.load(RT.java:430)\r\n\tat clojure.lang.RT.load(RT.java:411)\r\n\tat clojure.core$load$fn__5018.invoke(core.clj:5530)\r\n\tat clojure.core$load.doInvoke(core.clj:5529)\r\n\tat clojure.lang.RestFn.invoke(RestFn.java:408)\r\n\tat clojure.core$load_one.invoke(core.clj:5336)\r\n\tat clojure.core$load_lib$fn__4967.invoke(core.clj:5375)\r\n\tat clojure.core$load_lib.doInvoke(core.clj:5374)\r\n\tat clojure.lang.RestFn.applyTo(RestFn.java:142)\r\n\tat clojure.core$apply.invoke(core.clj:619)\r\n\tat clojure.core$load_libs.doInvoke(core.clj:5413)\r\n\tat clojure.lang.RestFn.applyTo(RestFn.java:137)\r\n\tat clojure.core$apply.invoke(core.clj:619)\r\n\tat clojure.core$require.doInvoke(core.clj:5496)\r\n\tat clojure.lang.RestFn.invoke(RestFn.java:805)\r\n\tat opsagent.cassandra$loading__4910__auto__.invoke(cassandra.clj:1)\r\n\tat opsagent.cassandra__init.load(Unknown Source)\r\n\tat opsagent.cassandra__init.<clinit>(Unknown Source)\r\n\tat java.lang.Class.forName0(Native Method)\r\n\tat java.lang.Class.forName(Class.java:348)\r\n\tat clojure.lang.RT.loadClassForName(RT.java:2098)\r\n\tat clojure.lang.RT.load(RT.java:430)\r\n\tat clojure.lang.RT.load(RT.java:411)\r\n\tat clojure.core$load$fn__5018.invoke(core.clj:5530)\r\n\tat clojure.core$load.doInvoke(core.clj:5529)\r\n\tat clojure.lang.RestFn.invoke(RestFn.java:408)\r\n\tat clojure.core$load_one.invoke(core.clj:5336)\r\n\tat clojure.core$load_lib$fn__4967.invoke(core.clj:5375)\r\n\tat clojure.core$load_lib.doInvoke(core.clj:5374)\r\n\tat clojure.lang.RestFn.applyTo(RestFn.java:142)\r\n\tat clojure.core$apply.invoke(core.clj:619)\r\n\tat clojure.core$load_libs.doInvoke(core.clj:5413)\r\n\tat clojure.lang.RestFn.applyTo(RestFn.java:137)\r\n\tat clojure.core$apply.invoke(core.clj:619)\r\n\tat clojure.core$require.doInvoke(core.clj:5496)\r\n\tat clojure.lang.RestFn.invoke(RestFn.java:2793)\r\n\tat opsagent.opsagent$loading__4910__auto__.invoke(opsagent.clj:1)\r\n\tat opsagent.opsagent__init.load(Unknown Source)\r\n\tat opsagent.opsagent__init.<clinit>(Unknown Source)\r\n\tat java.lang.Class.forName0(Native Method)\r\n\tat java.lang.Class.forName(Class.java:348)\r\n\tat clojure.lang.RT.loadClassForName(RT.java:2098)\r\n\tat clojure.lang.RT.load(RT.java:430)\r\n\tat clojure.lang.RT.load(RT.java:411)\r\n\tat clojure.core$load$fn__5018.invoke(core.clj:5530)\r\n\tat clojure.core$load.doInvoke(core.clj:5529)\r\n\tat clojure.lang.RestFn.invoke(RestFn.java:408)\r\n\tat clojure.lang.Var.invoke(Var.java:415)\r\n\tat opsagent.opsagent.<clinit>(Unknown Source)\r\nlog4j:ERROR Could not instantiate appender named \"gelf\".\r\n INFO [main] 2015-07-07 19:13:09,190 Loading conf files: /var/lib/datastax-agent/conf/address.yaml\r\n  INFO [main] 2015-07-07 19:13:09,234 Java vendor/version: Java HotSpot(TM) 64-Bit Server VM/1.8.0_45\r\n  INFO [main] 2015-07-07 19:13:09,235 DataStax Agent version: 5.1.3\r\n```\r\n\r\nThe top-level jar file is `/usr/share/datastax-agent/datastax-agent-5.1.3-standalone.jar`. I created a `/usr/share/datastax-agent/lib/` directory to stick new dependencies under. That datastax-agent jar has a bunch of other stuff wrapped up within, so I resorted to manually plucking dependencies from maven central. See my command string above for the -cp entries for the new jar files.\r\n\r\nConsequently, here is what my /lib directory looks like:\r\n\r\n* /usr/share/datastax-agent/lib/json-simple-1.1.jar\r\n* /usr/share/datastax-agent/lib/getopt4j-1.1.jar\r\n* /usr/share/datastax-agent/lib/gelf4j-1.9.jar\r\n\r\nI'm a Java newbie, so any help with figuring out how to diagnose this would be awesome. If I can get this figured out, I'd love to blog about using gelf4j with Cassandra, since they would make a great pair."},"comment":{"url":"https://api.github.com/repos/realityforge/gelf4j/issues/comments/119353857","html_url":"https://github.com/realityforge/gelf4j/issues/11#issuecomment-119353857","issue_url":"https://api.github.com/repos/realityforge/gelf4j/issues/11","id":119353857,"user":{"login":"gtaylor","id":75556,"avatar_url":"https://avatars.githubusercontent.com/u/75556?v=3","gravatar_id":"","url":"https://api.github.com/users/gtaylor","html_url":"https://github.com/gtaylor","followers_url":"https://api.github.com/users/gtaylor/followers","following_url":"https://api.github.com/users/gtaylor/following{/other_user}","gists_url":"https://api.github.com/users/gtaylor/gists{/gist_id}","starred_url":"https://api.github.com/users/gtaylor/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gtaylor/subscriptions","organizations_url":"https://api.github.com/users/gtaylor/orgs","repos_url":"https://api.github.com/users/gtaylor/repos","events_url":"https://api.github.com/users/gtaylor/events{/privacy}","received_events_url":"https://api.github.com/users/gtaylor/received_events","type":"User","site_admin":false},"created_at":"2015-07-07T21:54:05Z","updated_at":"2015-07-07T21:54:05Z","body":"Looks like -cp and -jar are mutually exclusive. I got this working by passing in -cp and replacing the -jar + args with the entrypoint class."}}