Closed piavlo closed 10 years ago
Is that the full stack trace? The NPE doesn't actually inclue any https://github.com/apache/cassandra/blob/cassandra-2.0.9/src/java/org/apache/cassandra/service/CassandraDaemon.java#L396 code
Looks like your system property is pointing to the wrong place. The null reference is almost certainly from the getResource call chained with get file.
See: http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String) On Aug 4, 2014 9:29 AM, "cburroughs" notifications@github.com wrote:
Is that the full stack trace? The NPE doesn't actually inclue any https://github.com/apache/cassandra/blob/cassandra-2.0.9/src/java/org/apache/cassandra/service/CassandraDaemon.java#L396 code
— Reply to this email directly or view it on GitHub https://github.com/addthis/metrics-reporter-config/issues/9#issuecomment-51059485 .
I suppose since it is printing the location, and it looks like what you expect, it could be a permissions thing. I'd double check that and the exact path/ name. On Aug 4, 2014 10:35 AM, "Ian Barfield" ian@addthis.com wrote:
Looks like your system property is pointing to the wrong place. The null reference is almost certainly from the getResource call chained with get file.
See: http://docs.oracle.com/javase/7/docs/api/java/lang/ClassLoader.html#getResource(java.lang.String) On Aug 4, 2014 9:29 AM, "cburroughs" notifications@github.com wrote:
Is that the full stack trace? The NPE doesn't actually inclue any https://github.com/apache/cassandra/blob/cassandra-2.0.9/src/java/org/apache/cassandra/service/CassandraDaemon.java#L396 code
— Reply to this email directly or view it on GitHub https://github.com/addthis/metrics-reporter-config/issues/9#issuecomment-51059485 .
@tea-dragon There is no permissions issue with the file or path to the file it's fully readable by everyone also if i rename the file i do not get any message/exception.
@cburroughs how do i get a full stack trace? I've tried changing INFO logging level to DEBUG and TRACE which caused the the log to be very verbose but the NPE is still same as with INFO level with no extra stack trace info.
I can't imagine why renaming the file would help... maybe you can elaborate on that. Also, this looks like it is using a ClassLoader, so maybe you should double check your java class path. Unless you are using a custom class loader, I doubt it will find files without being included therein.
On Mon, Aug 4, 2014 at 3:45 PM, piavlo notifications@github.com wrote:
@tea-dragon https://github.com/tea-dragon There is no permissions issue with the file or path to the file it's fully readable by everyone also if i rename the file i do not get any message/exception.
@cburroughs https://github.com/cburroughs how do i get a full stack trace? I've tried changing INFO logging level to DEBUG and TRACE which caused the the log to be very verbose but the NPE is still same as with INFO level with no extra stack trace info.
— Reply to this email directly or view it on GitHub https://github.com/addthis/metrics-reporter-config/issues/9#issuecomment-51107757 .
I meant that the first line of the stack trace was in a.o.cassandra code, it isn't even getting to any code in metrics-reporter-config. I wanted to make sure part of the stack trace wasn't getting cut off somewhere.
Try putting your metrics.yaml
file in the cassandra conf directory and loading it with just -Dcassandra.metricsReporterConfigFile=metrics.yaml
. If that works then your problem is probably some funky java classloader thing. You may need to use a file://
junk in your url.
@tea-dragon - sorry i was not clear enough , i did not meant it helps but just that it does nothing then i give it nonexisting file path
@cburroughs using -Dcassandra.metricsReporterConfigFile=metrics.yaml indeed solve the issue tnx a lot for the help
Same issue. @cburroughs solutions helped to resolve it. Thanks for the question and answer. !!!
I am facing the same issue using Cassandra 3.5.0 on Windows 7. I tried the above suggestion (of @cburroughs) , but I still get a FileNotFoundException as below (though I have the `metrics-reporter-config.yaml' in the correct directory). I have checked permissions of the file, anyone can access and edit. I am using metrics-graphite-3.1.0.jar.
Exception:
java.io.FileNotFoundException: C:\Program%20Files\DataStax-DDC\apache-cassandra\conf\metrics-reporter-config.yaml (The system cannot find the path specified)
at java.io.FileInputStream.open0(Native Method) ~[na:1.8.0_91]
at java.io.FileInputStream.open(FileInputStream.java:195) ~[na:1.8.0_91]
at java.io.FileInputStream.
AbstractReporterConfig.java:40 is:
InputStream input = new FileInputStream(new File(fileName));
There's nothing to it. Is C:\Program%20Files\DataStax-DDC\apache-cassandra\conf\metrics-reporter-config.yaml
a valid path? Specially, %20
is the URL encoded value of space - I don't think that's a valid file path. You can easily test it with the above one-liner java code - I don't have Windows otherwise I would've done it.
Yes, you are right. Thank You. I made it work by reinstalling Cassandra into a path which has folder names with no spaces. I don't know if it is possible to handle the above error in any different way. If possible, can you suggest any way to do so?
It has to do with how cassandra finds the config file - it uses the classloader to find resource URL, then just calls URL#getFile()
on it. Special characters, such as space, are url encoded, and getFile
method doesn't do anything smarter with it, so you end up with an invalid file path. The relevant code is here:
Line number don't quite match with your stack trace, because I can't find the right tag, but I doubt the code is very different.
INFO 11:10:24,963 Completed flushing /var/lib/cassandra/data/system/local/system-local-jb-76-Data.db (5298 bytes) for commitlog position ReplayPosition(segmentId=1470211824179, position=193311) INFO 11:10:24,978 Node localhost/127.0.0.1 state jump to normal INFO 11:10:24,994 Trying to load metrics-reporter-config from file: gangliaReporting.yaml ERROR 11:10:25,016 Tried to enable GangliaReporter, but class com.yammer.metrics.reporting.GangliaReporter was not found
Please guide me on how to proceed. I would like to monitor the cassandra metrics onto ganglia.
then using the metrics-reporter-config with cassandra , no matter what reporter configuration i use(graphite,riemann,console) i always get this
INFO [main] 2014-08-03 21:27:01,911 CassandraDaemon.java (line 393) Trying to load metrics-reporter-config from file: /etc/cassandra/metrics.yaml WARN [main] 2014-08-03 21:27:01,912 CassandraDaemon.java (line 401) Failed to load metrics-reporter-config, metric sinks will not be activated java.lang.NullPointerException at org.apache.cassandra.service.CassandraDaemon.setup(CassandraDaemon.java:396) at org.apache.cassandra.service.CassandraDaemon.activate(CassandraDaemon.java:496) at org.apache.cassandra.service.CassandraDaemon.main(CassandraDaemon.java:585)
i've tried the reporter-config 2.1.0 that comes with cassandra 2.0.9 as well versions 2.2.0 and 2.4.0-SNAPSHOT build from the repo with relevant reporters jars(and dependencies) deployed under cassandra lib dir the result is always the same error , even for console reporter config like this
i've verified that /etc/cassandra/metrics.yaml is valid yaml file any clues what can be wrong?