You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@xalan.apache.org by Lisa Plato <lp...@prodigy.net> on 2001/03/26 22:36:44 UTC

XPathAPI.selectSingleNode() -- NoSuchMethodError

I'm trying to use an XPathAPI object inside an EJB session bean (running in the JBoss container) to select a single child node of the document root.  On calling xpathAPI.selectSingleNode(root, "child-name"), I get a stack trace in the EJB container that says a java.lang.NoSuchMethodError was encountered at
org.apache.xpath.patterns.NodeTest.execute(NodeTest.java:403).  The immediately preceeding calls in the stack trace are:
xpath.axes.PredicatedNodeTest.acceptNode(PredicatedNodeTest.java:388)
xpath.axes.ChildTestIterator.nextNode(ChildTestIterator.java:193)
xpath.XPathAPI.selectSingleNode(XPathAPI.java:123)
xpath.XPathAPI.selectSingleNode(XPathAPI.java:100)

The NodeTest.java line 403 is the following:
if ((Node.TEXT_NODE == nodeType || Node.CDATA_SECTION_NODE == nodeType) && !context.isSupported(SUPPORTS_PRE_STRIPPING, null)) {
So I assume it is the isSupported() call that is causing the problem.
I am using the most up-to-date released versions of Xalan.jar and Xerces.jar (downloaded last night).  Both are in the classpath as well as the jboss/lib/ext directory (I tried both the regular Xerces.jar and the Xalan-provided jar file in this directory with the same results).

My code is:
Node root = (Element)doc.getDocumentElement();
Node node = null;
try {
    XPathAPI xp = new XPathAPI();
    node = xp.selectSingleNode(root, "name");
}
catch (TransformerException e) {
    e.printStackTrace();
}

Where the XML is:
<employee id="1">
    <name>Jones</name>
...
</employee>

I've used the same code fragment in another program (using Xalan-J 1) and it worked fine.

Any help would be greatly appreciated

John Plato

All of the rest of the Xerces calls work OK in my code, and I haven't tried any other Xalan stuff in JBoss yet.

Re: XPathAPI.selectSingleNode() -- NoSuchMethodError

Posted by Gary L Peskin <ga...@firstech.com>.
Lisa Plato wrote:
> 
> Gary,
> /usr/java/jdk1.3/jre/lib/ext is empty.
> 
> John

John --

Hmmm.  Let's try this.  We need to find out where your DOM classes are
coming from.  Before the call to EnvironmentCheck, try this:

  System.err.println("Loader for DOM:  " +
org.w3c.dom.Document.class.getClassLoader());

That will at least tell us where to look for some extra DOM classes.  I
suspect that this has something to do with JServ but I'm not very
familiar with it.  I just want to verify whose loader is actually
loading your DOM class.

Gary

Re: XPathAPI.selectSingleNode() -- NoSuchMethodError

Posted by Lisa Plato <lp...@prodigy.net>.
Gary,
/usr/java/jdk1.3/jre/lib/ext is empty.

John
----- Original Message -----
From: "Gary L Peskin" <ga...@firstech.com>
To: <xa...@xml.apache.org>
Sent: Tuesday, March 27, 2001 10:39 AM
Subject: Re: XPathAPI.selectSingleNode() -- NoSuchMethodError


> Lisa Plato wrote:
> >
> > Here's what I got:
> >
> > #---- BEGIN writeEnvironmentReport ($Revision: 1.2 $): Useful properties
> > found: ----
> > java.version = 1.3.0
> > version.JAXP=1.1
> > java.ext.dirs=/usr/java/jdk1.3/jre/lib/ext
> > version.crimson=not-present
> > java.class.path=run.jar
> > version.xerces=Xerces 1.3.1
> >
sun.boot.class.path=/usr/java/jdk1.3/jre/lib/rt.jar:/usr/java/jdk1.3/jre/lib
> > /i18n.jar:
> > /usr/java/jdk1.3/jre/lib/sunrsasign.jar:/usr/java/jdk1.3/jre/classes
> > version.xalan=Xalan;Java;2.0.1;
> > version.xalan1=not-present
> > ERROR.version.DOM=ERROR attempting to load DOM level 2 class:
> > java.lang.NoSuchMethodException
> > #----- END writeEnvironmentReport: Useful properties found: -----
> > # WARNING: Potential problems found in your environment!
> > #    Check any 'ERROR' items
> > ...etc... faq.html
> >
> > There is no xerces.jar file in any /lib/ext directory on the classpath.
The
> > classpath is:
> > /usr/java/xerces-1_3_1/xerces.jar:/usr/java/xalan-j_2_0_1/bin/xalan.jar:
> >
/usr/java/jdk1.3:/usr/java/j2sdkee1.3/lib/j2ee.jar:/usr/lib/apache/ApacheJSe
> > rv.jar:
> > /var/www/classes/servlet-2.0.jar
> >
> > The DOM level 2 error is confusing.  Isn't this part of Xerces 1.3.1?
>
> Yes.  This is the source of the problem.  We need to find the cause.  Do
> you have any files in /usr/java/jdk1.3/jre/lib/ext?  These come ahead of
> any of the files in your classpath.  If you have any files there, please
> let us know what they are.
>
> Shane --
>
> It might be good for the EnvironmentChecker to report all of the files
> in the directories pointed to by java.ext.dirs.
>
> Gary
>
> Gary


Re: XPathAPI.selectSingleNode() -- NoSuchMethodError

Posted by Gary L Peskin <ga...@firstech.com>.
Lisa Plato wrote:
> 
> Here's what I got:
> 
> #---- BEGIN writeEnvironmentReport ($Revision: 1.2 $): Useful properties
> found: ----
> java.version = 1.3.0
> version.JAXP=1.1
> java.ext.dirs=/usr/java/jdk1.3/jre/lib/ext
> version.crimson=not-present
> java.class.path=run.jar
> version.xerces=Xerces 1.3.1
> sun.boot.class.path=/usr/java/jdk1.3/jre/lib/rt.jar:/usr/java/jdk1.3/jre/lib
> /i18n.jar:
> /usr/java/jdk1.3/jre/lib/sunrsasign.jar:/usr/java/jdk1.3/jre/classes
> version.xalan=Xalan;Java;2.0.1;
> version.xalan1=not-present
> ERROR.version.DOM=ERROR attempting to load DOM level 2 class:
> java.lang.NoSuchMethodException
> #----- END writeEnvironmentReport: Useful properties found: -----
> # WARNING: Potential problems found in your environment!
> #    Check any 'ERROR' items
> ...etc... faq.html
> 
> There is no xerces.jar file in any /lib/ext directory on the classpath.  The
> classpath is:
> /usr/java/xerces-1_3_1/xerces.jar:/usr/java/xalan-j_2_0_1/bin/xalan.jar:
> /usr/java/jdk1.3:/usr/java/j2sdkee1.3/lib/j2ee.jar:/usr/lib/apache/ApacheJSe
> rv.jar:
> /var/www/classes/servlet-2.0.jar
> 
> The DOM level 2 error is confusing.  Isn't this part of Xerces 1.3.1?

Yes.  This is the source of the problem.  We need to find the cause.  Do
you have any files in /usr/java/jdk1.3/jre/lib/ext?  These come ahead of
any of the files in your classpath.  If you have any files there, please
let us know what they are.

Shane --

It might be good for the EnvironmentChecker to report all of the files
in the directories pointed to by java.ext.dirs.

Gary

Gary

Re: XPathAPI.selectSingleNode() -- NoSuchMethodError

Posted by Lisa Plato <lp...@prodigy.net>.
Here's what I got:

#---- BEGIN writeEnvironmentReport ($Revision: 1.2 $): Useful properties
found: ----
java.version = 1.3.0
version.JAXP=1.1
java.ext.dirs=/usr/java/jdk1.3/jre/lib/ext
version.crimson=not-present
java.class.path=run.jar
version.xerces=Xerces 1.3.1
sun.boot.class.path=/usr/java/jdk1.3/jre/lib/rt.jar:/usr/java/jdk1.3/jre/lib
/i18n.jar:
/usr/java/jdk1.3/jre/lib/sunrsasign.jar:/usr/java/jdk1.3/jre/classes
version.xalan=Xalan;Java;2.0.1;
version.xalan1=not-present
ERROR.version.DOM=ERROR attempting to load DOM level 2 class:
java.lang.NoSuchMethodException
#----- END writeEnvironmentReport: Useful properties found: -----
# WARNING: Potential problems found in your environment!
#    Check any 'ERROR' items
...etc... faq.html

There is no xerces.jar file in any /lib/ext directory on the classpath.  The
classpath is:
/usr/java/xerces-1_3_1/xerces.jar:/usr/java/xalan-j_2_0_1/bin/xalan.jar:
/usr/java/jdk1.3:/usr/java/j2sdkee1.3/lib/j2ee.jar:/usr/lib/apache/ApacheJSe
rv.jar:
/var/www/classes/servlet-2.0.jar

The DOM level 2 error is confusing.  Isn't this part of Xerces 1.3.1?

John
----- Original Message -----
From: "Gary L Peskin" <ga...@firstech.com>
To: <xa...@xml.apache.org>
Sent: Tuesday, March 27, 2001 7:21 AM
Subject: Re: XPathAPI.selectSingleNode() -- NoSuchMethodError


> Lisa Plato wrote:
> >
> > Thanks, Gary.  Where can I find that environmentChecker class?  I
searched
> > my hard drive and the only two xerces.jar files I found were the Xalan
and
> > Xerces ones I just downloaded.  I moved them to the front of the
classpath,
> > and I still had the problem.  Maybe Shane's checker will help.
> >
> > John
>
> John --
>
> It's new and hasn't been included in a release yet.  You can get the
> source from CVS at
>
http://xml.apache.org/websrc/cvsweb.cgi/~checkout~/xml-xalan/java/src/org/ap
ache/xalan/xslt/EnvironmentCheck.java?rev=1.2
>
> This URL should all be on one line.
>
> Since you're running inside an EJB, you should use the "usage-from
> program" method indicated in the javadoc comments at the beginning of
> the program.  Just before your program calls
> XPathAPI.selectSingleNode(), insert
>
> boolean environmentOK = (new
> EnvironmentCheck()).checkEnvironment(yourPrintWriter);
>
> We'd be greatful if you could report your findings back here.  Also, if
> you have any suggestions for improving the checker, I'm sure Shane and
> the rest of us would be delighted for you to participate by sharing
> those suggestions with us.
>
> If you run into problems, post them here and we'll try to help.
>
> Gary


Re: XPathAPI.selectSingleNode() -- NoSuchMethodError

Posted by Gary L Peskin <ga...@firstech.com>.
Lisa Plato wrote:
> 
> Thanks, Gary.  Where can I find that environmentChecker class?  I searched
> my hard drive and the only two xerces.jar files I found were the Xalan and
> Xerces ones I just downloaded.  I moved them to the front of the classpath,
> and I still had the problem.  Maybe Shane's checker will help.
> 
> John

John --

It's new and hasn't been included in a release yet.  You can get the
source from CVS at
http://xml.apache.org/websrc/cvsweb.cgi/~checkout~/xml-xalan/java/src/org/apache/xalan/xslt/EnvironmentCheck.java?rev=1.2

This URL should all be on one line.

Since you're running inside an EJB, you should use the "usage-from
program" method indicated in the javadoc comments at the beginning of
the program.  Just before your program calls
XPathAPI.selectSingleNode(), insert

boolean environmentOK = (new
EnvironmentCheck()).checkEnvironment(yourPrintWriter);

We'd be greatful if you could report your findings back here.  Also, if
you have any suggestions for improving the checker, I'm sure Shane and
the rest of us would be delighted for you to participate by sharing
those suggestions with us.

If you run into problems, post them here and we'll try to help.

Gary

Re: XPathAPI.selectSingleNode() -- NoSuchMethodError

Posted by Lisa Plato <lp...@prodigy.net>.
Thanks, Gary.  Where can I find that environmentChecker class?  I searched
my hard drive and the only two xerces.jar files I found were the Xalan and
Xerces ones I just downloaded.  I moved them to the front of the classpath,
and I still had the problem.  Maybe Shane's checker will help.

John
----- Original Message -----
From: "Gary L Peskin" <ga...@firstech.com>
To: <xa...@xml.apache.org>
Sent: Monday, March 26, 2001 11:31 PM
Subject: Re: XPathAPI.selectSingleNode() -- NoSuchMethodError


> > Lisa Plato wrote:
> >
> > I'm trying to use an XPathAPI object inside an EJB session bean
> > (running in the JBoss container) to select a single child node of the
> > document root.  On calling xpathAPI.selectSingleNode(root,
> > "child-name"), I get a stack trace in the EJB container that says a
> > java.lang.NoSuchMethodError was encountered at
> > org.apache.xpath.patterns.NodeTest.execute(NodeTest.java:403).  The
> > immediately preceeding calls in the stack trace are:
> > xpath.axes.PredicatedNodeTest.acceptNode(PredicatedNodeTest.java:388)
> > xpath.axes.ChildTestIterator.nextNode(ChildTestIterator.java:193)
> > xpath.XPathAPI.selectSingleNode(XPathAPI.java:123)
> > xpath.XPathAPI.selectSingleNode(XPathAPI.java:100)
> >
> > The NodeTest.java line 403 is the following:
> > if ((Node.TEXT_NODE == nodeType || Node.CDATA_SECTION_NODE ==
> > nodeType) && !context.isSupported(SUPPORTS_PRE_STRIPPING, null)) {
> > So I assume it is the isSupported() call that is causing the problem.
> > I am using the most up-to-date released versions of Xalan.jar and
> > Xerces.jar (downloaded last night).  Both are in the classpath as well
> > as the jboss/lib/ext directory (I tried both the regular Xerces.jar
> > and the Xalan-provided jar file in this directory with the same
> > results).
>
> John --
>
> There must be an older version of the DOM classes somewhere in your
> effective classpath ahead of xerces.jar.  It might also be in your
> lib/ext directory.  Perhaps you'd like to try Shane's
> org.apache.xalan.xslt.EnvironmentCheck class to help locate your
> problem.
>
> Gary


Re: XPathAPI.selectSingleNode() -- NoSuchMethodError

Posted by Gary L Peskin <ga...@firstech.com>.
> Lisa Plato wrote:
> 
> I'm trying to use an XPathAPI object inside an EJB session bean
> (running in the JBoss container) to select a single child node of the
> document root.  On calling xpathAPI.selectSingleNode(root,
> "child-name"), I get a stack trace in the EJB container that says a
> java.lang.NoSuchMethodError was encountered at
> org.apache.xpath.patterns.NodeTest.execute(NodeTest.java:403).  The
> immediately preceeding calls in the stack trace are:
> xpath.axes.PredicatedNodeTest.acceptNode(PredicatedNodeTest.java:388)
> xpath.axes.ChildTestIterator.nextNode(ChildTestIterator.java:193)
> xpath.XPathAPI.selectSingleNode(XPathAPI.java:123)
> xpath.XPathAPI.selectSingleNode(XPathAPI.java:100)
> 
> The NodeTest.java line 403 is the following:
> if ((Node.TEXT_NODE == nodeType || Node.CDATA_SECTION_NODE ==
> nodeType) && !context.isSupported(SUPPORTS_PRE_STRIPPING, null)) {
> So I assume it is the isSupported() call that is causing the problem.
> I am using the most up-to-date released versions of Xalan.jar and
> Xerces.jar (downloaded last night).  Both are in the classpath as well
> as the jboss/lib/ext directory (I tried both the regular Xerces.jar
> and the Xalan-provided jar file in this directory with the same
> results).

John --

There must be an older version of the DOM classes somewhere in your
effective classpath ahead of xerces.jar.  It might also be in your
lib/ext directory.  Perhaps you'd like to try Shane's
org.apache.xalan.xslt.EnvironmentCheck class to help locate your
problem.

Gary