aspose file tools*
The moose likes XML and Related Technologies and the fly likes where is org/w3c/dom/ElementTraversal Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » XML and Related Technologies
Bookmark "where is org/w3c/dom/ElementTraversal" Watch "where is org/w3c/dom/ElementTraversal" New topic
Author

where is org/w3c/dom/ElementTraversal

Jon Bricker
Greenhorn

Joined: Feb 28, 2003
Posts: 23
I'm creating a XML document in a servlet. This is a maven2 project using IntelliJ.

I'm starting the document like this:



When it gets to the createDocument method I get the following error:



I found reference that I needed xml.apis.jar in the project. i added it via maven pom



I did this and still got the error. I added xml.apis.jar to my endorsed folder. Still got the error. I've opened up the xml.apis.jar and could not find the interface ElementTraversal.


Does anyone know where I can find the ElementTraversal and an implementation of it?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

Google seems to have an idea about that; I used the name of the class as my Google search and the first link was this page: http://www.jarfinder.com/index.php/java/info/org.w3c.dom.ElementTraversal.

Other links on the first page seem to imply that Batik is involved. I find it odd that a servlet container would require Batik jars for basic XML processing, but then you seem to have a bunch of other software (Maven and IntelliJ for example) muddying the waters.
Jon Bricker
Greenhorn

Joined: Feb 28, 2003
Posts: 23
Paul Clapham wrote:Google seems to have an idea about that; I used the name of the class as my Google search and the first link was this page: http://www.jarfinder.com/index.php/java/info/org.w3c.dom.ElementTraversal.

Other links on the first page seem to imply that Batik is involved. I find it odd that a servlet container would require Batik jars for basic XML processing, but then you seem to have a bunch of other software (Maven and IntelliJ for example) muddying the waters.


I tried that. It has the Interface in the jar but I still get the same error.

I looked at xerces-2_11 and it's xml-apis.jar has the class in it. I forced it into my repository but I get the same error. I'm wondering if I need to force the xerces back a version so it does not reference the class.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

If you already have a jar containing the class, and you still get the class-not-found error, then you've got classloader confusion. That might mean that there's a jar in the common area of the servlet container which needs ElementTraversal, but you put the jar containing ElementTraversal into one of the web applications. Classloaders for the common area of the servlet container can't load classes from any of the web applications.

There's still the question of why there's such a jar in the common area; but maybe the problem is something else. You'll want to look at the stack trace to see what is looking for ElementTraversal. Is that class in a jar in your web app, or in a common jar somewhere? Start from there anyway.

(I would also advise looking at the servlet container. Everything you've said so far is about Maven and your IDE, presupposing that we understand completely how they generate your web application. Well, I don't understand that and perhaps you don't either. My point is that you need to look at the failing component to diagnose the failure, rather than looking at the tools used to generate the failing component.)

And if it were me I wouldn't include Xerces in my application at all. The code you posted works with the standard Java API and doesn't require additional XML packages; providing the additional XML packages in your web app may be the source of the classloader confusion.
Jon Bricker
Greenhorn

Joined: Feb 28, 2003
Posts: 23
It is either something in IntelliJ or something in my classpath. I made a new project with just the Document creating logic. There are no other jars other than my Java 1.6 directory. It fails with the same error.
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18127
    
    8

Also, I wouldn't use IntelliJ to run servlets. I would use a copy of whatever you plan to use to run the servlets in real life. Tomcat, or something like that. There's little point in testing in an environment which differs radically from your target environment.
Jon Bricker
Greenhorn

Joined: Feb 28, 2003
Posts: 23
Turns out that my IDE was pointed to a JDK that was not my JAVA_HOME. I pointed it to the right one and it worked.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: where is org/w3c/dom/ElementTraversal
 
Similar Threads
java.util.MissingResourceException: Can't find bundle for base name in JSF Spring Maven project
Finding Maven JBoss and JEE dependencies
JSF2 + SeamFaces
Spring Major version '3' expected
Richfaces + Spring + Maven Setup help