Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink - Update fix

Alex,
    Hi, there is a 1 line (internal) fix for this issue. See the following patch in review that will be committed shortly.
    I will notify you when this is checked in on either monday or tuesday.
 

Synopsis:
    Both the insert and lookup from our EMSetup map will use decoded URL string keys (which do not have any %20 encodings) - currently only the lookup is decoded.
 
Details:
        When a PU is in a path that includes spaces, these spaces are represented internally in URL objects as an encoded %20.
        This encoding is causing problems later when finding the PU - this is not a problem with the file system - it is a mismatched HashMap lookup.
        The problem turned out to be that the EMS object lookup based on URL string key was using the decoded (" ") version - while the insert into the HashMap<String, EntityManagerSetupImpl> used an encoded ("%20") key - the EMSetup was never found.
 

The fix is to replace the following line with one that reuses the already decoded [puName] which does not use %20 for spaces.
 
JavaSECMPInitializer.callPredeploy()
before:
EntityManagerFactoryProvider.addEntityManagerSetupImpl(persistenceUnitInfo.getPersistenceUnitRootUrl()+persistenceUnitInfo.getPersistenceUnitName(),
emSetupImpl);

after:
EntityManagerFactoryProvider.addEntityManagerSetupImpl(puName, emSetupImpl);
 
thank you
/michael
-----Original Message-----
From: Michael O'Brien [mailto:michael.obrien@xxxxxxxxxx]
Sent: Friday, March 14, 2008 12:09
To: 'EclipseLink User Discussions'
Subject: RE: AW: AW: AW: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Alex,
    Yes, it looks like your bug containing " " URLencoded as %20 is one instance of this larger TopLink forum bug you quoted where any IO unsupported char (in this case an unencoded [á]) breaks our reference to the recently loaded PU.
     We will let you know shortly the timeframe as soon as we queue these 2 bugs and any tested-workaround/changes.
    thank you for your reproduction.
 
 
    /michael
-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx]On Behalf Of Alex X
Sent: Friday, March 14, 2008 11:37
To: EclipseLink User Discussions
Subject: AW: AW: AW: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Hi Michael,
 
thanks for the Information!
 
Apart from that I can hardly write in any other directory than C:\Document and Settings\.... because of the security restrictions of my company, relying on the path where the project resits or tomcat is stored looks not very stable to me.
 
Can you estimate when this bug will be fixed? Is this somehow related to the problem described in this thread in the Oracle Toplink forum?
 
Best regards,
Alex

----- Ursprüngliche Mail ----
Von: Michael O'Brien <michael.obrien@xxxxxxxxxx>
An: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Gesendet: Freitag, den 14. März 2008, 04:31:57 Uhr
Betreff: RE: AW: AW: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Alex,
    Gordon is right, there is no other user-available workaround beyond removing spaces, the 210280 bug needs to be fixed internally by doing 8.3 post-processing for windows systems after URL decode. This fix I suggested may only be used by the developer.  I would rename your project and workspace to avoid spaces.
 
    thank you
    /michael
 
--------------------------------extra investigation details-------------------------
1) working OK
[EPS Info]: 2008.03.13 10:18:44.015--ServerSession(22292701)--EclipseLink, version: Eclipse Persistence Services - @VERSION@ (Build @BUILD_NUMBER@)
[EPS Info]: 2008.03.13 10:18:45.031--ServerSession(22292701)--file:/C:/wse/w34/statJPA2/build/classes/-statJPA login successful
 
Reproduction:
2) broken: rename eclipse J2SE JPA project to "stat JPA"
[EPS Finest]: 2008.03.13 10:21:01.375--ServerSession(20435088)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit statJPA; state Initial; factoryCount 0
[EPS Finer]: 2008.03.13 10:21:01.390--ServerSession(20435088)--Thread(Thread[main,5,main])--Searching for default mapping file in file:/C:/wse/w34/stat%20JPA/build/classes/
...
[EPS Finer]: 2008.03.13 10:21:01.390--ServerSession(20435088)--Thread(Thread[main,5,main])--Found a default mapping file at file:/C:/wse/w34/stat%20JPA/build/classes/META-INF/orm.xml for root URL file:/C:/wse/w34/stat%20JPA/build/classes/
[EPS Finest]: 2008.03.13 10:21:02.000--ServerSession(20435088)--Thread(Thread[main,5,main])--End predeploying Persistence Unit statJPA; state Predeployed; factoryCount 0
[EPS Finer]: 2008.03.13 10:21:02.000--Thread(Thread[main,5,main])--cmp_init_transformer_is_null
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named statJPA
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
 at org.eclipse.persistence.example.navigation.Introspector.<init>(Introspector.java:51)
 at org.eclipse.persistence.example.navigation.Introspector.main(Introspector.java:185)
 
