This week's book giveaways are in the Java EE and JavaScript forums.
We're giving away four copies each of The Java EE 7 Tutorial Volume 1 or Volume 2(winners choice) and jQuery UI in Action and have the authors on-line!
See this thread and this one for details.
The moose likes Testing and the fly likes saxon9-dom.jar not found only when running junit Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Engineering » Testing
Bookmark "saxon9-dom.jar not found only when running junit" Watch "saxon9-dom.jar not found only when running junit" New topic
Author

saxon9-dom.jar not found only when running junit

Juanin Lopez
Greenhorn

Joined: Oct 06, 2011
Posts: 2
Hi,we're trying to run a junit test case for a method which is using saxon9-dom.jar.In eclipse,we just right click on the test class/run as junit (no ant script),and it throws the error "DOMSource cannot be processed: check that saxon9-dom.jar is on the classpath
The method is working when called from the main class on a normal run.The saxon9-dom.jar was/is in the project classpath(checked both,in eclipse and opening the .classpath file) .It has been added again separately under 'libraries'.It's on the 'run configurations/classpath' too.It was even put within the classpath for the 'environment variables' of the PC...nothing works,always the same result/error.

Any help would be really appreciated
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

Juanin,
Welcome to CodeRanch! I've linked to the StackOverflow crosspost so people posting here can see if it has already been answered. (We ask for this so people don't waste time answering a question that's already been answered.)

On to your question. You are using the built in JUnit, right? The following shouldn't happen, but it would explain the behavior you are seeing:

Do you have the JUNIT_HOME variable set by any chance? Either within Eclipse or on the command line. If so, does the lib folder contain a competing jar?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
Juanin Lopez
Greenhorn

Joined: Oct 06, 2011
Posts: 2
Jeanne,

thanks for the reply and the link.Actually I posted that one on stackOverFlow forum,but I wasn't getting any answers so I posted here too.
JUNIT_HOME variable is not set on environment variables.I haven't got a different installation for junit,just using the in built one in the plugins.
Junit4 has been added to the classpath of the project,and all the other junit tests on other classes/methods are working fine.The jar we have
is the "saxon-9.1.0.8.jar"...I can only think of getting exactly the saxon9-dom.jar,just in caseJunit4 only recognizes that one and not the one we've got...
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 30356
    
150

That makes sense.

And crossposting is fine. Especially for hard questions like this! We just like to have the link.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: saxon9-dom.jar not found only when running junit