[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-dev]EntityManagerJUnitTestSuite.testLockWithJoinedInheritanceStrategy: NPE
|
Hi Adrian,
DriverWrapper class that appears on the stack is a test helper class that
currently used only in two EntitymanagerJUnitTsetSuite tests:
testEMCloseAndOpen and testEMFactoryCloseAndOpen.
These two tests use DriverWrapper to simulate dropped connections:
HashMap properties = new
HashMap(JUnitTestCaseHelper.getDatabaseProperties());
properties.put(PersistenceUnitProperties.JDBC_DRIVER,
DriverWrapper.class.getName());
properties.put(PersistenceUnitProperties.JDBC_URL,
DriverWrapper.codeUrl(originalConnectionString));
getEntityManagerFactory(properties);
I can't explain how DriverWrapper would show up when none of these two tests
have run (your reproducing the problem with just two tests).
However if one or both these tests have run before,
it is possible that the JDBC_DRIVER and JDBC_URL they provided are still
used by the factory
(though each of the two tests supposed to clean up after themselves).
You could comment out testEMCloseAndOpen and testEMFactoryCloseAndOpen -
that should remove any usage of DriverWrapper.
But to get to the bottom of it we need to figure out why the factory (or the
server session owned by the factory) is not properly cleaned up of
DriverWrapper.
I can't reproduce the problem so far.
Thanks,
Andrei
----- Original Message -----
From: "Goerler, Adrian" <adrian.goerler@xxxxxxx>
To: "tom Ware" <tom.ware@xxxxxxxxxx>
Cc: "Dev mailing list for Eclipse Persistence Services"
<eclipselink-dev@xxxxxxxxxxx>
Sent: Tuesday, December 01, 2009 11:26 AM
Subject: AW:
[eclipselink-dev]EntityManagerJUnitTestSuite.testLockWithJoinedInheritanceStrategy:
NPE
Hi Tom, all,
I have correctly set the driver name in test.properties.
The issue is something different. This is what I have found out so far:
EntityManagerJUnitTestSuite.testLockWithJoinedInheritanceStrategy is the
only test failing for me.
I can reproduce the issue by reducing the testsuite as follows:
public static Test suite() {
TestSuite suite = new TestSuite();
suite.setName("EntityManagerJUnitTestSuite");
suite.addTest(new
EntityManagerJUnitTestSuite("testNoPersistOnFlushProperties"));
suite.addTest(new
EntityManagerJUnitTestSuite("testLockWithJoinedInheritanceStrategy"));
return suite;
}
It appears that the database passwords are kept in some encrypted form and
that the test "testNoPersistOnFlushProperties" confuses the encryption
somehow.
"testLockWithJoinedInheritanceStrategy" then fails to create a connection as
it attempts to use an encrypted password to connect.
Anyone any idea on this?
-Adrian
Adrian Görler
SAP AG
Pflichtangaben/Mandatory Disclosure Statements:
http://www.sap.com/company/legal/impressum.epx
-----Ursprüngliche Nachricht-----
Von: eclipselink-dev-bounces@xxxxxxxxxxx
[mailto:eclipselink-dev-bounces@xxxxxxxxxxx] Im Auftrag von Tom Ware
Gesendet: Dienstag, 1. Dezember 2009 15:14
An: Dev mailing list for Eclipse Persistence Services
Betreff: Re: [eclipselink-dev]
EntityManagerJUnitTestSuite.testLockWithJoinedInheritanceStrategy: NPE
Hi Adrian,
It looks like driverName is null in the call:
driver = (Driver)Class.forName(driverName, true,
Thread.currentThread().getContextClassLoader()).newInstance();
Driver name should come from a file called test.properties. There are
test.properties files in <base>/jpa/eclipselink.jpa.test and
<base>/foundation/eclipselink.core.test. Depending on whether you are
running
the jpa tests or the core tests, those files will be used to get the driver
name. To override those files, put a file called test.properties in your
<user-home> directory and override any settings you need to override.
-Tom
Goerler, Adrian wrote:
Hi,
executing the JPA LRG tests on MySQL, I am observing the following issue
with EntityManagerJUnitTestSuite.testLockWithJoinedInheritanceStrategy:
Exception Description: DriverWrapper: failed to instantiate null
Internal Exception: java.lang.NullPointerException
Local Exception Stack:
Exception [EclipseLink-0] (Eclipse Persistence Services -
2.0.0.qualifier):
org.eclipse.persistence.testing.framework.TestProblemException
Exception Description: DriverWrapper: failed to instantiate null
Internal Exception: java.lang.NullPointerException
at
org.eclipse.persistence.testing.framework.DriverWrapper.getDriver(DriverWrapper.java:191)
at
org.eclipse.persistence.testing.framework.DriverWrapper.connect(DriverWrapper.java:226)
at java.sql.DriverManager.getConnection(DriverManager.java:582)
at java.sql.DriverManager.getConnection(DriverManager.java:154)
at
org.eclipse.persistence.sessions.DefaultConnector.connect(DefaultConnector.java:98)
at
org.eclipse.persistence.sessions.DatasourceLogin.connectToDatasource(DatasourceLogin.java:162)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connectInternal(DatasourceAccessor.java:327)
at
org.eclipse.persistence.internal.databaseaccess.DatabaseAccessor.connectInternal(DatabaseAccessor.java:294)
at
org.eclipse.persistence.internal.databaseaccess.DatasourceAccessor.connect(DatasourceAccessor.java:415)
at
org.eclipse.persistence.sessions.server.ConnectionPool.buildConnection(ConnectionPool.java:155)
at
org.eclipse.persistence.sessions.server.ConnectionPool.acquireConnection(ConnectionPool.java:97)
at
org.eclipse.persistence.sessions.server.ServerSession.acquireClientConnection(ServerSession.java:241)
at
org.eclipse.persistence.sessions.server.ClientSession.basicBeginTransaction(ClientSession.java:130)
at
org.eclipse.persistence.internal.sessions.AbstractSession.beginTransaction(AbstractSession.java:580)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.beginTransaction(UnitOfWorkImpl.java:546)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeDatabaseQuery(ObjectLevelReadQuery.java:973)
at
org.eclipse.persistence.queries.DatabaseQuery.execute(DatabaseQuery.java:675)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.execute(ObjectLevelReadQuery.java:958)
at
org.eclipse.persistence.queries.ReadObjectQuery.execute(ReadObjectQuery.java:399)
at
org.eclipse.persistence.queries.ObjectLevelReadQuery.executeInUnitOfWork(ObjectLevelReadQuery.java:1021)
at
org.eclipse.persistence.internal.sessions.UnitOfWorkImpl.internalExecuteQuery(UnitOfWorkImpl.java:2863)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1225)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1207)
at
org.eclipse.persistence.internal.sessions.AbstractSession.executeQuery(AbstractSession.java:1167)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.executeQuery(EntityManagerImpl.java:733)
at
org.eclipse.persistence.internal.jpa.EntityManagerImpl.lock(EntityManagerImpl.java:1495)
at
org.eclipse.persistence.testing.tests.jpa.advanced.EntityManagerJUnitTestSuite.testLockWithJoinedInheritanceStrategy(EntityManagerJUnitTestSuite.java:1943)
at
org.eclipse.persistence.testing.framework.junit.JUnitTestCase.runBare(JUnitTestCase.java:428)
at
org.eclipse.persistence.testing.framework.TestExecutor.execute(TestExecutor.java:248)
at
org.eclipse.persistence.testing.framework.TestModel.execute(TestModel.java:208)
at
org.eclipse.persistence.testing.framework.TestCollection.run(TestCollection.java:313)
Caused by: java.lang.NullPointerException
at java.lang.Class.forName0(Native Method)
at java.lang.Class.forName(Class.java:247)
at
org.eclipse.persistence.testing.framework.DriverWrapper.getDriver(DriverWrapper.java:189)
So far, I have not been able to hunt it down.
Is anyone observing this also or knows how to fix this?
-Adrian
*Adrian Görler
**SAP AG
*Pflichtangaben/Mandatory Disclosure Statements:
_http://www.sap.com/company/legal/impressum.epx_
------------------------------------------------------------------------
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev