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 Elizabeth Clause <el...@gmail.com> on 2008/04/08 20:58:06 UTC

Updating jars

I'm using Groovy, NekoHTML, and Xerces to parse a web page into xml.
Here's the sample code (called NewSaxParserText.groovy):

-------------------------------------------------------------
import org.cyberneko.html.parsers.SAXParser;

String url = "http://www.yahoo.com"
SAXParser parser = new SAXParser();
XmlParser xmlParser = new XmlParser(parser);
Node node = xmlParser.parse(url);
println(node)
-------------------------------------------------------------

I just updated my Xerces jar, and this code, which worked
xercesImpl-2.6.2.jar, broke when I updated to xercesImpl-2.8.1.jar. I
also tried updating to xercesImpl-2.9.0.jar, and got the same error.
Here is the stack trace:
Caught: java.lang.IncompatibleClassChangeError: Class
org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy does not
implement the requested interface org.xml.sax.Attributes
        at NewSaxParserText.run(NewSaxParserText.groovy:6)
        at NewSaxParserText.main(NewSaxParserText.groovy)

How do I fix this? I looked at updating the cyberneko jar and that
doesn't help. Here are the results of my experiments of whether the
code executes or fails with various jar combinations:

<table>
<tr>
	<td><br></td><td>nekohtml-0.9.5</td><td>nekohtml-1.9.7</td>
</tr>
<tr>
	<td>xercesImpl-2.6.2</td><td>Executes</td><td>Executes</td>
</tr>
<tr>
	<td>xercesImpl-2.8.1</td><td>Fails</td><td>Fails</td>
</tr>
<tr>
	<td>xercesImpl-2.9.0</td><td>Fails</td><td>Fails</td>
</tr>
</table>

Thanks for your help!
   Best regards,
             Elizabeth

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


Re: Updating jars

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Michael Glavassevich/Toronto/IBM@IBMCA wrote on 04/20/2008 01:57:41 AM:

> Jacob Kjome <ho...@visi.com> wrote on 04/19/2008 10:50:18 PM:
>
> > Elizabeth Clause wrote:
> > > Holger,
> > >   I just got around to trying your solution, and it seems to me that
> > > you think I'm using java 1.3. I'm not - I'm using Java 6:
> > > $ java -version
> > > java version "1.6.0_03"
> > > Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
> > > Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
> > >
> > > Did I misunderstand you?
> > >     ~Elizabeth
> >
> > Well, they can't be referring to JDK1.3 for at least two reasons...
> >
> > 1.  If one of the suggested solutions is to use the "endorsed
> > [standards override]
> > mechanism", then the solution applies to no less than JDK1.4.0 as
> > JDK1.3 didn't
> > have such a concept.
> >
> > 2.  It is mentioned that "xerces 2.6.2 ... is more or less the same
> > as what's in
> > the JDK".  Xerces didn't get in the JDK until at least JDK1.4, and I
> > think later
> > since they originally use Crimson.
>
> To clarify a few things about that ...
>
> Xerces was never included in Sun's JDK 1.4 (JAXP 1.1). It's always been
> Crimson. I believe the JAXP 1.2 RI was based on some version of Xerces
but
> that came after 1.4 and before 5.0. In other words not part of the JDK.
The
> JAXP 1.3 RI included in Sun's JDK 5.0 was probably forked off of this tag
> [1] (or something even later) in SVN over a year after Xerces 2.6.2 was

Got the dates wrong. It was a couple months after 2.6.2 however there were
many changes to the codebase made over that period.

> released. It has quite a bit of additional code developed on top of it to
> support JAXP 1.3 capabilities which only found their way to Apache when
Sun
> donated it later (2005). So while
> "com.sun.org.apache.xerces.internal.impl.Version" may report "Xerces-J
> 2.6.2" saying that what's in there is more or less the same as Xerces
2.6.2
> is quite inaccurate. Even more so for JDK 6 which also claims to include
> Xerces-J 2.6.2 if you query the Version class.
>
> > Have you tried using the endorsed mechanism?  Does it not work for you?
> >
> > Jake
>
> Thanks.
>
> [1] http://svn.apache.org/viewvc/xerces/java/tags/jaxp_1_3_0_04052004/
>
> Michael Glavassevich
> XML Parser Development
> IBM Toronto Lab
> E-mail: mrglavas@ca.ibm.com
> E-mail: mrglavas@apache.org
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org


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


