Closed tcrossland closed 8 years ago
Thanks for the detailed report @tcrossland . I'm investigating.
@tcrossland can you please give us one more details please: is jmxtrans-config.xml
contained in a jar or is on the file system?
It's in one of the jars on the classpath (i.e. it's copied from src/main/resources by maven, or in this case, SBT). The same (opaque) classpath URI works with 1.2.2 of jmxtrans-agent.
I'm happy to continue using 1.2.2, just thought it would be useful to create the issue in case anyone else has the problem.
Thanks @tcrossland. I have just verified that the problem does not happen with a config file on the file system :-)
I suspect that you can workaround prefixing the filename with /
.
Can you try to reproduce with https://oss.sonatype.org/content/repositories/snapshots/org/jmxtrans/agent/jmxtrans-agent/1.2.4-SNAPSHOT/jmxtrans-agent-1.2.4-20160525.221853-2.jar
You should have a better exception message. I'm based in France and it's late, I'll continue to investigate tomorrow.
Cyrille
I tried using a leading /
(classpath:///jmxtrans-config.xml
and classpath:/jmxtrans-config.xml
) but both failed with an NPE (I've lost the stacktrace from my terminal scrollback, also a bit late here in Spain!). In any case, no hurry, 1.2.2 is working fine.
@cyrille-leclerc I suspect the problem is at org.jmxtrans.agent.util.io.ClasspathResource.getFile()
- AFAIK, it is not possible to create File
objects for files that reside within a jar file. We probably will have to work with only the stream when reading configuration from within a jar.
@kerlandsson good catch! I'm fixing
@tcrossland I am working on a fix on my fork https://github.com/cyrille-leclerc/jmxtrans-agent/commit/8d853c872cddfd04d6928f5143df4d61f5ceb23a
I did not have the time to finish my tests but this should do the job. Would you have the time to verify?
I'll try tomorrow and let you know. Thanks for the quick fix!
Sorry, haven't found time to test it yet... will get round to it soon.
@cyrille-leclerc Hi, finally got round to testing the snapshot version, works correctly loading classpath resources. Many thanks!
The io.resource framework introduced in jmxtrans-agent 1.2.3 causes a load-time failure if the classpath URI is not hierarchical. For example: