This week's book giveaway is in the OCPJP forum. We're giving away four copies of OCA/OCP Java SE 7 Programmer I & II Study Guide and have Kathy Sierra & Bert Bates on-line! See this thread for details.
First things first: run your server in debug mode, and place a breakpoint at the start of your test case. Step through/into the code until you find the exact line that is throwing an exception. Then we'll talk
Joined: Feb 01, 2003
It's throwing an error at the line where actionPerform() is executed.
A few lines of stack trace from application console are as given below :
[12/20/04 20:10:00:719 IST] cab426 WebGroup I SRVE0180I: [dcomm-ui] [/dcomm-ui] [Servlet.LOG]: ServletRedirector: init [12/20/04 20:10:00:719 IST] cab426 PropertyMessa I org.apache.struts.util.PropertyMessageResources Initializing, config='org.apache.struts.action.ActionResources', returnNull=true [12/20/04 20:10:00:766 IST] cab426 RequestProces W org.apache.struts.action.RequestProcessor Unhandled Exception thrown: class javax.servlet.ServletException
JUNIT ERROR STACK TRACE :
servletunit.struts.ExceptionDuringTestError: An uncaught exception was thrown during actionExecute() at servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTestCase.java:546) at com.sbc.dcomm.ui.cart.pa.actions.PAActionTest.testSession(PAActionTest.java:73) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:79) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:41) at java.lang.reflect.Method.invoke(Method.java:386) at junit.framework.TestCase.runTest(TestCase.java:154) at junit.framework.TestCase.runBare(TestCase.java:127) at org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:153) at org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:119)
If you need any more info ,please feel to write ...
Joined: Jul 01, 2004
It says the exception was thrown during actionExecute() - but it is possible to step into this method to see exactly what line of code caused the exception. If you don't want to step into all these methods, put a breakpoint at the start of your PAAction (I presume this is the action being called by your test case).
If you get to that breakpoint, then you'll be able to step through to the underlying problem. If you never get to that breakpoint, then you know you have a configuration issue with StrutsTestCase.