Re: Updating jars

Posted by Michael Glavassevich <mr...@ca.ibm.com>.
Jacob Kjome <ho...@visi.com> wrote on 04/19/2008 10:50:18 PM:

> Elizabeth Clause wrote:
> > Holger,
> >   I just got around to trying your solution, and it seems to me that
> > you think I'm using java 1.3. I'm not - I'm using Java 6:
> > $ java -version
> > java version "1.6.0_03"
> > Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
> > Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
> >
> > Did I misunderstand you?
> >     ~Elizabeth
>
> Well, they can't be referring to JDK1.3 for at least two reasons...
>
> 1.  If one of the suggested solutions is to use the "endorsed
> [standards override]
> mechanism", then the solution applies to no less than JDK1.4.0 as
> JDK1.3 didn't
> have such a concept.
>
> 2.  It is mentioned that "xerces 2.6.2 ... is more or less the same
> as what's in
> the JDK".  Xerces didn't get in the JDK until at least JDK1.4, and I
> think later
> since they originally use Crimson.

To clarify a few things about that ...

Xerces was never included in Sun's JDK 1.4 (JAXP 1.1). It's always been
Crimson. I believe the JAXP 1.2 RI was based on some version of Xerces but
that came after 1.4 and before 5.0. In other words not part of the JDK. The
JAXP 1.3 RI included in Sun's JDK 5.0 was probably forked off of this tag
[1] (or something even later) in SVN over a year after Xerces 2.6.2 was
released. It has quite a bit of additional code developed on top of it to
support JAXP 1.3 capabilities which only found their way to Apache when Sun
donated it later (2005). So while
"com.sun.org.apache.xerces.internal.impl.Version" may report "Xerces-J
2.6.2" saying that what's in there is more or less the same as Xerces 2.6.2
is quite inaccurate. Even more so for JDK 6 which also claims to include
Xerces-J 2.6.2 if you query the Version class.

> Have you tried using the endorsed mechanism?  Does it not work for you?
>
> Jake

Thanks.

[1] http://svn.apache.org/viewvc/xerces/java/tags/jaxp_1_3_0_04052004/

Michael Glavassevich
XML Parser Development
IBM Toronto Lab
E-mail: mrglavas@ca.ibm.com
E-mail: mrglavas@apache.org


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


Re: Updating jars

Posted by Jacob Kjome <ho...@visi.com>.
Elizabeth Clause wrote:
> Holger,
>   I just got around to trying your solution, and it seems to me that
> you think I'm using java 1.3. I'm not - I'm using Java 6:
> $ java -version
> java version "1.6.0_03"
> Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
> Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)
> 
> Did I misunderstand you?
>     ~Elizabeth

Well, they can't be referring to JDK1.3 for at least two reasons...

1.  If one of the suggested solutions is to use the "endorsed [standards override] 
mechanism", then the solution applies to no less than JDK1.4.0 as JDK1.3 didn't 
have such a concept.

2.  It is mentioned that "xerces 2.6.2 ... is more or less the same as what's in 
the JDK".  Xerces didn't get in the JDK until at least JDK1.4, and I think later 
since they originally use Crimson.

Have you tried using the endorsed mechanism?  Does it not work for you?

Jake

> 
> 
> On Wed, Apr 9, 2008 at 8:58 AM, Holger Hoffstaette <ho...@wizards.de> wrote:
>> On Tue, 08 Apr 2008 14:58:06 -0400, Elizabeth Clause wrote:
>>
>>  > I just updated my Xerces jar, and this code, which worked
>>  > xercesImpl-2.6.2.jar, broke when I updated to xercesImpl-2.8.1.jar. I also
>>  > tried updating to xercesImpl-2.9.0.jar, and got the same error. Here is
>>  > the stack trace:
>>  > Caught: java.lang.IncompatibleClassChangeError: Class
>>  > org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy does not
>>  > implement the requested interface org.xml.sax.Attributes
>>  >         at NewSaxParserText.run(NewSaxParserText.groovy:6) at
>>  >         NewSaxParserText.main(NewSaxParserText.groovy)
>>
>>  What happens here is most likely not what you think happens, and it is
>>  also not _directly_ the fault of the updated jars. Look here:
>>  http://xerces.apache.org/xerces2-j/faq-general.html#faq-4
>>
>>  So unless you either a) install an updated xerces via the endorsed
>>  mechanism OR b) explicitly pass the SAX/DOMFactory properties, _it won't
>>  work_. It only _seems_ to work with xerces 2.6.2 since that version is more or
>>  less the same as what's in the JDK; under the hood "the wrong thing" still
>>  happens, sort of.
>>
>>  hth
>>  Holger
>>
>>
>>
>>  ---------------------------------------------------------------------
>>  To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>>  For additional commands, e-mail: j-users-help@xerces.apache.org
>>
>>
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
> For additional commands, e-mail: j-users-help@xerces.apache.org
> 
> 
> 
> 

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


