• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Liutauras Vilda
  • Paul Clapham
Sheriffs:
  • paul wheaton
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Piet Souris
Bartenders:
  • Mike London

Problem With cactus testing

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I am using following code to test our LoginAction (Struts Frame work)


public void testSuccessfulLogin() {

setConfigFile("edrs", "/WEB-INF/struts-config.xml");
setRequestPathInfo("/edrs", "/loginAction.do");

String pathInfo = "/loginAction";
logger.debug(
"Entering+servletunit.struts.CactusStrutsTestCase.setRequestPathInfo() : pathInfo = "
+ pathInfo);
logger.debug("START --Setting Request Parameters");
addRequestParameter("username", "xyz");
addRequestParameter("password", "xyz");
addRequestParameter("action","logon");
logger.debug("END --Setting Request Parameters");
actionPerform();
logger.debug("AfterAction Perform --Setting Request Parameters");
verifyForward("success");
verifyForwardPath("/WEB-INF/jsp/welcome.jsp");
LoginForm loginForm=(LoginForm)getActionForm();
logger.debug("USerName :::::"+loginForm.getUsername());
logger.debug("Compare user id");
verifyNoActionErrors();
}

It's giving me the following error


null

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:389)
at weblogic.servlet.internal.WebAppServletContext.setAttribute(WebAppServletContext.java:669)
at org.apache.cactus.server.AbstractServletContextWrapper.dispatch115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:129)
at org.apache.cactus.server.AbstractServletContextWrapper.around115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.AbstractServletContextWrapper.setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:127)
at org.apache.cactus.server.AbstractServletContextWrapper.dispatch115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:129)
at org.apache.cactus.server.AbstractServletContextWrapper.around115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1151)
at org.apache.cactus.server.AbstractServletContextWrapper.setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:127)
at servletunit.struts.CactusStrutsTestCase.tearDown(CactusStrutsTestCase.java:129)
at org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:156)
at org.apache.cactus.server.AbstractWebTestController.dispatch133_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:130)
at org.apache.cactus.server.AbstractWebTestController.around133_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:101)
at org.apache.cactus.server.ServletTestRedirector.dispatch160_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:125)
at org.apache.cactus.server.ServletTestRedirector.around160_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:109)
at org.apache.cactus.server.ServletTestRedirector.dispatch159_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:96)
at org.apache.cactus.server.ServletTestRedirector.around159_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)


Am I missing any thing. I am new to cactus. I want to test out struts action class such as forward path, actionForm, ActionMapping.

Can any one help me. I am missing something.
 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm getting the same problem, could you tell me what you have done to fix it.

Originally posted by N Naga:
Hi

I am using following code to test our LoginAction (Struts Frame work)


public void testSuccessfulLogin() {

setConfigFile("edrs", "/WEB-INF/struts-config.xml");
setRequestPathInfo("/edrs", "/loginAction.do");

String pathInfo = "/loginAction";
logger.debug(
"Entering+servletunit.struts.CactusStrutsTestCase.setRequestPathInfo() : pathInfo = "
+ pathInfo);
logger.debug("START --Setting Request Parameters");
addRequestParameter("username", "xyz");
addRequestParameter("password", "xyz");
addRequestParameter("action","logon");
logger.debug("END --Setting Request Parameters");
actionPerform();
logger.debug("AfterAction Perform --Setting Request Parameters");
verifyForward("success");
verifyForwardPath("/WEB-INF/jsp/welcome.jsp");
LoginForm loginForm=(LoginForm)getActionForm();
logger.debug("USerName :::::"+loginForm.getUsername());
logger.debug("Compare user id");
verifyNoActionErrors();
}

It's giving me the following error


null

java.lang.NullPointerException
at java.util.Hashtable.put(Hashtable.java:389)
at weblogic.servlet.internal.WebAppServletContext.setAttribute(WebAppServletContext.java:669)
at org.apache.cactus.server.AbstractServletContextWrapper.dispatch115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:129)
at org.apache.cactus.server.AbstractServletContextWrapper.around115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.AbstractServletContextWrapper.setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:127)
at org.apache.cactus.server.AbstractServletContextWrapper.dispatch115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:129)
at org.apache.cactus.server.AbstractServletContextWrapper.around115_setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1151)
at org.apache.cactus.server.AbstractServletContextWrapper.setAttribute(AbstractServletContextWrapper.java;org/apache/cactus/util/log/LogAspect.aj[1k]:127)
at servletunit.struts.CactusStrutsTestCase.tearDown(CactusStrutsTestCase.java:129)
at org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:156)
at org.apache.cactus.server.AbstractWebTestController.dispatch133_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:130)
at org.apache.cactus.server.AbstractWebTestController.around133_handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.aj[1k]:101)
at org.apache.cactus.server.ServletTestRedirector.dispatch160_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:125)
at org.apache.cactus.server.ServletTestRedirector.around160_doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:109)
at org.apache.cactus.server.ServletTestRedirector.dispatch159_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:96)
at org.apache.cactus.server.ServletTestRedirector.around159_doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:1158)
at org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.java;org/apache/cactus/util/log/LogAspect.aj[1k]:92)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
at weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(ServletStubImpl.java:971)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:402)
at weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java:305)
at weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(WebAppServletContext.java:6350)
at weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubject.java:317)
at weblogic.security.service.SecurityManager.runAs(SecurityManager.java:118)
at weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletContext.java:3635)
at weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java:2585)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:197)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:170)


Am I missing any thing. I am new to cactus. I want to test out struts action class such as forward path, actionForm, ActionMapping.

Can any one help me. I am missing something.

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I have te same problem pleaze tell me how can i ovrcome with this.
 
reply
    Bookmark Topic Watch Topic
  • New Topic