You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@empire-db.apache.org by Tim Colson <ti...@yahoo.com> on 2011/04/14 00:21:26 UTC

Problems in docs for running example-basic

I managed to get the basic example to run in both Eclipse and Intellij IDEA after some effort troubleshooting. 

Here are observations on the docs/tutorial info that were confusing or incorrect.

I pulled down the distro and expanded into /appdev, cd /appdev/apache-empire-db-2.1.0-incubating/src, and then ran mvn idea:idea. The project opened in Intellij IDEA, ran SampleApp.java... gives an error saying it cannot get the config value for empireDBDriverClass which suggests config.xml file was found, but can't load that node. 

I switched to Eclipse since the docs mention it specifically....

The website Getting started and Tutorial instructions incorrectly say to import empire-db-2.0.0/examples/DBSample which does not exist in the 2.1 distro. The Tutorial PDF inside the distro is more accurate for the path, but says to use mvn eclipse:eclipse, but the README.txt says "mvn clean install" to build and  "mvn clean eclipse:eclipse -DdownloadSources=true" - so I did both steps. 

I imported the projects Eclipse, but it complained of a missing "M2_REPO" variable. I googled and fixed and the sample ran!

I went back to Intellij IDEA, and on a hunch checked the working directory. It was set to the root of the src folder, so I set it to  empire-db-example-basic. The sample ran fine! :-)

I guessed that the config.xml wasn't actually loading, but the error is misleading. I reviewed XMLConfiguration.java, line 114, FileNotFoundException, but since log4j reported a problem initializing, I added a System.out.println() and re-ran - it printed that config.xml was not found. 

Suggestions: 
* update the Tutorial and Getting Started docs to align with the current release
* maybe add a footnote for Intellij users to make sure to set the working directory so the config.xml is loaded. 
* Review logging setup - since until config is loaded, the log system isn't init'd so the log message about not being able to load the file fails.

Cheers!
-Tim

Intellij IDEA -- error....

log4j:WARN No appenders could be found for logger (org.apache.empire.commons.ErrorType).
log4j:WARN Please initialize the log4j system properly.
Running DB Sample...
*** Step 1: getJDBCConnection() ***
*** Step 2: getDatabaseProvider() ***
java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'
	at org.apache.empire.samples.db.SampleApp.getDatabaseDriver(SampleApp.java:201)
	at org.apache.empire.samples.db.SampleApp.main(SampleApp.java:85)
java.lang.RuntimeException: java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'
java.lang.RuntimeException: java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'
	at org.apache.empire.samples.db.SampleApp.getDatabaseDriver(SampleApp.java:221)
	at org.apache.empire.samples.db.SampleApp.main(SampleApp.java:85)
Caused by: java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'
	at org.apache.empire.samples.db.SampleApp.getDatabaseDriver(SampleApp.java:201)
	... 1 more



re: Problems in docs for running example-basic

Posted by Rainer Döbele <do...@esteam.de>.
Dear Tim,

 

thanks for your detailed evaluation.

Looks like some of the documentation has not been adjusted when we switched to Maven a couple of years ago.

 

Personally I am only using Eclipse and cannot say for Intellij IDEA. Theoretically Maven should take care of that.

 

When I run the example for within Eclipse the config.xml is loaded fine. I use "Debug As Java Application" and select the SampleApp class.

However I found out that there seems to be a typo in one of the property names. Instead of empireDBDriverProperties it says empireDBDriverProperites . 

 

I will create a ticket for this and add your suggestions.

We'll tackle this with our next release.

Thanks a lot.

If there is anything else we can do for you please let us know.

 

Besides your technical problems: How did you get on with the examples?

Have you run and the advanced example as well?

Were they helpful?

 

Regards

Rainer

 

 

from: Tim Colson [mailto:timcolson@yahoo.com] 
to: empire-db-user@incubator.apache.org
re: Problems in docs for running example-basic

 

I managed to get the basic example to run in both Eclipse and Intellij IDEA after some effort troubleshooting. 

 

Here are observations on the docs/tutorial info that were confusing or incorrect.

 

I pulled down the distro and expanded into /appdev, cd /appdev/apache-empire-db-2.1.0-incubating/src, and then ran mvn idea:idea. The project opened in Intellij IDEA, ran SampleApp.java... gives an error saying it cannot get the config value for empireDBDriverClass which suggests config.xml file was found, but can't load that node. 

 

I switched to Eclipse since the docs mention it specifically....

 

The website Getting started and Tutorial instructions incorrectly say to import empire-db-2.0.0/examples/DBSample which does not exist in the 2.1 distro. The Tutorial PDF inside the distro is more accurate for the path, but says to use mvn eclipse:eclipse, but the README.txt says "mvn clean install" to build and  "mvn clean eclipse:eclipse -DdownloadSources=true" - so I did both steps. 

 

I imported the projects Eclipse, but it complained of a missing "M2_REPO" variable. I googled and fixed and the sample ran!

 

I went back to Intellij IDEA, and on a hunch checked the working directory. It was set to the root of the src folder, so I set it to  empire-db-example-basic. The sample ran fine! :-)

 

I guessed that the config.xml wasn't actually loading, but the error is misleading. I reviewed XMLConfiguration.java, line 114, FileNotFoundException, but since log4j reported a problem initializing, I added a System.out.println() and re-ran - it printed that config.xml was not found. 

 

Suggestions: 

* update the Tutorial and Getting Started docs to align with the current release

* maybe add a footnote for Intellij users to make sure to set the working directory so the config.xml is loaded. 

* Review logging setup - since until config is loaded, the log system isn't init'd so the log message about not being able to load the file fails.

 

Cheers!

-Tim

 

Intellij IDEA -- error....

 

log4j:WARN No appenders could be found for logger (org.apache.empire.commons.ErrorType).

log4j:WARN Please initialize the log4j system properly.

Running DB Sample...

*** Step 1: getJDBCConnection() ***

*** Step 2: getDatabaseProvider() ***

java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'

          at org.apache.empire.samples.db.SampleApp.getDatabaseDriver(SampleApp.java:201)

          at org.apache.empire.samples.db.SampleApp.main(SampleApp.java:85)

java.lang.RuntimeException: java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'

java.lang.RuntimeException: java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'

          at org.apache.empire.samples.db.SampleApp.getDatabaseDriver(SampleApp.java:221)

          at org.apache.empire.samples.db.SampleApp.main(SampleApp.java:85)

Caused by: java.lang.RuntimeException: Configuration error: Element 'empireDBDriverClass' not found in node 'properties-hsqldb'

          at org.apache.empire.samples.db.SampleApp.getDatabaseDriver(SampleApp.java:201)

          ... 1 more