Hi,
I'm quite new to S4 and I need help to make commons-configuration work and,
at the same time, to understand how the classpath works in S4.
I'm using an application.properties config file that holds DB connection
details and other stuff, but when the application is deployed in a node it
can't find that file.
src/
main/
java/
com/
...
resources/
application.properties
logback.xml
when I build the s4r file, the application.properties file is located both
in myapp.jar and at root level of the myapp.s4r:
s4:~/apps/cepEngine/build/libs> unzip -l myapp.s4r
Archive: myapp.s4r
Length Date Time Name
-------- ---- ---- ----
0 04-24-13 12:35 META-INF/
297 04-24-13 12:35 META-INF/MANIFEST.MF
840 04-24-13 12:35 logback.xml
180 04-24-13 12:35 application.properties
0 04-24-13 12:06 app/
80847 04-24-13 12:08 app/cepEngine.jar
0 04-24-13 12:35 lib/
246709 04-24-13 12:35 lib/logback-classic-1.0.0.jar
327911 04-24-13 12:35 [....]
s4:~/apps/cepEngine/build/libs> jar tvfapp/cepEngine.jar
0 Wed Apr 24 12:08:56 CEST 2013 META-INF/
297 Wed Apr 24 12:08:56 CEST 2013 META-INF/MANIFEST.MF
0 Wed Apr 24 12:06:44 CEST 2013 com/
0 Wed Apr 24 12:06:44 CEST 2013 com/... A lot of classes
.........................................
840 Wed Apr 24 12:06:44 CEST 2013 logback.xml
180 Wed Apr 24 12:06:44 CEST 2013 application.properties
In a first attempt, application.properties was only included within the
cepEngine.jar. Later, I copied the file to the root of the myapp.s4r, but
still when I deploy the application in a node I always get this error on
the console:
12:43:50.773 [ZkClient-EventThread-13-localhost:2181] ERROR
c.e.d.cep.utils.Configuration - Error reading application.properties
org.apache.commons.configuration.ConfigurationException: Cannot locate
configuration source application.properties
at
org.apache.commons.configuration.AbstractFileConfiguration.load(AbstractFileConfiguration.java:217)
~[commons-configuration-1.6.jar:1.6]
How should I solve this?
Thanks