This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread 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 Murach's Java Servlets and JSP this week in the Servlets 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: 30076
    
149

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: 30076
    
149

That makes sense.

And crossposting is fine. Especially for hard questions like this! We just like to have the link.
 
 
subject: saxon9-dom.jar not found only when running junit
 
Similar Threads
PowerMock Test mechanism error
PowerMockito + Junit + Ant
Juint task in Ant
JUnit 4 error
jmock class loader can not find the interface org.jmock.internal.CaptureControl