| Summary: | java.net.URISyntaxException: Illegal character in opaque part at index 2 | ||||||
|---|---|---|---|---|---|---|---|
| Product: | z_Archived | Reporter: | Chuong Pham <chuonglepham> | ||||
| Component: | Eclipselink | Assignee: | Nobody - feel free to take it <nobody> | ||||
| Status: | CLOSED FIXED | QA Contact: | |||||
| Severity: | major | ||||||
| Priority: | P3 | CC: | chuonglepham, eclipselink.orm-inbox, gabriele, tom.ware | ||||
| Version: | unspecified | ||||||
| Target Milestone: | --- | ||||||
| Hardware: | PC | ||||||
| OS: | Windows XP | ||||||
| Whiteboard: | |||||||
| Attachments: |
|
||||||
I have been stuck on this bug for the last two weeks without a solution in sight. Any help from the EclipseLink team is much appreciated. 'any chance this is related to the direction of your slash characters? The following has slashes going in multiple directions: D:\Project\website/WebContent/META-INF I cannot recreate this problem based on your instructions, but do get an error when I use the wrong slash character. I can imagine the wrong slash character combining with a letter in your path to form a special character and causing an exception like this. BTW: Using JDK 1.6 and Ant 1.7.1 Pasted your compiler args into a working javac command and changed only the path to the persistence.xml (In reply to comment #2) > 'any chance this is related to the direction of your slash characters? > My relative path in the build.xml file is specified as "${web.dir}/META-INF" which get translated by ANT as "D:\Project\website/WebContent/META-INF" - I have no control over ANT's path translation or the slashes. I ran the following in the command prompt and it seemed fine: "C:\Program Files\Java\jdk1.6.0_25\bin\javac" -Aeclipselink.persistencexml=d:\Project\website\WebContent\META-INF\persistence.xml D:\Project\website\src\java\au\com\ckd\model\BookModel.java which led me to believe that there's a problem with EclipseLink itself. What happens if you specifiy an explicit path instead of ${web.dir}
(In reply to comment #5) > What happens if you specifiy an explicit path instead of ${web.dir} Same error using explicit path. The only way I found it to "work" is moving the META-INF directory to the same level as the ANT's build.xml - which is restrictive - I mean, why can't one have the META-INF directory under WebContent directory? I'm baffled by this specific requirement from EclipseLink. ok... there's the key (and the reason we ask for packaged test cases) The file has to be outside of the directory subtree the classes are in. The reason for this issue is a limitation in a JDK-provided class specific to the classes provided to use with annotation processing. The workaround, of course, is to put a copy of your file in the same directory subtree as you are working in. I am updating the code to expand the usecases where we work-around this issue with the JDK classes. My recreation of the test case passes with this change. Created attachment 196661 [details]
Fix - larger workaround to limitation in javax.annotation.processing.Filer
Checked in attached change.
Reviewed by Guy Pelletier
Tested manually using our jpa test build and the following target:
<target name="compile-test-comp" depends="config-flat">
<javac srcdir="${eclipselink.jpa.test}/${src.dir}"
destdir="${eclipselink.jpa.test}/${classes.dir}"
debug="${javac.debug}"
debuglevel="${javac.debuglevel}"
optimize="${javac.optimize}"
source="${javac.version}"
target="${javac.version}"
deprecation="${javac.deprecation}"
failonerror="true">
<compilerarg value="-Aeclipselink.persistencexml=c:/temp/persistence.xml"
compiler="javac1.6" />
<compilerarg line=" -processor
org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor" />
<compilerarg line=" -proc:only" compiler="javac1.6" />
<include name="org/eclipse/persistence/testing/models/jpa/extensibility/**"/>
<classpath>
<pathelement path="C:/EclipseLinkView1/eclipselink.jar"/>
<path refid="compile.path"/>
<pathelement path="C:/EclipseLinkView1/jpa/eclipselink.jpa.test/eclipselink-tests.jar"/>
<pathelement path="C:/EclipseLinkView1/foundation/eclipselink.core.test/eclipselink-tests.jar"/>
</classpath>
</javac>
</target>
(In reply to comment #7) > ok... there's the key (and the reason we ask for packaged test cases) The file > has to be outside of the directory subtree the classes are in. Sorry, Tom. I'll remember to include test case(s) next time. :) > The reason for this issue is a limitation in a JDK-provided class specific to > the classes provided to use with annotation processing. I guess the changes you have applied will remedy any future issue with the JDK-provided class. Does the JDK development team at Oracle need to know about this issue? I suppose if they rectify the issue at the JDK-level then there won't be a need to fix at the JPA-level - not just for EclipseLink - but for other JPA implementations as well. The limitation is documented, so I suspect the team is aware. I guess users of the API just need to work around the limitation. In this case, we missed an exception that could be thrown when we hit the limitation, and therefore didn't trigger the workaround. *** Bug 328560 has been marked as a duplicate of this bug. *** The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink |
Build Identifier: EclipseLink v2.2.0.v20110202-r8913 bundled with Glassfish 3.1 I got this ANT task: <javac verbose="on" srcdir="${src.dir}" destdir="${build.dir}/${context.path}/classes" debug="${compile.debug}" debuglevel="${javac.debuglevel}" optimize="${compile.optimize}" deprecation="${javac.deprecation}" failonerror="true"> <compilerarg value="-Aeclipselink.persistencexml=${web.dir}/META-INF" compiler="javac1.6" /> <compilerarg line=" -processor org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor" /> <compilerarg line=" -proc:only" compiler="javac1.6" /> <classpath refid="compile.classpath"/> </javac> When I ran the above task, I got this error: [javac] Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: D:\Project\website/WebContent/META-INF [javac] at java.net.URI$Parser.fail(URI.java:2809) [javac] at java.net.URI$Parser.checkChars(URI.java:2982) [javac] at java.net.URI$Parser.parse(URI.java:3019) [javac] at java.net.URI.<init>(URI.java:578) [javac] at java.net.URI.create(URI.java:840) [javac] ... 38 more I've traced the error to this line <compilerarg value="-Aeclipselink.persistencexml=${web.dir}/META-INF" compiler="javac1.6" />. I'm using EclipseLink version 2.2.0.v20110202-r8913 that comes bundled with Glassfish 3.1. I have also tried compiling the above ANT task with the standalone EclipseLink libraries version 2.2.0.v20110202-r8913 and got the same error. I'm using JDK 1.6.0.24. Development PC is Windows XP Service Pack 3. Reproducible: Always Steps to Reproduce: 1. Download and extract EclipseLink v2.2.0.v20110202-r8913 (standalone or bundled version with Glassfish 3.1 server) 2. Create an ANT javac task with the following parameters: <compilerarg value="-Aeclipselink.persistencexml=${web.dir}/META-INF" compiler="javac1.6" /> <compilerarg line=" -processor org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor" /> <compilerarg line=" -proc:only" compiler="javac1.6" /> 3. Build project using ANT (v1.7 or later) You should get an error "java.net.URISyntaxException: Illegal character in opaque part at index 2" which can be attributed to this parameter: compilerarg value="-Aeclipselink.persistencexml=${web.dir}/META-INF" compiler="javac1.6" /> For detail information, please see http://old.nabble.com/EclipseLink-2%3A-ANT-Task-Error-to31475388.html topic in EclipseLink forum.