Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [eclipselink-dev] Unexpected AssertError - reproduced: assertions were disabled on our tests

John,
	Thanks for the unit test demo.  We could not reproduce your issue before because assertions were disabled by default on our side.  Gordon looked at the code as well and found this - thank you.  So even though the encoded URL failed the isFile() check, because the $20 was not decoded to " " - we failed to stop on this disabled assertion.

	Reproduction:
-------------------
	Turn assertions on for the JVM
		-ea:org.eclipse.persistence
	
	Workaround:
-------------------
	You should be able to run past this assert failure by disabling assertions for EclipseLink until you are able to pick up the next milestone 1.0 which will include this fix.

	Add the following JVM switch to your launch configuration (the ... at the end is required to disable on subpackages)

		-da:org.eclipse.persistence...

	see:
	http://java.sun.com/javase/6/docs/technotes/tools/windows/java.html


	Fix:
-------------------
	We will remove the assert check as it is not required because this function is gauranteed that the url references a file.
	The fix will appear in the next milestone.

https://bugs.eclipse.org/bugs/attachment.cgi?id=106017&action=diff
https://bugs.eclipse.org/bugs/show_bug.cgi?id=210280

	JPA SE Test details:
-------------------
Passes with -ea:org.eclipse.persistence...
Passes with <no jvm -ea switch>

[EL Info]: 2008.06.27 11:21:28.426--ServerSession(26219575)--Thread(Thread[main,5,main])--file:/C:/wse/w34c/stat%20%20JPA/build/classes/-statJPA login successful
[EL Finest]: 2008.06.27 11:21:28.426--ServerSession(26219575)--Thread(Thread[main,5,main])--End deploying Persistence Unit statJPA; state Deployed; factoryCount 1

Fails with -ea:org.eclipse.persistence...

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:123)
	at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:99)
	at org.eclipse.persistence.example.navigation.Introspector.configurePersistenceUnit(Introspector.java:81)
	at org.eclipse.persistence.example.navigation.Introspector.initialize(Introspector.java:106)
	at org.eclipse.persistence.example.navigation.Introspector.main(Introspector.java:160)


	Unit Test details:
-------------------
C:\wse\w34c\spaces test\bin>java -ea MyDemo
Exception in thread "main" java.lang.AssertionError
        at MyDemo.<init>(MyDemo.java:20)
        at MyDemo.main(MyDemo.java:32)

C:\wse\w34c\spaces test\bin>java -da MyDemo
Result  undecoded = false for url: /C:/wse/w34c/spaces%20test/bin/test.txt
Result  decoded   = true for url: /C:/wse/w34c/spaces test/bin/test.txt
Result  toString  = false for url: file:/C:/wse/w34c/spaces%20test/bin/test.txt


-----Original Message-----
From: John Fisher [mailto:fisher23@xxxxxxxx]
Sent: Thursday, June 26, 2008 5:38 PM
To: Dev mailing list for Eclipse Persistence Services
Subject: RE: [eclipselink-dev] Unexpected AssertError - cannot reproduce
- c:/dir with spaces/META-INF/persistence.xml resolves fine in windows



Ok, outside of eclipse entirely, I created a directory called "c:\My Demo"
and created MyDemo.java as follows:

import java.io.File;
import java.net.MalformedURLException;
import java.net.URL;

public class MyDemo {

    public MyDemo() {
	URL url = null;
        ClassLoader loader = this.getClass().getClassLoader();
        url = loader.getResource("MyDemo.java");
        File f = new File(url.getFile());
        System.out.println("Result = " + f.isFile());
    }

    public static void main(String[] argv) {
	new MyDemo();	
    }

}

This is similar to the check done with the AsserError. I compiled and ran it
from the command prompt, and got

Result = false

When I rename the parent directory to "c:\MyDemo" (no space), I get:

Result = true

So, it appears that isFile() doesn't like the %20 that the getResource(...)
call is returning. This is using JDK 1.6.0_06 a Vista computer and on an XP
computer running JDK 1.6.0-b105. Note that both are on a domain, and have a
couple of mounted network drives (if that by chance makes any difference). 

Does this help?




-----Original Message-----
From: eclipselink-dev-bounces@xxxxxxxxxxx
[mailto:eclipselink-dev-bounces@xxxxxxxxxxx] On Behalf Of
MICHAEL.OBRIEN@xxxxxxxxxx
Sent: Thursday, June 26, 2008 9:43 AM
To: Dev mailing list for Eclipse Persistence Services
Subject: RE: [eclipselink-dev] Unexpected AssertError - cannot reproduce -
c:/dir with spaces/META-INF/persistence.xml resolves fine in windows

John,
	Hi, could I ask that you zip up your Eclipse project or a test
project that reproduces your problem.
	Since we are both running Vista on JDK6, we will import your project
and see if we can get the same problem here.
	I am running Ganymede 3.4M5, I have a 3.3 europa version - let us
know which eclipse version you are running.
	
	thank you
	/michael
	

-----Original Message-----
From: John Fisher [mailto:fisher23@xxxxxxxx]
Sent: Thursday, June 26, 2008 11:03 AM
To: Dev mailing list for Eclipse Persistence Services
Subject: RE: [eclipselink-dev] Unexpected AssertError - cannot reproduce
- c:/dir with spaces/META-INF/persistence.xml resolves fine in windows



Also, for what it's worth, I'm getting this exception on Vista.

John


-----Original Message-----
From: eclipselink-dev-bounces@xxxxxxxxxxx
[mailto:eclipselink-dev-bounces@xxxxxxxxxxx] On Behalf Of
MICHAEL.OBRIEN@xxxxxxxxxx
Sent: Wednesday, June 25, 2008 5:19 PM
To: Dev mailing list for Eclipse Persistence Services
Subject: 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.com
putePURootURL(PersistenceUnitProcessor.java:137)
> 	at
>
org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(P
ersistenceProvider.java:98)
> 	at
>
org.eclipse.persistence.jpa.PersistenceProvider.createEntityManagerFactory(P
ersistenceProvider.java:64)
> 	at
>
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:83
)
> 	at
>
iccs.base.db.jdbcpool.ConCacheGetter.getEntityManager(ConCacheGetter.java:23
3)
> 	at
>
iccs.services.system_manager.server.ProcessDataModel.<init>(ProcessDataModel
.java:49)
> 	at
>
iccs.services.system_manager.server.SysMgrCentralImpl.<init>(SysMgrCentralIm
pl.java:76)
> 	at
>
iccs.services.system_manager.server.SysMgrServerMain.<init>(SysMgrServerMain
.java:52)
> 	at
>
iccs.services.system_manager.server.SysMgrServerMain.main(SysMgrServerMain.j
ava: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

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

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


Back to the top