EclipseLink project works in one Eclipse Workspace but not in another [message #385175] |
Sat, 10 January 2009 00:03 |
|
Hi,
I have a very small EclipseLink example which runs perfectly in a
workspace.
I imported this example in another workspace (same Eclipse installation
therefore same version, available plug-ins, etc.) and it did not work.
The following message was issued:
Exception in thread "main" javax.persistence.PersistenceException: No
Persistence provider for EntityManager named people
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:89)
at
javax.persistence.Persistence.createEntityManagerFactory(Per sistence.java:60)
at de.vogella.jpa.eclipselink.main.Main.main(Main.java:18)
After lots of checking the only difference I could find is that the
second workspace is in a deep folder structure, something like:
C:\Documents and
Settings\vogella\Desktop\Documents\08_MyDocuments\20_Documen tation\JPAPersistenceExamples\de.vogella.jpa.eclipselink2\sr c\META-INF
I imported the project into a thrid workspace with a shorter path (again
same Eclipse installation) and it did work.
Are there any restrictions in relation to the path name or are there any
other reasons why the project does not run in the second workspace?
Best regards, Lars
--
Lars Vogel
http://www.vogella.de/eclipse.html - Tutorials about Eclipse
http://www.vogella.de/articles/RichClientPlatform/article.ht ml - Eclipse
RCP Tutorial
|
|
|
|
|
Re: EclipseLink project works in one Eclipse Workspace but not in another [message #385184 is a reply to message #385180] |
Mon, 12 January 2009 20:44 |
|
Hi,
this seesm to be a bug in the Java Classloader (Java 6 Update 11). I
created the following example to demonstrate it:
---------------
package de.vogella.jpa.bug;
import java.io.IOException;
import java.net.URL;
import java.util.Enumeration;
public class Test {
public static void main(String[] args) {
ClassLoader currentLoader = Thread.currentThread()
.getContextClassLoader();
try {
Enumeration<URL> resources = currentLoader
.getResources("META-INF/persistence.xml");
while (resources.hasMoreElements()) {
System.out.println("Elements found");
resources.nextElement();
}
} catch (IOException e) {
e.printStackTrace();
}
}
}
----------
Running this in a project with a medium sized path name delivers a hit.
Running it in a project with a long path name return nothing.
I'll open a bug at Sun.
Best regards, Lars
|
|
|
|
Powered by
FUDForum. Page generated in 0.03991 seconds