[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [eclipselink-users] v. 1.0.2 EntityManagerFactoryImpl throwing null pointer exception on connection
|
Hi Gordon,
Are you running in JavaSE or in some kind of container?
Are you using a connection pool?
Is it external to EclipseLink or EclipseLink's own connection pool?
How does your test obtain the connection and reestablish it?
I am not surprised that the scenario you are describing is causing issues.
EclipseLink has some strategies you can use to reestablish connections, but
doing it somewhere EclipseLink is completely unaware of could cause an issue.
-Tom
Gordon Ferguson wrote:
Hi Tom,
It has been a few weeks but I'm back to this question.
The basic scenario I'm having trouble with is recovery after a
SQLException: Io exception: The Network Adapter could not establish the
connection ...
My test case forces that error and then restores the underlying
connection. I then want to get EclipseLink going again.
Is there an api to get a (new?) working EntityMangager at this point?
What I'm trying is invoke close() both the EntityManager and the
EntityManagerFactory. (Nothing thrown by this.) Then I repeat this code:
protected void privateInit(String persistenceUnitLabel, ...) {
emf =
Persistence.createEntityManagerFactory(persistenceUnitLabel);
entityManager = emf.createEntityManager();
...
}
and the first line creates the stack trace below.
Thanks for any suggestions,
Gordon
Tom Ware wrote:
Hi Gordon,
If EclipseLink is following the expected code path, the
structConverters should be initialized inside the "if (state ==
STATE_PREDEPLOYED) {" code block below where the structConverters
variable is being defined on the following line:
structConverters = processor.getStructConverters();
If you are not getting into that if statement and still getting to
"addStructConverters(session, structConverters)" something strange is
occurring with your deployment. It is hard to say what the problem is
without more information about the symptoms of the problem you are
seeing.
-Tom
Gordon Ferguson wrote:
Hello,
I'm using the SE approach and testing my 'recovery after error' logic.
I see the exception listed below. I looked at the code and found
EntityManagerSetupImpl.deploy() method initializes
structConverters to null in l.189
Then, in l. 319 passes that null to addStructConverters(...) which
tries to add to the (null) List.
List<StructConverter> structConverters = null;
SO, I'm wondering if this is just a coding typo or if I need to dig
deeper
into why I'm in this state?
Any suggestions would be appreciated.
Thanks,
Gordon
Listing:
[EL Info]: 2008.10.30
11:53:03.781--ServerSession(653967)--EclipseLink, version: Eclipse
Persistence Services - 1.0.2 (Build 20081024)
Exception in thread "main" [EL Info]: 2008.10.30
11:53:10.328--ServerSession(653967)--file:/D:/projs/costar-1.3/jclass/-True-DevDev
login successful
costar.dbaccess.DbAccessException: Could not access database.
at
costar.dbaccess.jpa.CoStarJpaAccess.privateInit(CoStarJpaAccess.java:82)
at
costar.dbaccess.jpa.CoStarJpaAccess.<init>(CoStarJpaAccess.java:53)
at
costar.dbaccess.jpa.test.JpaConnectionCheckerChecker.main(JpaConnectionCheckerChecker.java:104)
Caused by: java.lang.NullPointerException
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.addStructConverters(EntityManagerSetupImpl.java:319)
at
org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.deploy(EntityManagerSetupImpl.java:249)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.getServerSession(EntityManagerFactoryImpl.java:69)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:118)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManagerImpl(EntityManagerFactoryImpl.java:112)
at
org.eclipse.persistence.internal.jpa.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:100)
at
costar.dbaccess.jpa.CostarJpaFacade.<init>(CostarJpaFacade.java:47)
at
costar.dbaccess.jpa.CoStarJpaAccess.privateInit(CoStarJpaAccess.java:80)
... 2 more
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users
_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users