Hi David,
'Just to add to what Mitesh has said.
The javax.persistence.Persistence class is trying to find potential
providers where you see your error. Essentially all it does is look for
a resource on the classpath called:
"META-INF/services/javax.persistence.spi.PersistenceProvider".
The toplink-essentials.jar contains that resource.
-Tom
Mitesh Meswani wrote:
>Hi David,
>
>As the exception indicates Persistence is not able to find a provider
>for persistence unit. Please make sure that
>1. Your persistence.xml lists a provider
><provider>oracle.toplink.essentials.ejb.cmp3.EntityManagerFactoryProvider</provider>
>2. toplink-essentials.jar is available at runtime.
>
>Thanks,
>Mitesh
>
>David Van Couvering wrote:
>
>
>>Hi, all. I am trying to run Java Persistence from within an applet --
>>yes, from within an applet.
>>
>>This is kind of urgent. If I can't get this to work, I'm going to
>>have to revert to JDBC.
>>
>>The applet is loading derbycal.jar, which contains three Entity
>>classes and META-INF/persistence.xml.
>>
>>When I run unit tests against derbycal standalone, Glassfish JPA is
>>able to find persistence.xml and runs fine (except that it keeps
>>complaining it can't find a suitable driver, but I can work on that).
>>
>>When I run the applet, however, it says
>>
>> javax.persistence.PersistenceException: No Persistence provider for
>>EntityManager named derbycal
>> at
>>javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
>>
>> at
>>javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
>>
>> at
>>org.apache.derbyDemo.derbyCalendar.RequestManager$1.run(RequestManager.java:41)
>>
>> at java.security.AccessController.doPrivileged(Native Method)
>> at
>>org.apache.derbyDemo.derbyCalendar.RequestManager.<init>(RequestManager.java:38)
>>
>> at
>>org.apache.derbyDemo.derbyCalendar.DerbyCalendarApplet.login(DerbyCalendarApplet.java:97)
>>
>>
>>
>>In scanning this mailing list, it appears this is a classloading problem.
>>
>>Does anyone know why the loader can't find META-INF/persistence.xml in
>>derbycal.jar when it's loaded within an applet? How would I tell the
>>applet classloader to look somewhere else? I tried putting it
>>directly into the codebase directory for the applet but that didn't
>>work either.
>>
>>Many thanks,
>>
>>David
>>
>>
--
Tom Ware
Principal Software Engineer
Oracle Canada Inc.
Direct: (613) 783-4598
Email: tom.ware_at_oracle.com