Re: Updating jars

Posted by Elizabeth Clause <el...@gmail.com>.
Holger,
  I just got around to trying your solution, and it seems to me that
you think I'm using java 1.3. I'm not - I'm using Java 6:
$ java -version
java version "1.6.0_03"
Java(TM) SE Runtime Environment (build 1.6.0_03-b05)
Java HotSpot(TM) Client VM (build 1.6.0_03-b05, mixed mode, sharing)

Did I misunderstand you?
    ~Elizabeth


On Wed, Apr 9, 2008 at 8:58 AM, Holger Hoffstaette <ho...@wizards.de> wrote:
> On Tue, 08 Apr 2008 14:58:06 -0400, Elizabeth Clause wrote:
>
>  > I just updated my Xerces jar, and this code, which worked
>  > xercesImpl-2.6.2.jar, broke when I updated to xercesImpl-2.8.1.jar. I also
>  > tried updating to xercesImpl-2.9.0.jar, and got the same error. Here is
>  > the stack trace:
>  > Caught: java.lang.IncompatibleClassChangeError: Class
>  > org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy does not
>  > implement the requested interface org.xml.sax.Attributes
>  >         at NewSaxParserText.run(NewSaxParserText.groovy:6) at
>  >         NewSaxParserText.main(NewSaxParserText.groovy)
>
>  What happens here is most likely not what you think happens, and it is
>  also not _directly_ the fault of the updated jars. Look here:
>  http://xerces.apache.org/xerces2-j/faq-general.html#faq-4
>
>  So unless you either a) install an updated xerces via the endorsed
>  mechanism OR b) explicitly pass the SAX/DOMFactory properties, _it won't
>  work_. It only _seems_ to work with xerces 2.6.2 since that version is more or
>  less the same as what's in the JDK; under the hood "the wrong thing" still
>  happens, sort of.
>
>  hth
>  Holger
>
>
>
>  ---------------------------------------------------------------------
>  To unsubscribe, e-mail: j-users-unsubscribe@xerces.apache.org
>  For additional commands, e-mail: j-users-help@xerces.apache.org
>
>

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


Re: Updating jars

Posted by Holger Hoffstaette <ho...@wizards.de>.
On Tue, 08 Apr 2008 14:58:06 -0400, Elizabeth Clause wrote:

> I just updated my Xerces jar, and this code, which worked
> xercesImpl-2.6.2.jar, broke when I updated to xercesImpl-2.8.1.jar. I also
> tried updating to xercesImpl-2.9.0.jar, and got the same error. Here is
> the stack trace:
> Caught: java.lang.IncompatibleClassChangeError: Class
> org.apache.xerces.parsers.AbstractSAXParser$AttributesProxy does not
> implement the requested interface org.xml.sax.Attributes
>         at NewSaxParserText.run(NewSaxParserText.groovy:6) at
>         NewSaxParserText.main(NewSaxParserText.groovy)

What happens here is most likely not what you think happens, and it is
also not _directly_ the fault of the updated jars. Look here:
http://xerces.apache.org/xerces2-j/faq-general.html#faq-4

So unless you either a) install an updated xerces via the endorsed
mechanism OR b) explicitly pass the SAX/DOMFactory properties, _it won't
work_. It only _seems_ to work with xerces 2.6.2 since that version is more or
less the same as what's in the JDK; under the hood "the wrong thing" still
happens, sort of.

hth
Holger



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