3] get short name
C:\wse\w34>dir /X
2008-03-13  22:17    <DIR>          STATJP~1     stat JPA
 
4] manually plug it in
URL with %20 transformed:
file:/C:/wse/w34/stat%20JPA/build/classes/META-INF/orm.xml
/C:/wse/w34/STATJP~1/build/classes/
file:///C:/wse/w34/STATJP~1/build/classes/statJPA
 
5] Still fails after predeploy
[EPS Finest]: 2008.03.13 10:31:00.984--ServerSession(20245380)--Thread(Thread[main,5,main])--Begin predeploying Persistence Unit statJPA; state Initial; factoryCount 0
[EPS Finer]: 2008.03.13 10:31:01.015--ServerSession(20245380)--Thread(Thread[main,5,main])--Searching for default mapping file in file:/C:/wse/w34/STATJP~1/build/classes/
[EPS Finer]: 2008.03.13 10:31:20.921--ServerSession(20245380)--Thread(Thread[main,5,main])--Found a default mapping file at file:/C:/wse/w34/STATJP~1/build/classes/META-INF/orm.xml for root URL file:/C:/wse/w34/STATJP~1/build/classes/
[EPS Config]: 2008.03.13 10:31:21.125--ServerSession(20245380)--Thread(Thread[main,5,main])--The alias name for the entity class [class org.eclipse.persistence.example.navigation.business.StatLabel] is being defaulted to: StatLabel.
[EPS Finest]: 2008.03.13 10:31:21.546--ServerSession(20245380)--Thread(Thread[main,5,main])--End predeploying Persistence Unit statJPA; state Predeployed; factoryCount 0
...
[EPS Finer]: 2008.03.13 10:31:21.546--Thread(Thread[main,5,main])--cmp_init_transformer_is_null
Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named statJPA
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
 at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
 at org.eclipse.persistence.example.navigation.Introspector.<init>(Introspector.java:51)
 at org.eclipse.persistence.example.navigation.Introspector.main(Introspector.java:185)
 
Solution:
-----------
For Windows only, the bug needs to transform each directory tokenized fragment into 8.3 format after URL decode in...
Thread [main] (Suspended) 
 PersistenceUnitProcessor.buildPersistenceUnitName(URL, String) line: 370 
 JavaSECMPInitializer.callPredeploy(SEPersistenceUnitInfo, Map, PersistenceInitializationActivator) line: 96 
 JavaSECMPInitializer.initPersistenceUnits(Archive, Map, PersistenceInitializationActivator) line: 198 
 JavaSECMPInitializer.initialize(Map, PersistenceInitializationActivator) line: 213 
 PersistenceProvider.createEntityManagerFactory(String, Map) line: 72 
 Persistence.createEntityManagerFactory(String, Map) line: 83 
 Persistence.createEntityManagerFactory(String) line: 60 
 Introspector.<init>() line: 51 
 Introspector.main(String[]) line: 185 
 
 
puName "file:/C:/wse/w34/stat JPA/build/classes/statJPA" (id=42)
would need to be... 
puName "file:/C:/wse/w34/statJP~1/build/classes/statJPA" (id=42) 
-----Original Message-----
From: Michael O'Brien [mailto:michael.obrien@xxxxxxxxxx]
Sent: Thursday, March 13, 2008 13:41
To: 'EclipseLink User Discussions'
Subject: RE: AW: AW: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Alex,
    Hi, yes there is another way to preserve your current file structure.  If you are running on windows - It looks like you are, you can use the DOS compatible 8:3 name.
    Any dir with spaces after the sixth char or longer than 8 chars can be truncated with a ~1 after the first six chars, increase the # at the end to differentiate between dirs with the same 6 letter prefix.
 
    Example:
 
    c:\Documents and Settings\Administrator\"
 
    becomes....with a Tilde#
 
    c:\Docume~1\Admini~1\
 
    Danke
    /michael
 
