You are viewing a plain text version of this content. The canonical link for it is here.
Posted to j-users@xerces.apache.org by michael sorens <ms...@softhome.net> on 2005/11/06 16:28:50 UTC

inside/outside eclipse vs java 1.4/1.5 vs xerces problem

I have a Xerces issue that surfaced when I upgraded from Java 1.4.2 to 1.5.
Plus I get different behavior depending on whether I am inside or outside Eclipse.

Here's my simple test file:
	import org.apache.xerces.dom.DocumentImpl;
	public class DocTest extends DocumentImpl {
		public static void main(String[] args) {
				System.out.println("hello world");
		}
	}
This compiled fine with Java 1.4, either with the command-line javac or from within Eclipse.

Now that I upgraded to Java 1.5, Eclipse (with 1.5) compiles it fine,
but from the command-line I get this error:

DocTest.java:2: getDomConfig() in org.apache.xerces.dom.CoreDocumentImpl cannot
implement getDomConfig() in org.w3c.dom.Document; attempting to use incompatible
  return type
found   : org.apache.xerces.dom3.DOMConfiguration
required: org.w3c.dom.DOMConfiguration
public class DocTest extends DocumentImpl {

I used the Xalan EnvironmentCheck tool to compare environments between Eclipse and command-line, but they seem to be comparable (I think).

This section is identical when run inside or outside Eclipse:
	version.xerces2=Xerces-J 2.6.2
	version.xerces1=not-present
	version.xalan2_2=Xalan Java 2.6.0
	version.xalan1=not-present
	version.ant=not-present
	java.version=1.5.0_03
	version.DOM=2.0

So two main questions:
(1) Why am I seeing a difference between command-line and Eclipse compilation?
(2) What is causing the compilation error at all?

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: inside/outside eclipse vs java 1.4/1.5 vs xerces problem

Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/msorens@softhome.net/:

> For Eclipse, I did have the system library above the Xerces library. I 
> tried moving that below the xerces jars (xercesimpl.jar and 
> xml-apis.jar) but this made no difference in Eclipse (i.e. the test file 
> still compiled without error).

I can't help you much more as to ask you to check if you're really 
using Java 5 (instead of Java 1.4) system library with your Eclipse 
project configuration.

> For the command-line, I tried an experiment of *removing* my explicit 
> reference to xercesimpl.jar and xml-apis.jar in the -cp argument but 
> this made no difference (i.e. the test file still compiled *with* the 
> error).

The "xml-apis.jar" must always go in the endorsed libraries. 
Additionally with Sun's JDK 1.4/5 one could use the command-line option:

  -Xbootclasspath/p:<directories and zip/jar files separated by ;>

with the Java launcher and:

  -bootclasspath <path>

with the Java compiler (note the system library "<jre>/lib/rt.jar" 
must be explicitly added if overriding the boot class path for the 
compiler).

> I will download xerces 2.7.1 and try that, but in the meantime I am 
> wondering what I am observing. Does Java 1.5 include a "built-in" 
> version of xerces? If not, wouldn't I have received more errors when I 
> ran the command-line experiment above?

AFAIK the Sun's Java 5 includes Xerces but with a renamed package 
structure, so classes (other than "xml-apis.jar") should not collide.

> Where is the class loading order for Java documented?

Apart from the "Endorsed Standards Override Mechanism" (i.e. using 
the "java.endorsed.dirs" system property) I don't know if there are 
other requirements for the different implementations. I guess no 
classes under the 'java.*' package hierarchy may get overridden, for 
example.

> I have looked in 
> vain to find this. That is, among:
> --java's "built-in" libraries;
> --jars in the endorsed directory;
> --jars specified via CLASSPATH or -cp (mutually exclusive?);
> --jars specified as the runnable target;
> --(others...?)
> ... In what precedence order are these searched?

These one could test in practice.

-- 
Stanimir


---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: inside/outside eclipse vs java 1.4/1.5 vs xerces problem

Posted by ms...@softhome.net.
For Eclipse, I did have the system library above the Xerces library. I tried 
moving that below the xerces jars (xercesimpl.jar and xml-apis.jar) but this 
made no difference in Eclipse (i.e. the test file still compiled without 
error). 

For the command-line, I tried an experiment of *removing* my explicit 
reference to xercesimpl.jar and xml-apis.jar in the -cp argument but this 
made no difference (i.e. the test file still compiled *with* the error). 

I will download xerces 2.7.1 and try that, but in the meantime I am 
wondering what I am observing. Does Java 1.5 include a "built-in" version of 
xerces? If not, wouldn't I have received more errors when I ran the 
command-line experiment above? 

Where is the class loading order for Java documented? I have looked in vain 
to find this. That is, among:
 --java's "built-in" libraries;
 --jars in the endorsed directory;
 --jars specified via CLASSPATH or -cp (mutually exclusive?);
 --jars specified as the runnable target;
 --(others...?)
... In what precedence order are these searched? 


Original Message:
 -----------------
From: Stanimir Stamenkov stanio@myrealbox.com
Date: Sun, 06 Nov 2005 17:51:15 +0200
To: j-users@xerces.apache.org
Subject: Re: inside/outside eclipse vs java 1.4/1.5 vs xerces problem 

/michael sorens/:
> (1) Why am I seeing a difference between command-line and Eclipse 
> compilation?

Check your Eclipse project configuration - you've most probably got
the Xerces library set before the System library, which is really
loaded at JVM boot, i.e. before Xerces, during run-time (incl. using
the command line compiler). 

> (2) What is causing the compilation error at all?

I guess it is because Xerces 2.6.2 included experimental support for
DOM 3 but using different package names (see
'org.apache.xerces.dom3' vs. 'org.w3c.dom') and the Xerces revision
included in the Sun's Java 5 implementation is somewhat newer. You
may try using Xerces 2.7.1 instead. 

-- 
Stanimir 

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org


Re: inside/outside eclipse vs java 1.4/1.5 vs xerces problem

Posted by Stanimir Stamenkov <st...@myrealbox.com>.
/michael sorens/:

> (1) Why am I seeing a difference between command-line and Eclipse 
> compilation?

Check your Eclipse project configuration - you've most probably got 
the Xerces library set before the System library, which is really 
loaded at JVM boot, i.e. before Xerces, during run-time (incl. using 
the command line compiler).

> (2) What is causing the compilation error at all?

I guess it is because Xerces 2.6.2 included experimental support for 
DOM 3 but using different package names (see 
'org.apache.xerces.dom3' vs. 'org.w3c.dom') and the Xerces revision 
included in the Sun's Java 5 implementation is somewhat newer. You 
may try using Xerces 2.7.1 instead.

-- 
Stanimir

---------------------------------------------------------------------
To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
For additional commands, e-mail: j-users-help@xerces.apache.org