[
https://issues.apache.org/jira/browse/OPENJPA-1764?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12920793#action_12920793
]
Albert Lee commented on OPENJPA-1764:
-------------------------------------
After r1021574 commit, I am getting a NPE as in:
java.lang.NullPointerException
at
org.apache.openjpa.persistence.conf.TestSwitchConnection.setUp(TestSwitchConnection.java:55)
at junit.framework.TestCase.runBare(TestCase.java:125)
at
org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:536)
at
org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.runBare(AbstractPersistenceTestCase.java:512)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at
org.apache.openjpa.persistence.test.AbstractPersistenceTestCase.run(AbstractPersistenceTestCase.java:205)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at
org.eclipse.jdt.internal.junit.runner.junit3.JUnit3TestReference.run(JUnit3TestReference.java:130)
at
org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at
org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
I believe this occurs when I tried Derby without specifying connection user/pwd.
TestSwitchConnection/TestOverrideNonJtaDataSource
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
setTestsDisabled(true);
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.
init(defaultJndiName);
init(jndiNames[0]);
} else {
// Disable for non-Derby, due to connectionUserName to schema
mapping failures
setTestsDisabled(true);
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: https://issues.apache.org/jira/browse/OPENJPA-1764
> 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.