I have some code that's calling OracleUcpConnectionManager.getConnection("some_resource_name")
in a test that's failing with an SQLException
that says: Invalid Universal Connection Pool configuration
. I've checked and this same code is being called in production, and it works. The resource name (string being passed to .getConnection
is the same for both the test and production code. I'm assuming it has to be some configuration that automagically happens through spring, so I sorted through the XML files in WEB-INF
and tried adding this to the test:
//manually scan the application context (this is done with XML configuration in the normal application)
//thanks: http://static.springsource.org/spring/docs/3.1.0.RC1/spring-framework-reference/htmlsingle/spring-framework-reference.html#beans-java-instantiating-container-scan
AnnotationConfigApplicationContext context = new AnnotationConfigApplicationContext();
context.scan("some.package.here");
context.refresh();
Based on this in my dispacther-servlet.xml:
<context:component-scan base-package="some.package.here" />
Note: the context:
prefix here is defined as xmlns:context="http://www.springframework.org/schema/context"
That didn't have any (noticeable) effect.
I've also been sifting through oracle's site for a few days and haven't found much related to that error (the error code is UCP-45006
by the way (see: error codes on oracle's site), and a search for that didn't turn up much for me)
I also thought this question might be handy: OracleDataSource vs. Oracle UCP PoolDataSource, however I don't have any of that configuration in my .xml
or .properties
files currently (this is a preexisting project), and (as already noted) .getConnection(String)
works fine when running the code in production, but not when running as a JUnit test.
Is there something I should be looking for in the logs? I'm unsure what to try next.
Update: it's failing at oracle.ucp.jdbc.PoolDataSourceImpl.setConnectionFactoryClassName (which is causing the SQLExcpetion) AND (bonus here), I found the javadocs for that.
Update Update: Our properties file, which has the value needed by 'setConnectionFactoryClassName' appears to be loaded in the regular project, but not when testing. After searching around a bit, it seems to be loaded automagically, after we pass the JVM this argument: -DapplicationProperties="C:\full\path\to\our\file.properties"
. Now to figure out if spring handles that or java does...
Update Update Update: I can verify the location of the properties file is being passed to the test, (thanks to this SO question)