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 Struts and the fly likes strutstestcase - NPE in web.xml 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 » Frameworks » Struts
Bookmark "strutstestcase - NPE in web.xml" Watch "strutstestcase - NPE in web.xml" New topic
Author

strutstestcase - NPE in web.xml

wont poonolly
Greenhorn

Joined: Aug 01, 2006
Posts: 2
I'm trying to test my struts actions. I jUnit test all of my DAOs and I'm trying to keep the testing momentum going. When I run this line in my code:

setServletConfigFile("C:/apache/tomcat 5.5.7/webapps/xxx/WEB-INF/web.xml");

I get this error:

junit.framework.AssertionFailedError: Received an exception while loading web.xml - class java.lang.NullPointerException : null
at servletunit.struts.MockStrutsTestCase.setServletConfigFile(MockStrutsTestCase.java:502)
at test.com.ide.acronym.TestAcronymAction.setUp(TestAcronymAction.java:10)
at junit.framework.TestCase.runBare(TestCase.java:128)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:120)
at junit.framework.TestSuite.runTest(TestSuite.java:228)
at junit.framework.TestSuite.run(TestSuite.java:223)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

My web.xml works fine in my tomcat container. The file is there. When I taek the line of code out it says it can't find the web.xml.


I've been all over the forums, google, I've rtFm, and I'm just about out of ideas. Thanks for any help anyone can provide.

Sunil
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: strutstestcase - NPE in web.xml
 
Similar Threads
Mock Runner Error In WebSphre
Junit for JSF controller
NullPointerException when calling webservice in Weblogic 9.2
Junit error
Junit and Ejb - com/ibm/ejs/jts/jts/Current