-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx]On Behalf Of Alex X
Sent: Thursday, March 13, 2008 11:53
To: EclipseLink User Discussions
Subject: AW: AW: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Yes, it seems to be this bug.
 
It does not only occur in Eclipse IDE but also if the Tomcat WebServer is installed in a directory with spaces.
 
Are there other workarounds than removing spaces from the path?
 
Best regards,
Alex


 
----- Ursprüngliche Mail ----
Von: Gordon Yorke <gordon.yorke@xxxxxxxxxx>
An: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Gesendet: Donnerstag, den 13. März 2008, 16:33:32 Uhr
Betreff: RE: AW: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Hello Alex,
   It seems you may have encountered http://bugs.eclipse.org/bugs/show_bug.cgi?id=210280
Try removing the spaces from the path.
--Gordon
-----Original Message-----
From: eclipselink-users-bounces@xxxxxxxxxxx [mailto:eclipselink-users-bounces@xxxxxxxxxxx]On Behalf Of Alex X
Sent: Thursday, March 13, 2008 7:52 AM
To: EclipseLink User Discussions
Subject: AW: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Hi Gordon,
 
while I tried to get EclipseLink working, I changed the name and forgot to rename, but that was only 1 reason.
Now I found out, that the Problem
    Exception in thread "main" javax.persistence.PersistenceException: No Persistence provider for EntityManager named default
occurs when
a)
Persistence Unit has a invalid name - thanks for the advice.
or
b)
EclipseLink cant handle the path where the project is stored.
 
If  I store my project in
C:\Documents and Settings\m03312\Data\My Local Data\javadev\eclipse_workspace_dali\DaliTest_eclipselink
the Exception occurs
If  I store my project in
N:\eclipse_workspace_dali\DaliTest_eclipselink
It does not :-/
 
Thanks for all your help,
best regards,
Alex

 
----- Ursprüngliche Mail ----
Von: Gordon Yorke <gordon.yorke@xxxxxxxxxx>
An: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Gesendet: Mittwoch, den 12. März 2008, 15:15:57 Uhr
Betreff: Re: AW: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

You need to give your persistence unit a name.  Try <persistence-unit name="default">.
--Gordon

Alex X wrote:
Hi Gordon,
 
many thanks for your fast response!
 
To answer your question:
 
1.
For testing I try to use eclipselink in Java SE enviroment, without application server.
In production there will be a apache tomcat (but not used as Java EE server)
 
2.
I think so, here is my persistence.xml
 

<?xml version="1.0" encoding="UTF-8"?>

<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">

<persistence-unit name="">

<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>

<class>com.emd.testpersistence.PhaMatLoc</class>

<class>com.emd.testpersistence.PhaMatSales</class>

<class>com.emd.testpersistence.PhaMaterial</class>

<class>com.emd.testpersistence.PhaProduct</class>

<class>com.emd.testpersistence.SecVUserPrivDissolve</class>

<properties>

<property name="eclipselink.session-name" value="my-session"/>

<property name="eclipselink.logging.level" value="FINE"/>

<property name="eclipselink.jdbc.driver" value="oracle.jdbc.OracleDriver"/>

<property name="eclipselink.jdbc.url" value="jdbc:oracle:thin:@d11n02p02.merck.de:1521:rc02"/>

</properties>

</persistence-unit>

 

with toplink essentials I didn't need to use <provider>...</provider>

But here it doesn't seem to work.

 

3.

Yes, I see no other exception. And Eclipselink seems to do already something before, I get messages like

 

[EPS Config]: 2008.03.11 02:34:35.782--ServerSession(471035)--Thread(Thread[main,5,main])--The column name for element [private java.lang.String com.emd.testpersistence.PhaMatLoc.lcomp] is being defaulted to: LCOMP.

 

before the exception comes.

 

4.
Currently I use eclipselink-incubation-1.0M5, using eclipselink-incubation-20080228 results in the following error:
 

Exception in thread "main" Local Exception Stack:

