'mvn -P developer -pl developer -Ddeploydb' greets me below error:
[INFO]
[INFO] --- exec-maven-plugin:1.2.1:java (create-schema) @ cloud-developer ---
========> WARNING: Provided file does not exist:
/home/frank/dev/incubator-cloudstack/utils/conf/db.properties.override
[WARNING]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:297)
at java.lang.Thread.run(Thread.java:679)
Caused by: java.lang.ExceptionInInitializerError
at com.cloud.upgrade.DatabaseCreator.main(DatabaseCreator.java:160)
... 6 more
Caused by: com.cloud.utils.exception.CloudRuntimeException: File db.properties
not found
at
com.cloud.utils.crypt.EncryptionSecretKeyChecker.check(EncryptionSecretKeyChecker.java:142)
at com.cloud.utils.db.Transaction.<clinit>(Transaction.java:101)
... 7 more
Caused by: java.io.FileNotFoundException:
file:/home/frank/.m2/repository/org/apache/cloudstack/cloud-utils/4.1.0-SNAPSHOT/cloud-utils-4.1.0-SNAPSHOT-tests.jar!/db.properties
(No such file or directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:137)
at
com.cloud.utils.crypt.EncryptionSecretKeyChecker.check(EncryptionSecretKeyChecker.java:65)
after looking into it, I think it's a bug that everyone would encounter, but to
my surprise it seems as if only I suffer it.
The cause is in EncryptionSecretKeyChecker.java
@Override
public void check() {
//Get encryption type from db.properties
final File dbPropsFile = PropertiesUtil.findConfigFile("db.properties");
final Properties dbProps = new Properties();
... ....
PropertiesUtil.findConfigFile will search file in classpath first, and
unfortunately cloud-utils-4.1.0-SNAPSHOT-tests.jar does have db.properties
packaged in it, then it's returned as the first match.
As it's a file in JAR it can not be opened as ordinary file that why the
exception happens.
I don't know why we have utils/conf/db.properties, can anyone tell me its
purpose? And does anyone else encountered this bug?