Hi, How did you tell OpenJPA to use "MyDataSource"?
Daryl Stultz wrote: > > Hello, I've been doing various "academic" work in a standalone Java app > getting to know things. Now I am putting together a Tomcat webapp and > running into a problem. From first start, everything is working fine. When > the app reloads, however, I get this: > > <openjpa-1.2.0-r422266:683325 nonfatal general error> > org.apache.openjpa.persistence.PersistenceException: null > at > org.apache.openjpa.kernel.AbstractBrokerFactory.newBroker(AbstractBrokerFactory.java:196) > at > org.apache.openjpa.kernel.DelegatingBrokerFactory.newBroker(DelegatingBrokerFactory.java:142) > at > org.apache.openjpa.persistence.EntityManagerFactoryImpl.createEntityManager(EntityManagerFactoryImpl.java:192) > > The original cause is a NPE in my own code. I am using "MyDataSource" to > get > connections so I can use my own connection pool and configuration setup. I > have a class (Db) that represents "the database". It has a static member > (HashMap) that holds one or more database "registries". > MyDataSource.getConnection pulls the Db instance from the map using the > configured registry name and then pulls a connection off the registry > (instance of Db). It is this registry map that is null. Again it's a > static > member of Db and it is initialized in the field (and never written to > anywhere else. After reload, I can get connections and entity managers > successfully a number of different ways except I can't get an EM using > MyDataSource. This makes me think there is some sort of class loader issue > (mine, or OpenJPA). Is this sort of thing familiar to anyone? Could there > be > some sort of static reference to the original instance of MyDataSource > that > is causing the call after reload to reference the first set of classes? > MyDataSource IS being reinstantiated after the reload and getConnection is > called on the new instance, but I don't know if there might be something > else weird going on. > > Thanks. > > > -- > Daryl Stultz > _____________________________________ > 6 Degrees Software and Consulting, Inc. > http://www.6degrees.com > mailto:[email protected] > > ----- Pinaki Poddar http://ppoddar.blogspot.com/ http://www.linkedin.com/in/pinakipoddar OpenJPA PMC Member/Committer JPA Expert Group Member -- View this message in context: http://n2.nabble.com/Webapp-restart-problem-tp2953817p2954244.html Sent from the OpenJPA Users mailing list archive at Nabble.com.
