|
Cecil -
According to the the code, you
haven't declared "temp2". If the code compiles, then you've declared it
elsewhere, but not included it here. I would start by seeing what you've
declared "temp2" as, and then see if the class type is
"org.w3c.dom.Document".
Also, exactly which line is
109?
Also, what are these "special"
JARs? Tomcat is a J2EE servlet container, but it does not contain all the
components of the "easy download" J2SDK EE. So, look in the JAR files and see if
the "org.w2c.dom" package is there... it may not be (I forget). If that's the
case, then you are compiling with a classpath that does not match the runtime
classpath. This is common with Tomcat, unless you want to point your compile
classpath to $TOMCAT_HOME/server/lib/ for the JARs. A lot of people use the
J2EE.jar for simplicity, but then must remember to compare the run-time packages
when a problem occurs.
Hope that
helps.
Code:
Document temp=null; if
(result==null) temp=builder.parse(new
InputSource(new StringReader("<result>No
records</result>")));
else temp=builder.parse(new InputSource(new
StringReader(result))); Node
temp3=temp.getDocumentElement(); Node
temp4=temp2.importNode(temp3,true);
root2.appendChild(temp4); return
temp2;
Stack
Trace
java.lang.NoSuchMethodError at
sf_maincontrol.setupXMLSearchEngine(sf_maincontrol.java:109) at
sf_maincontrol.run(sf_maincontrol.java:57) at
sf.searchme(sf.java:68) at sf.doPost(sf.java:16)
...
Sorry,
I don't think I got any responses for this, so I am trying again. I
think I'm just going to give up and write my own version of ImportNode.
SUMMARY
I've got a bit of a problem with
Jakarta Tomcat 3.2.1/3.3.1 I am running a small XML application that takes
the getDocumentElement() of a document class and appends it onto another
class. To do this, I use the importNode() function. When I test it
on my home server, which is a modified version of the JSDK2.1 server (modified
in the sense that I have randomly added .jar files as needed), the application
works. When I test it on Tomcat 3.2.1/3.3.1, it
doesn't.
DETAIL
The code in question is as
follows: Document temp=null; if
(result==null) temp=builder.parse(new
InputSource(new StringReader("<result>No
records</result>")));
else temp=builder.parse(new InputSource(new
StringReader(result))); Node
temp3=temp.getDocumentElement(); Node
temp4=temp2.importNode(temp3,true);
root2.appendChild(temp4); return temp2;
The code
is sloppy, because I've been trying to debug it, so I tried various
permutations of the same code. This was the last state of the
code.
The code bombs on "Node
temp4=temp2.importNode(temp3,true);" it reports the error
message:
java.lang.NoSuchMethodError at
sf_maincontrol.setupXMLSearchEngine(sf_maincontrol.java:109) at
sf_maincontrol.run(sf_maincontrol.java:57) at
sf.searchme(sf.java:68) at sf.doPost(sf.java:16) ...
This is
odd, because as can be seen on the earlier lines, it is running various other
methods of the document class just fine.
Originally, I thought it was
because I was using an old version of Tomcat (3.2.1), so I switched to Tomcat
4.0. Tomcat 4.0 was so completely different (and I couldn't get it to
install), so I switched to 3.3.1, which worked.
All of my own special
jars are in the web-inf/lib directory, etc. etc.
I just can't
understand why it isn't running importNode, but is running all the other
methods of the Document class.
Thank you
Cecil
Chua
|