portals-jetspeed-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Ate Douma (JIRA)" <jetspeed-...@portals.apache.org>
Subject [jira] Created: (JS2-320) build.properties Variable Interpolation (Commons Configuration) not working in AbstractTestHelper
Date Mon, 01 Aug 2005 00:32:37 GMT
build.properties Variable Interpolation (Commons Configuration) not working in AbstractTestHelper
-------------------------------------------------------------------------------------------------

         Key: JS2-320
         URL: http://issues.apache.org/jira/browse/JS2-320
     Project: Jetspeed 2
        Type: Bug
  Components: Testing  
    Versions: 2.0-M4    
 Environment: WindowsXP SP2, JDK1.5.0_04_b05, Oracle9i
    Reporter: Ate Douma
 Assigned to: Scott Weaver 
     Fix For: 2.0-M4


I used to be able to define the (Oracle) test and production db configuration in my build.properties
using variable interpolation.

Something like this:

my.j2.db.name = orcl
my.j2.db.url=jdbc:oracle:thin:@localhost:1521:${my.j2.db.name}
my.j2.db.driver=oracle.jdbc.driver.OracleDriver
my.j2.testuser = j2t
my.j2.produser = j2p

And then use the above property definitions like this:

org.apache.jetspeed.test.database.url = ${my.j2.db.url}
org.apache.jetspeed.test.database.driver = ${my.j2.db.driver}
org.apache.jetspeed.test.database.user = ${my.j2.testuser}
org.apache.jetspeed.test.database.password =${my.j2.testuser}

org.apache.jetspeed.production.database.url = ${my.j2.db.url}
org.apache.jetspeed.production.database.driver = ${my.j2.db.driver}
org.apache.jetspeed.production.database.user = ${my.j2.produser}
org.apache.jetspeed.production.database.password =${my.j2.produser}

This though is no longer working :-(

In AbstractTestHelper the configurations from my build.properties and the j2 project.properties
are loaded using a Commons PropertyConfiguration.
Although the Commons Configuration *says*  it supports Variable Interpolation, it clearly
doesn't work:

Testcase: testHelper(org.apache.jetspeed.testhelpers.TestDatasourceHelper):	Caused an ERROR
Cannot load JDBC driver class '${my.j2.db.driver}'
org.apache.commons.dbcp.SQLNestedException: Cannot load JDBC driver class '${my.j2.db.driver}'
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:766)
	at org.apache.commons.dbcp.BasicDataSource.getConnection(BasicDataSource.java:540)
	at org.apache.jetspeed.testhelpers.TestDatasourceHelper.testHelper(TestDatasourceHelper.java:22)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
Caused by: java.lang.ClassNotFoundException: ${my.j2.db.driver}
	at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
	at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:268)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
	at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:164)
	at org.apache.commons.dbcp.BasicDataSource.createDataSource(BasicDataSource.java:760)
	... 16 more

I tried using Commons Configuration 1.1 (the latest while we currently 1.0) but that didn't
help either.
Of course, I could "solve" this by (temporarily) hardcoding my properties but this clearly
isn't what I like...


-- 
This message is automatically generated by JIRA.
-
If you think it was sent incorrectly contact one of the administrators:
   http://issues.apache.org/jira/secure/Administrators.jspa
-
For more information on JIRA, see:
   http://www.atlassian.com/software/jira


---------------------------------------------------------------------
To unsubscribe, e-mail: jetspeed-dev-unsubscribe@portals.apache.org
For additional commands, e-mail: jetspeed-dev-help@portals.apache.org


Mime
View raw message