Return-Path: Delivered-To: apmail-openjpa-dev-archive@www.apache.org Received: (qmail 2879 invoked from network); 13 Oct 2010 22:48:54 -0000 Received: from unknown (HELO mail.apache.org) (140.211.11.3) by 140.211.11.9 with SMTP; 13 Oct 2010 22:48:54 -0000 Received: (qmail 48408 invoked by uid 500); 13 Oct 2010 22:48:54 -0000 Delivered-To: apmail-openjpa-dev-archive@openjpa.apache.org Received: (qmail 48358 invoked by uid 500); 13 Oct 2010 22:48:54 -0000 Mailing-List: contact dev-help@openjpa.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@openjpa.apache.org Delivered-To: mailing list dev@openjpa.apache.org Received: (qmail 48345 invoked by uid 99); 13 Oct 2010 22:48:54 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Oct 2010 22:48:54 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=10.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.22] (HELO thor.apache.org) (140.211.11.22) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Oct 2010 22:48:53 +0000 Received: from thor (localhost [127.0.0.1]) by thor.apache.org (8.13.8+Sun/8.13.8) with ESMTP id o9DMmW5H025846 for ; Wed, 13 Oct 2010 22:48:33 GMT Message-ID: <1007589.133481287010112399.JavaMail.jira@thor> Date: Wed, 13 Oct 2010 18:48:32 -0400 (EDT) From: "Albert Lee (JIRA)" To: dev@openjpa.apache.org Subject: [jira] Commented: (OPENJPA-1764) Automatically enable connection pooling in unmanaged environments In-Reply-To: <21763391.288731281561916089.JavaMail.jira@thor> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 [ 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.