You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Duffiana Jones <cd...@polydeme.fr> on 2001/07/03 15:58:53 UTC

LinkageError (using Digetser objects)

Hi,

I'm facing troubles while attempting to execute classes using Digester
objects outside the struts framework : the error is
"java.lang.LinkageError: Class org/xml/sax/HandlerBase violates loader
constraints", and occurs when I attempt something like
"digester.parse(uri);" 

I've tried all following configurations :

* For all configurations
- Linux RH7.0 (+patch for the glibc)
-Tomcat (when used) 3.2
-Junit: 3.7
-Struts: 1.0


* Configurations 1
- jaxp1.0.1 / jaxp1.1
- xerces 1.2.3 / 1.3.0 / 1.4.1

* Configurations 2
- jaxp1.0.1 / jaxp1.1
- parser.jar (with jaxp1.0.1 distrib) or crimson.jar (with jaxp1.1
distrib)

* Configuration 3
the one that confuses me the most : I can run the Struts example
application using the libraries from the tomcat lib directory ... but I
can't run my application using the exact tomcat classpath (+ my own
classes)

* Configuration 4
I even recompiled the struts framework and then tried to run my app
using the exact same libs that were used at compile time (IMHO that
shoud have removed any LinkageError, as far as I understand this
message), and always get the same error.

* notice : I've tried with both final SUN releases of jdk1.2 and jdk1.3 

Given this, questions are :
- may the code itself (miscreated Digester object or other reasons I
can't figure out) causes the LinkageError, or can I be sure that's a
libraries related problem ?
- has anyone already used Digester objects outside the struts framework
(my need for doing this is to allow unit test with JUnit test runner,
but I can see many other reasons that may lead one to use the Digester
facilities outside struts), and if so, with which parsers and JAXP API
releases ?

I've checked the struts archives at covalent.net and
www.mail-archive.com (the pointers given at the jakarta resource page),
but didn't find anything related to this.

BTW I've seen in this list lot of posts about libs release number
troubles : for jaxp, xerces, and xalan, and even for ant for them who
want to compile the stuff themselves. IMHO, a summary about the faced
issues and the consistently working releases set would be of great
usage, and may even delete unusefull noise (as the one I'm making) from
the list. The struts documentation, is very nice about features and
architecture, appears somewhat vague about the prerequisites.

thanx for any idea.

duf.

Re: LinkageError (using Digetser objects)

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Hello Duffiana,

XML parsers can be the bane of our existence at times ...

The most important principles I have applied to be able to use Digester
separate from Struts include:

- Digester (in Struts 1.0) requires a JAXP/1.0 or later parser.  I've
  used it successfully with JAXP/1.0.1 and JAXP/1.1 (the latter is
  recommended) and Xerces 1.3.1.

- Make sure you have one and only one parser in your classpath.  If you
  have both JAXP and Xerces, for example, there will be two occurrences
  of classes like org.xml.sax.HandlerBase -- and you will definitely have
  problems if you load the HandlerBase class from JAXP while you are
  using Xerces (or vice versa).

- While checking your classpath, also look in $JAVA_HOME/jre/lib/ext
  and make sure that there are no parser JAR files there either.

Craig McClanahan


On Tue, 3 Jul 2001, Duffiana Jones wrote:

> Hi,
> 
> I'm facing troubles while attempting to execute classes using Digester
> objects outside the struts framework : the error is
> "java.lang.LinkageError: Class org/xml/sax/HandlerBase violates loader
> constraints", and occurs when I attempt something like
> "digester.parse(uri);" 
> 
> I've tried all following configurations :
> 
> * For all configurations
> - Linux RH7.0 (+patch for the glibc)
> -Tomcat (when used) 3.2
> -Junit: 3.7
> -Struts: 1.0
> 
> 
> * Configurations 1
> - jaxp1.0.1 / jaxp1.1
> - xerces 1.2.3 / 1.3.0 / 1.4.1
> 
> * Configurations 2
> - jaxp1.0.1 / jaxp1.1
> - parser.jar (with jaxp1.0.1 distrib) or crimson.jar (with jaxp1.1
> distrib)
> 
> * Configuration 3
> the one that confuses me the most : I can run the Struts example
> application using the libraries from the tomcat lib directory ... but I
> can't run my application using the exact tomcat classpath (+ my own
> classes)
> 
> * Configuration 4
> I even recompiled the struts framework and then tried to run my app
> using the exact same libs that were used at compile time (IMHO that
> shoud have removed any LinkageError, as far as I understand this
> message), and always get the same error.
> 
> * notice : I've tried with both final SUN releases of jdk1.2 and jdk1.3 
> 
> Given this, questions are :
> - may the code itself (miscreated Digester object or other reasons I
> can't figure out) causes the LinkageError, or can I be sure that's a
> libraries related problem ?
> - has anyone already used Digester objects outside the struts framework
> (my need for doing this is to allow unit test with JUnit test runner,
> but I can see many other reasons that may lead one to use the Digester
> facilities outside struts), and if so, with which parsers and JAXP API
> releases ?
> 
> I've checked the struts archives at covalent.net and
> www.mail-archive.com (the pointers given at the jakarta resource page),
> but didn't find anything related to this.
> 
> BTW I've seen in this list lot of posts about libs release number
> troubles : for jaxp, xerces, and xalan, and even for ant for them who
> want to compile the stuff themselves. IMHO, a summary about the faced
> issues and the consistently working releases set would be of great
> usage, and may even delete unusefull noise (as the one I'm making) from
> the list. The struts documentation, is very nice about features and
> architecture, appears somewhat vague about the prerequisites.
> 
> thanx for any idea.
> 
> duf.
>