web inf - tomcat - package not found

E

Erwan

Hi, when trying to integrate javax.xml.DocumentBuilderFactory in a jsp
page

I get the following error

/usr/local/jakarta-tomcat-4.1.27/work/Standalone/localhost/extr_admin/admin_jsp.java:20:
package javax.xml does not exist
import javax.xml.DocumentBuilderFactory;;


here is my WEB-INF/lib

activation.jar
commons-beanutils.jar
commons-collections.jar
commons-digester.jar
commons-fileupload.jar
commons-logging.jar
commons-validator.jar
jakarta-oro.jar
mail.jar
mysql.jar
nanoxml-2.2.3.jar
resolver.jar
servlet.jar
SESSIONS.ser
struts.jar
xalan.jar
xerces-2_6_2
xercesImpl.jar
xml-apis.jar
xmlParserAPIs.jar


I deleted everything from the common/endorsed folder with no
success...

any idea why my web app cant find javax.xml.DocumentBuilderFactory in
xml-apis.jar even though jar tf xml-apis.jar shows me it's there ?

thanks evryone
 
J

Juha Laiho

(e-mail address removed) (Erwan) said:
Hi, when trying to integrate javax.xml.DocumentBuilderFactory in a jsp
page

I get the following error

/usr/local/jakarta-tomcat-4.1.27/work/Standalone/localhost/extr_admin/admin_jsp.java:20:
package javax.xml does not exist

Please read the Tomcat classloader HOWTO at
http://jakarta.apache.org/tomcat/tomcat-4.1-doc/class-loader-howto.html
and there especially the chapter about J2SE classes and extensions. You
most probably are also interested about the text in the "XML Parsers and
JDK 1.4" chapter.

Further, if the servlet.jar that you list as being located in your
WEB-INF/lib is what I guess it is, it really shouldn't be there. In
Tomcat, there's one servlet.jar per Tomcat, and it is located in
$CATALINA_HOME/server/lib/. Don't confuse things by making extra copies
of it (you may have a copy in your development environment, against
which you compile your servlet sources, but don't include that copy in
your application).
I deleted everything from the common/endorsed folder with no
success...

No, this won't help -- simply javax.* classes will not be loaded
unless they're in a location designated as an 'endorsed' directory.
 
W

William Brogden

Hi, when trying to integrate javax.xml.DocumentBuilderFactory in a jsp
page

I get the following error

/usr/local/jakarta-tomcat-4.1.27/work/Standalone/localhost/extr_admin/admin_jsp.java:20:
package javax.xml does not exist
import javax.xml.DocumentBuilderFactory;;

The correct package for DocumentBuilderFactory is
javax.xml.parsers

In SDK 1.4 it is part of the normal runtime rt.jar

Bill
 
E

Erwan

thanks guys, worked :

- removed servlet.jar
- removed the import

and following statement now works

javax.xml.parsers.DocumentBuilderFactory df =
javax.xml.parsers.DocumentBuilderFactory.newInstance();
Document doc = df.newDocumentBuilder().parse(xml_file);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,744
Messages
2,569,484
Members
44,904
Latest member
HealthyVisionsCBDPrice

Latest Threads

Top