Bug 256686 - test-oxm and test-jaxb fails with JDK 1.5
Summary: test-oxm and test-jaxb fails with JDK 1.5
Status: RESOLVED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: Eclipselink (show other bugs)
Version: unspecified   Edit
Hardware: All All
: P2 normal (vote)
Target Milestone: ---   Edit
Assignee: Nobody - feel free to take it CLA
QA Contact:
URL:
Whiteboard:
Keywords: test
Depends on:
Blocks:
 
Reported: 2008-11-26 14:12 EST by Edwin Tang CLA
Modified: 2022-06-09 10:21 EDT (History)
1 user (show)

See Also:


Attachments
patch file for changes (2.73 KB, patch)
2008-11-26 16:07 EST, Edwin Tang CLA
no flags Details | Diff
revised patch based on feedback from Blaise (3.65 KB, patch)
2008-11-27 11:15 EST, Edwin Tang CLA
no flags Details | Diff
revised patch (3.48 KB, patch)
2008-11-27 14:07 EST, Edwin Tang CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Edwin Tang CLA 2008-11-26 14:12:58 EST
With JDK 1.5, executing 'ant test-oxm' and 'test-jaxb' from trunk fails during compiling the tests. The error is "package javax.xml.bind does not exist". The package is in trunk\moxy\plugins\javax.xml.bind_2.0.0.jar, I cannot see the jar in the compiling classpath, how come there are no problems with JDK 1.6? 

Error message:
==============
compile-tests-against-jar:
    [javac] Compiling 1078 source files to /net/stame10.us.oracle.com/scratch/aime/eclipselink/org.eclipse.persistence/trunk/moxy/eclipselink.moxy.test/classes
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] Compiling 130 source files to /net/stame10.us.oracle.com/scratch/aime/eclipselink/org.eclipse.persistence/trunk/moxy/eclipselink.moxy.test/classes
    [javac] /net/stame10.us.oracle.com/scratch/aime/eclipselink/org.eclipse.persistence/trunk/moxy/eclipselink.moxy.test/src/org/eclipse/persistence/testing/jaxb/JAXBTestCases.java:20: package javax.xml.bind does not exist
    [javac] import javax.xml.bind.JAXBContext;
    [javac]                       ^
Comment 1 Edwin Tang CLA 2008-11-26 16:00:14 EST
(Blaise) The JAXB APIs are included with JDK 1.6, but for JDK 1.5 you need to supply them in jar.
Comment 2 Edwin Tang CLA 2008-11-26 16:07:53 EST
Created attachment 118841 [details]
patch file for changes

- Add eclipselink.moxy.depend and remove jaxb-api.lib in trunk/moxy/eclipselink.moxy.test/build.properties
- Include ${eclipselink.moxy.plugins}/${eclipselink.moxy.depend} in the classpaths of build and test targets
Comment 3 Edwin Tang CLA 2008-11-27 11:13:34 EST
Feedback from Blaise: Ultimately we need it to be included with only 1.5.  I believe some versions of JDK 1.6 include JAXB 2.0 and others include JAXB 2.1, so I'm concerned with always including a JAXB 2.0 jar on the classpath.
Comment 4 Edwin Tang CLA 2008-11-27 11:15:23 EST
Created attachment 118927 [details]
revised patch based on feedback from Blaise

Include jaxb api jar in the classpath only on JDK 1.5
Comment 5 Edwin Tang CLA 2008-11-27 14:07:39 EST
Created attachment 118947 [details]
revised patch

Reduce 2 <condition> tasks to one in the patch
Comment 6 Edwin Tang CLA 2008-11-27 14:09:46 EST
The jaxb api jar had been in the classpaths. With Eric's build reorg checkins, the jar was renamed and moved to another directory, it is not in the classpaths any more. Testing moxy still works on JDK 1.6 because the JAXB APIs are included with JDK 1.6, but it fails on JDK 1.5.
 
With this patch, per Blaise's request, trunk\moxy\plugins\javax.xml.bind_2.0.0.jar will be included in the classpaths only if testing moxy on JDK 1.5. 
 
Code reviewed by: Blaise Doughan, Eric Gwin
Comment 7 Eric Gwin CLA 2008-11-28 10:50:38 EST
Edwin's statements as to the cause of this issue are misleading. The jaxb api library name was not changed in my transaction. However, I did move third-party library definitions into the respective component builds. The definition for javax-api.lib was seemingly unneeded, since the compile worked without it, so I removed it.

The issue wasn't found because:
 - prior to my change the definition in trunk build.properties of "jaxb-api.lib" was correct (moxy/plugings/javax.xml.bind_2.0.0.jar) and overrode the local incorrect definition (../eclipselink.moxy.lib/jaxb-api.jar).
 - the default build now uses JDK 6 which includes javax.xml.bind
 - after my change, only the incorrect definition was set but it was not used unless the compile was done with an older JDK.


Comment 8 Eric Gwin CLA 2008-11-28 13:39:07 EST
The same problem actually exists with the org.eclipse.persistence.moxy build since the "javax-api.lib" is local (and also incorrect) but unused, unless JDK5 is used in the compile. I will fix the scripts.
Comment 9 Eric Gwin CLA 2008-11-28 13:47:54 EST
reopening to add patch.
Comment 10 Eric Gwin CLA 2008-11-28 13:51:19 EST
was unable to create patch.
Comment 11 Eclipse Webmaster CLA 2022-06-09 10:21:17 EDT
The Eclipselink project has moved to Github: https://github.com/eclipse-ee4j/eclipselink