Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-dev] Unexpected AssertError - cannot reproduce - c:/dir with spaces/META-INF/persistence.xml resolves fine in windows

John,
	Hi, I would like to work with you to resolve this issue, but I cannot at this time reproduce it on windows - this test scenario still passes, I will try jdk6_u10.

	1)	I ran one of my original test cases that matches the scenario of users that are constrained to create eclipse projects off their c:/documents and settings/ directory.  I am unable to reproduce your error.  I work fine with a space in the file path of a J2SE JPA eclipse project.
		The error that this original 2008/03 fix addressed was based on a key:value mismatch on %20 vs " " - you have a different scenario that is earlier in the code path.

-----------------ReTesting Output---------------------
See attached jpg for a view of the eclipse test project

Source pu:
C:\wse\w34\stat  JPA\src\META-INF\persistence.xml
Runtime pu:
C:\wse\w34\stat  JPA\build\classes\META-INF\persistence.xml

Logs running on M9, Windows Vista, JDK 1.6.0_04-b12 in J2SE RESOURCE_LOCAL mode:

[EL Info]: 2008.06.25 19:21:56.341--ServerSession(22634321)--Thread(Thread[main,5,main])--file:/C:/wse/w34/stat%20%20JPA/build/classes/-statJPA login successful
[EL Finest]: 2008.06.25 19:21:56.342--ServerSession(22634321)--Thread(Thread[main,5,main])--End deploying Persistence Unit statJPA; state Deployed; factoryCount 1

----------------Debug Output---------------------------
As you can see, i get past the assert to line 138 and end up processing the persistence.xml......
133   public static URL computePURootURL(URL pxmlURL) throws IOException {
134        String protocol = pxmlURL.getProtocol();
135        if("file".equals(protocol)) { // NOI18N
136            // e.g. file:/tmp/META-INF/persistence.xml
137            assert(new File(pxmlURL.getFile()).isFile());
138            return new URL(pxmlURL, ".."); // NOI18N

with the following
puName	"file:/C:/wse/w34/stat  JPA/build/classes/statJPA" (id=57)	

org.eclipse.persistence.example.navigation.Introspector at localhost:57995	
	Thread [main] (Suspended)	
		PersistenceUnitProcessor.computePURootURL(URL) line: 138	
		PersistenceProvider.createEntityManagerFactory(String, Map, ClassLoader) line: 98	
		PersistenceProvider.createEntityManagerFactory(String, Map) line: 64	
		Persistence.createEntityManagerFactory(String, Map) line: 83	
		Persistence.createEntityManagerFactory(String) line: 60	
		Introspector.configurePersistenceUnit(String, boolean) line: 81	
		Introspector.initialize() line: 106	
		Introspector.main(String[]) line: 160	
pxmlURL	URL  (id=20)	
	authority	"" (id=23)	
	file	"/C:/wse/w34/stat%20%20JPA/build/classes/META-INF/persistence.xml" (id=27)	
	handler	Handler  (id=28)	
	hashCode	-1	
	host	"" (id=23)	
	hostAddress	null	
	path	"/C:/wse/w34/stat%20%20JPA/build/classes/META-INF/persistence.xml" (id=27)	
	port	-1	
	protocol	"file" (id=31)	
	query	null	
	ref	null	
	userInfo	null	

	2)	I also unit tested the code outside of EclipseLink in line 137 aFile.isFile() returns true for a file at the end of a file://dir with spaces/ url
		The only way I could get the following code to fail is if the xml file did not exist.

            URL pxmlURL = new URL("file://c:/_testing/space dir/META-INF/persistence.xml");
            File aFile = new File(pxmlURL.getFile()); 
            assert(aFile.isFile());            

	Your error bothers me, if you have any more specific info on your setup like your OS (linux or windows), the path to your persistence.xml and if you are running inside eclipse as a SE run target it would be helpful in fixing your issue.

	thank you
	/michael

-----Original Message-----
From: GORDON.YORKE@xxxxxxxxxx 
Sent: Wednesday, June 25, 2008 4:16 PM
To: Dev mailing list for Eclipse Persistence Services
Subject: Re: [eclipselink-dev] Unexpected AssertError


Hello John,
   There is a pre-existing bug 
https://bugs.eclipse.org/bugs/show_bug.cgi?id=210280 which was fixed for 
jars but based on your report seems to be still broken for files.
Could you please reopen the bug and post your new findings.
Thank you,
--Gordon

vrmerlin wrote:
> We're evaluating EclipseLink as a potential JPA solution. When running M9 in
> an Eclipse project, I was getting the following error:
>
> Exception in thread "main" java.lang.AssertionError
> 	at
> org.eclipse.persistence.internal.jpa.deployment.PersistenceUnitProcessor.computePURootURL(PersistenceUnitProcessor.java:137)
> 	at
> org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:98)
> 	at
> org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(PersistenceProvider.java:64)
> 	at
> javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83)
> 	at
> iccs.base.db.jdbcpool.ConCacheGetter.getEntityManager(ConCacheGetter.java:233)
> 	at
> iccs.services.system_manager.server.ProcessDataModel.<init>(ProcessDataModel.java:49)
> 	at
> iccs.services.system_manager.server.SysMgrCentralImpl.<init>(SysMgrCentralImpl.java:76)
> 	at
> iccs.services.system_manager.server.SysMgrServerMain.<init>(SysMgrServerMain.java:52)
> 	at
> iccs.services.system_manager.server.SysMgrServerMain.main(SysMgrServerMain.java:71)
>
> Looking down into the eclipselink source code, it appeared that EclipseLink
> was failing the isFile() test for the persistence.xml file it found. The
> reason it failed was because there was a space in the path to that file (in
> particular, my eclipse project name). When I created a new project (without
> a space), the problem went away and things went fine.
>
> It took quite some time to track down why I was getting this rather
> ambigious error, and I don't think I should have gotten it in the first
> place (OpenJPA and Hibernate didn't have any problems with my Eclipse
> project name at all). I'd really rather not put that artificial constraint
> on our developers.
>
> Having a space in the path to the persistence.xml file seems reasonable...
> however, I can't find much mention of anyone else having this problem. Any
> thoughts on how I might fix it?
>
> btw, I'm using JDK 6u10.
>
> Thanks,
> John
>
>   
_______________________________________________
eclipselink-dev mailing list
eclipselink-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/eclipselink-dev

Attachment: eclipse_jpa_se_project_with_space_in_path_to_pu.jpg
Description: JPEG image


Back to the top