openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Albert Lee (JIRA)" <>
Subject [jira] Commented: (OPENJPA-1764) Automatically enable connection pooling in unmanaged environments
Date Wed, 13 Oct 2010 22:48:32 GMT


Albert Lee commented on OPENJPA-1764:

After r1021574 commit, I am getting a NPE as in:

	at org.apache.openjpa.persistence.conf.TestSwitchConnection.setUp(
	at junit.framework.TestCase.runBare(
	at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(
	at org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(
	at junit.framework.TestResult$1.protect(
	at junit.framework.TestResult.runProtected(
	at junit.framework.TestSuite.runTest(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(
	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(

I believe this occurs when I tried Derby without specifying connection user/pwd.


    public void setUp() throws Exception {
        super.setUp(Person.class, CLEAR_TABLES);
        OpenJPAEntityManager em = emf.createEntityManager();
        JDBCConfiguration conf = (JDBCConfiguration) em.getConfiguration();
        if (conf.getConnectionUserName() != null || !conf.getConnectionUserName().equals(""))
{   <<<< the 2nd getConnectionUserName() call returns null and hence the NPE
            // Disable for non-Derby, due to connectionUserName to schema mapping failures

Are we assuming if no username is specified, Derby is used? If so, should the check be

        if (conf.getConnectionUserName() == null || conf.getConnectionUserName().equals(""))
            // create an EMF for each database.
        } else {
            // Disable for non-Derby, due to connectionUserName to schema mapping failures
            getLog().trace("TestOverrideNonJtaDataSource can only be executed against Derby
w/o a schema");

Albert Lee.

> Automatically enable connection pooling in unmanaged environments
> -----------------------------------------------------------------
>                 Key: OPENJPA-1764
>                 URL:
>             Project: OpenJPA
>          Issue Type: Sub-task
>          Components: jdbc, performance
>    Affects Versions: 2.1.0
>            Reporter: Donald Woods
>            Assignee: Donald Woods
>             Fix For: 2.1.0
>         Attachments: OPENJPA-1764-20100927.diff, OPENJPA-1764-20100928.diff
> When commons-dbcp is present on the classpath and we are running in a JSE or unmanaged
environment, we should automatically configure DriverClassName=org.apache.commons.dbcp.BasicDataSource
and apply some DBCP args (this might be the tricky part, based on the different dbcp args
we have to use today for different databases...)

This message is automatically generated by JIRA.
You can reply to this email to add a comment to the issue online.

View raw message