openjpa-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Gene Wu <>
Subject RE: Classloader Question of OpenJPA.
Date Fri, 17 Aug 2007 11:08:14 GMT
Hi Pinaki,Thank you for your quick response. This topic is a little tricky. Let me go a little
further.I wrote a test case to test this function. Here is the code snip:JarLoader cl = JarLoader.getInstance();JPAUtil.loadOpenJPA("D:\\java\\openjpa0.9.7",
cl);EntityManagerFactory result = JPAUtil.getEntityManager(cl);assertNotNull(result);When
I added OpenJPA as compile/runtime lib to the project. And comment No. 2 line, the case was
passed.After drop OpenJPA, put No.2 line back, I will get the error. I have "META-INF/openjpa.xml"
and "META-INF/persistence.xml". The error happened when I create the EntityFactory, I am not
sure logging system was initialized at that point of time.Any thoughts?Thanks,Gene.> Subject:
RE: Classloader Question of OpenJPA.> Date: Fri, 17 Aug 2007 02:47:13 -0700> From:>
To:> > Hi Gene,>   I may not have understood full import of
your classloading> environment.>   So following may not be relevant to your context:>
  1. The exception most likelely shows that OpenJPA is not finding any> META-INF/persistence.xml
resource in your classpath. Thie> META-INF/persistence.xml is loaded by the thread'c context
classloader> (Classloader.getResourceAsStream()). So placing the directory in the> classpath
that has META-INF/persistence.xml relative to it may solve> your problem.>   2. You
may elaborate more on the execution environment and packaging> of your OpenJPA application.>
  3. Setting <property name="openjpa.Log" value="DefaultLevel=TRACE"/>> in META-INF/persistence.xml
prints detailed information. If you post it,> it will help diagnose the error.  > >
> Pinaki Poddar> 972.834.2865> > -----Original Message-----> From: Gene Wu
[] > Sent: Friday, August 17, 2007 2:15 AM> To: OpenJPADev>
Subject: Classloader Question of OpenJPA.> > > > > Hi,I am writing a handy
tools with a simple user interface. It can> verify persistence.xml and annotation setting
of the classes of. Also,> it can run JPQL like the SQL browser.In this case, I implemented
a basic> classloader to load those persistence entity classes from Jar files,> which
were configurable from UI. Here are my initial thoughts:1.> Classloader will load OpenJPA
and persistence classes.-- I tried. My> classloader is too simple to make a perfect support
of every requirement> from OpenJPA. It failed when it was loading FactoryBroker. After
I> inject my classload to Thread, I still have the following error:> "Caused by: <0.0.0
fatal general error>> org.apache.openjpa.persistence.PersistenceException: There was
an error> when invoking the static getInstance method on the named factory class> "org.apache.openjpa.jdbc.kernel.JDBCBrokerFactory".
 See the nested> exception for details."              "Caused by:> java.util.MissingResourceException:>
org.apache.openjpa.persistence.PersistenceProductDerivation:java.lang.Nu> llPointerException"2.
Classloader load persistence classes only.-- I> didn't find a way to have a special class
loader to load the persistence> entity class in OpenJPA. Does any one have experience on
that? Maybe we> can have an entrance in OpenJPAPersistence for specified classloader by>
user.Thanks,Gene.> _________________________________________________________________>
Recharge--play some free games. Win cool prizes too!>>
> Notice:  This email message, together with any attachments, may contain information 
of  BEA Systems,  Inc.,  its subsidiaries  and  affiliated entities,  that may be confidential,
 proprietary,  copyrighted  and/or legally privileged, and is intended solely for the use
of the individual or entity named in this message. If you are not the intended recipient,
and have received this message in error, please immediately return this by email and then
delete it.
See what you’re getting into…before you go there
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message