Exception [EclipseLink-30005] (Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080228)): org.eclipse.persistence.exceptions.PersistenceUnitLoadingException

Exception Description: An exception was thrown while searching for persistence archives with ClassLoader: sun.misc.Launcher$AppClassLoader@133056f

Internal Exception: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080228)): org.eclipse.persistence.exceptions.EntityManagerSetupException

Exception Description: Predeployment of PersistenceUnit [] failed.

Internal Exception: java.util.ConcurrentModificationException

at org.eclipse.persistence.exceptions.PersistenceUnitLoadingException.exceptionSearchingForPersistenceResources(PersistenceUnitLoadingException.java:121)

at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:86)

at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)

at com.emd.testpersistence.MyEntityManager.main(MyEntityManager.java:89)

Caused by: javax.persistence.PersistenceException: Exception [EclipseLink-28018] (Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080228)): org.eclipse.persistence.exceptions.EntityManagerSetupException

Exception Description: Predeployment of PersistenceUnit [] failed.

Internal Exception: java.util.ConcurrentModificationException

at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:809)

at org.eclipse.persistence.internal.jpa.JavaSECMPInitializer.callPredeploy(JavaSECMPInitializer.java:130)

at org.eclipse.persistence.internal.jpa.JavaSECMPInitializer.initPersistenceUnits(JavaSECMPInitializer.java:198)

at org.eclipse.persistence.internal.jpa.JavaSECMPInitializer.initialize(JavaSECMPInitializer.java:213)

at org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:72)

... 2 more

Caused by: Exception [EclipseLink-28018] (Eclipse Persistence Services - 1.0 (Build SNAPSHOT - 20080228)): org.eclipse.persistence.exceptions.EntityManagerSetupException

Exception Description: Predeployment of PersistenceUnit [] failed.

Internal Exception: java.util.ConcurrentModificationException

at org.eclipse.persistence.exceptions.EntityManagerSetupException.predeployFailed(EntityManagerSetupException.java:209)

... 7 more

Caused by: java.util.ConcurrentModificationException

at java.util.HashMap$HashIterator.nextEntry(Unknown Source)

at java.util.HashMap$ValueIterator.next(Unknown Source)

at org.eclipse.persistence.internal.jpa.metadata.MetadataProcessor.processAnnotations(MetadataProcessor.java:239)

at org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.processORMetadata(PersistenceUnitProcessor.java:272)

at org.eclipse.persistence.internal.jpa.EntityManagerSetupImpl.predeploy(EntityManagerSetupImpl.java:766)

... 6 more

 

 

best regards,
Alex

----- Ursprüngliche Mail ----
Von: Gordon Yorke <gordon.yorke@xxxxxxxxxx>
An: EclipseLink User Discussions <eclipselink-users@xxxxxxxxxxx>
Gesendet: Dienstag, den 11. März 2008, 14:16:56 Uhr
Betreff: Re: [eclipselink-users] No Persistence provider for EntityManager - Error when using EclipseLink

Hello Alex,
  What application server are you running in?  Are you specifying the
Persistence provider in your persistence.xml file?  Is that the only
exception that you see?  Are you using the latest nightly from EclipseLink?
--Gordon

Alex_S wrote:
> Hi everybody,
>
>
> I have tried to switch my application from Toplink Essentials to
> Eclipselink, but it currently doesn't work.
>
> After replacing the jar library and doing the necessary changes in
> persistence.xml and source code I always get an
>
> Exception in thread "main" javax.persistence.PersistenceException: No
> Persistence provider for EntityManager named default
>     at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
>     at com.emd.testpersistence.MyEntityManager.main(MyEntityManager.java:89)
>
>
> Thx for help,
> Alex

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



E-Mails jetzt auf Ihrem Handy..


-----Integrierter Anhang folgt-----

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Lesen Sie Ihre E-Mails jetzt einfach von unterwegs mit Yahoo! Go.


-----Integrierter Anhang folgt-----

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Beginnen Sie den Tag mit den neuesten Nachrichten. Machen Sie Yahoo! zu Ihrer Startseite!


-----Integrierter Anhang folgt-----

_______________________________________________
eclipselink-users mailing list
eclipselink-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-users



Lesen Sie Ihre E-Mails auf dem Handy..

Back to the top