You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cactus-user@jakarta.apache.org by MCG QA <mc...@yahoo.com> on 2004/03/29 22:21:54 UTC

What am I missing? Please Help!

I know i'm missing something. Can anybody tell me why 
am I getting this error? Any help is appreciated:

error message="A NullPointerException was thrown. This
may indicate an error in your ActionForm, or it may
indicate that the Struts ActionServlet was unable to
find struts config file. TestCase is running from
C:\Tomcat5.0\bin directory."
type="org.apache.cactus.client.ServletExceptionWrapper">servletunit.struts.ExceptionDuringTestError:
A NullPointerException was thrown. This may indicate
an error in your ActionForm, or it may indicate that
the Struts ActionServlet was unable to find struts
config file.

Exception from the Container Console:

- MessageResourcesFactory.createFactory
java.lang.ClassCastException:
org.apache.struts.util.PropertyMessageResourcesFac
tory
        at
org.apache.struts.util.MessageResourcesFactory.createFactory(MessageR
esourcesFactory.java:193)
        at
org.apache.struts.util.MessageResources.getMessageResources(MessageRe
sources.java:576)
        at
org.apache.struts.util.RequestUtils.<clinit>(RequestUtils.java:134)
        at
org.apache.struts.util.MessageResourcesFactory.createFactory(MessageR
esourcesFactory.java:192)
        at
org.apache.struts.util.MessageResources.getMessageResources(MessageRe
sources.java:576)
        at
org.apache.struts.action.ActionServlet.initInternal(ActionServlet.jav
a:1329)
        at
org.apache.struts.action.ActionServlet.init(ActionServlet.java:464)
        at
javax.servlet.GenericServlet.init(GenericServlet.java:256)
        at
servletunit.struts.CactusStrutsTestCase.getActionServlet(CactusStruts
TestCase.java:451)
        at
servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTes
tCase.java:510)
        at
com.mgh.mhhe.web.action.DoLoginActionTest.testSuccessfulLogin(DoLogin
ActionTest.java:27)
        at
sun.reflect.NativeMethodAccessorImpl.invoke0(Native
Method)
        at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at
java.lang.reflect.Method.invoke(Method.java:324)
        at
junit.framework.TestCase.runTest(TestCase.java:154)
        at
junit.framework.TestCase.runBare(TestCase.java:127)
        at
org.apache.cactus.ServletTestCase.runCactusTest(ServletTestCase.java:
295)
        at
org.apache.cactus.ServletTestCase.runBare(ServletTestCase.java:263)
        at
org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTest
Caller.java:156)
        at
org.apache.cactus.server.AbstractWebTestController.handleRequest_arou
ndBody0(AbstractWebTestController.java:130)
        at
org.apache.cactus.server.AbstractWebTestController.handleRequest_arou
ndBody1$advice(AbstractWebTestController.java:158)
        at
org.apache.cactus.server.AbstractWebTestController.handleRequest(Abst
ractWebTestController.java)
        at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
vletTestRedirector.java:138)
        at
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
ice(ServletTestRedirector.java:158)
        at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
rector.java)
        at
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
letTestRedirector.java:109)
        at
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
ce(ServletTestRedirector.java:158)
        at
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
ector.java)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
        at
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
        at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:284)
        at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:204)
        at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:257)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
        at
org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
ContextValve.java:245)
        at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:199)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
        at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:184)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
        at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:164)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:149)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
        at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:156)
        at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
eContext.java:151)
        at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
a:567)
        at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)

        at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:20
6)
        at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:833)
        at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
ssConnection(Http11Protocol.java:732)
        at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
:619)
        at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:688)
        at java.lang.Thread.run(Thread.java:536)


My Env:
JDK 1.4
Tomcat 5.0
StrutsTestCase 2.1.0

my webapp is mhxhex
the structure is
mhxhex
   |---- jsp
   |---- media
   |---- META-INF
   |---- WEB-INF

WEB-INF contains:
 web.xml
  |--- classes  
  |--- config (Struts-config.xml, tiles-defs.xml,
validation.xml,validator-rules.xml, cactus.properties)
  |--- lib (all JAR files required by the project)
  |--- tlds 

My testcase is
package com.mgh.mhhe.web.action;

import org.apache.cactus.*;
import servletunit.*;
import servletunit.struts.*;
import junit.framework.*;
import junit.extensions.*;
import org.apache.struts.action.*;


public class DoLoginActionTest extends
CactusStrutsTestCase {

    private DoLoginAction DoLogin;

    public DoLoginActionTest(String testName) {
        super(testName);
    }

    public void testSuccessfulLogin() {
       setRequestPathInfo("/submitLoginAction");
      
addRequestParameter("email","srikanthu@mail.com");
       addRequestParameter("password","12345678");
       actionPerform();
       verifyForward("success");
	   verifyForwardPath("site.index");
       verifyNoActionErrors();
    }

    public static void main(String[] args) {
	
junit.textui.TestRunner.run(DoLoginActionTest.class);
    }
}

__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

RE: What am I missing? Please Help!

Posted by MCG QA <mc...@yahoo.com>.
Thanks Vincent,

I appreciate your help.

Thanks
Srikanth

--- Vincent Massol <vm...@pivolis.com> wrote:
> Hi,
> 
> Seen the stacktrace, your problem seems to be
> related to either Struts
> or StrutsTestCase. I personally have never used
> StrutsTestCase. You may
> want to send this email to the StrutsTestCase
> mailing list/forum. There
> may also be some other StrutsTestCase users lurking
> on this list...
> 
> You could also look at line 193 of
> org.apache.struts.util.MessageResourcesFactory.java
> class to see what's
> going on.
>  
> -Vincent
> 
> > -----Original Message-----
> > From: MCG QA [mailto:mcgqa@yahoo.com]
> > Sent: 29 March 2004 22:22
> > To: cactus-user@jakarta.apache.org
> > Subject: What am I missing? Please Help!
> > 
> > I know i'm missing something. Can anybody tell me
> why
> > am I getting this error? Any help is appreciated:
> > 
> > error message="A NullPointerException was thrown.
> This
> > may indicate an error in your ActionForm, or it
> may
> > indicate that the Struts ActionServlet was unable
> to
> > find struts config file. TestCase is running from
> > C:\Tomcat5.0\bin directory."
> >
>
type="org.apache.cactus.client.ServletExceptionWrapper">servletunit.stru
> ts
> > .ExceptionDuringTestError:
> > A NullPointerException was thrown. This may
> indicate
> > an error in your ActionForm, or it may indicate
> that
> > the Struts ActionServlet was unable to find struts
> > config file.
> > 
> > Exception from the Container Console:
> > 
> > - MessageResourcesFactory.createFactory
> > java.lang.ClassCastException:
> > org.apache.struts.util.PropertyMessageResourcesFac
> > tory
> >         at
> >
>
org.apache.struts.util.MessageResourcesFactory.createFactory(MessageR
> > esourcesFactory.java:193)
> >         at
> >
>
org.apache.struts.util.MessageResources.getMessageResources(MessageRe
> > sources.java:576)
> >         at
> >
>
org.apache.struts.util.RequestUtils.<clinit>(RequestUtils.java:134)
> >         at
> >
>
org.apache.struts.util.MessageResourcesFactory.createFactory(MessageR
> > esourcesFactory.java:192)
> >         at
> >
>
org.apache.struts.util.MessageResources.getMessageResources(MessageRe
> > sources.java:576)
> >         at
> >
>
org.apache.struts.action.ActionServlet.initInternal(ActionServlet.jav
> > a:1329)
> >         at
> >
>
org.apache.struts.action.ActionServlet.init(ActionServlet.java:464)
> >         at
> >
>
javax.servlet.GenericServlet.init(GenericServlet.java:256)
> >         at
> >
>
servletunit.struts.CactusStrutsTestCase.getActionServlet(CactusStruts
> > TestCase.java:451)
> >         at
> >
>
servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTes
> > tCase.java:510)
> >         at
> >
>
com.mgh.mhhe.web.action.DoLoginActionTest.testSuccessfulLogin(DoLogin
> > ActionTest.java:27)
> >         at
> >
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> > Method)
> >         at
> >
>
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> > java:39)
> >         at
> >
>
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> > sorImpl.java:25)
> >         at
> > java.lang.reflect.Method.invoke(Method.java:324)
> >         at
> >
> junit.framework.TestCase.runTest(TestCase.java:154)
> >         at
> >
> junit.framework.TestCase.runBare(TestCase.java:127)
> >         at
> >
>
org.apache.cactus.ServletTestCase.runCactusTest(ServletTestCase.java:
> > 295)
> >         at
> >
>
org.apache.cactus.ServletTestCase.runBare(ServletTestCase.java:263)
> >         at
> >
>
org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTest
> > Caller.java:156)
> >         at
> >
>
org.apache.cactus.server.AbstractWebTestController.handleRequest_arou
> > ndBody0(AbstractWebTestController.java:130)
> >         at
> >
>
org.apache.cactus.server.AbstractWebTestController.handleRequest_arou
> > ndBody1$advice(AbstractWebTestController.java:158)
> >         at
> >
>
org.apache.cactus.server.AbstractWebTestController.handleRequest(Abst
> > ractWebTestController.java)
> >         at
> >
>
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
> > vletTestRedirector.java:138)
> >         at
> >
>
org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
> > ice(ServletTestRedirector.java:158)
> >         at
> >
>
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
> > rector.java)
> >         at
> >
>
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
> > letTestRedirector.java:109)
> >         at
> >
>
org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
> > ce(ServletTestRedirector.java:158)
> >         at
> >
>
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
> > ector.java)
> >         at
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
> >         at
> >
>
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
> >         at
> >
>
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> > icationFilterChain.java:284)
> >         at
> >
>
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> > ilterChain.java:204)
> >         at
> >
>
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> > alve.java:257)
> >         at
> >
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
> > eContext.java:151)
> >         at
> >
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> > a:567)
> >         at
> >
>
org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
> > ContextValve.java:245)
> >         at
> >
>
org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> > alve.java:199)
> >         at
> >
>
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
> > eContext.java:151)
> >         at
> >
>
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> 
=== message truncated ===


__________________________________
Do you Yahoo!?
Yahoo! Finance Tax Center - File online. File on time.
http://taxes.yahoo.com/filing.html

RE: What am I missing? Please Help!

Posted by Vincent Massol <vm...@pivolis.com>.
Hi,

Seen the stacktrace, your problem seems to be related to either Struts
or StrutsTestCase. I personally have never used StrutsTestCase. You may
want to send this email to the StrutsTestCase mailing list/forum. There
may also be some other StrutsTestCase users lurking on this list...

You could also look at line 193 of
org.apache.struts.util.MessageResourcesFactory.java class to see what's
going on.
 
-Vincent

> -----Original Message-----
> From: MCG QA [mailto:mcgqa@yahoo.com]
> Sent: 29 March 2004 22:22
> To: cactus-user@jakarta.apache.org
> Subject: What am I missing? Please Help!
> 
> I know i'm missing something. Can anybody tell me why
> am I getting this error? Any help is appreciated:
> 
> error message="A NullPointerException was thrown. This
> may indicate an error in your ActionForm, or it may
> indicate that the Struts ActionServlet was unable to
> find struts config file. TestCase is running from
> C:\Tomcat5.0\bin directory."
>
type="org.apache.cactus.client.ServletExceptionWrapper">servletunit.stru
ts
> .ExceptionDuringTestError:
> A NullPointerException was thrown. This may indicate
> an error in your ActionForm, or it may indicate that
> the Struts ActionServlet was unable to find struts
> config file.
> 
> Exception from the Container Console:
> 
> - MessageResourcesFactory.createFactory
> java.lang.ClassCastException:
> org.apache.struts.util.PropertyMessageResourcesFac
> tory
>         at
> org.apache.struts.util.MessageResourcesFactory.createFactory(MessageR
> esourcesFactory.java:193)
>         at
> org.apache.struts.util.MessageResources.getMessageResources(MessageRe
> sources.java:576)
>         at
> org.apache.struts.util.RequestUtils.<clinit>(RequestUtils.java:134)
>         at
> org.apache.struts.util.MessageResourcesFactory.createFactory(MessageR
> esourcesFactory.java:192)
>         at
> org.apache.struts.util.MessageResources.getMessageResources(MessageRe
> sources.java:576)
>         at
> org.apache.struts.action.ActionServlet.initInternal(ActionServlet.jav
> a:1329)
>         at
> org.apache.struts.action.ActionServlet.init(ActionServlet.java:464)
>         at
> javax.servlet.GenericServlet.init(GenericServlet.java:256)
>         at
> servletunit.struts.CactusStrutsTestCase.getActionServlet(CactusStruts
> TestCase.java:451)
>         at
> servletunit.struts.CactusStrutsTestCase.actionPerform(CactusStrutsTes
> tCase.java:510)
>         at
> com.mgh.mhhe.web.action.DoLoginActionTest.testSuccessfulLogin(DoLogin
> ActionTest.java:27)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke0(Native
> Method)
>         at
> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
> java:39)
>         at
> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
> sorImpl.java:25)
>         at
> java.lang.reflect.Method.invoke(Method.java:324)
>         at
> junit.framework.TestCase.runTest(TestCase.java:154)
>         at
> junit.framework.TestCase.runBare(TestCase.java:127)
>         at
> org.apache.cactus.ServletTestCase.runCactusTest(ServletTestCase.java:
> 295)
>         at
> org.apache.cactus.ServletTestCase.runBare(ServletTestCase.java:263)
>         at
> org.apache.cactus.server.AbstractWebTestCaller.doTest(AbstractWebTest
> Caller.java:156)
>         at
> org.apache.cactus.server.AbstractWebTestController.handleRequest_arou
> ndBody0(AbstractWebTestController.java:130)
>         at
> org.apache.cactus.server.AbstractWebTestController.handleRequest_arou
> ndBody1$advice(AbstractWebTestController.java:158)
>         at
> org.apache.cactus.server.AbstractWebTestController.handleRequest(Abst
> ractWebTestController.java)
>         at
> org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody2(Ser
> vletTestRedirector.java:138)
>         at
> org.apache.cactus.server.ServletTestRedirector.doPost_aroundBody3$adv
> ice(ServletTestRedirector.java:158)
>         at
> org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedi
> rector.java)
>         at
> org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody0(Serv
> letTestRedirector.java:109)
>         at
> org.apache.cactus.server.ServletTestRedirector.doGet_aroundBody1$advi
> ce(ServletTestRedirector.java:158)
>         at
> org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedir
> ector.java)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:743)
>         at
> javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
>         at
> org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
> icationFilterChain.java:284)
>         at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
> ilterChain.java:204)
>         at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
> alve.java:257)
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
> eContext.java:151)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:567)
>         at
> org.apache.catalina.core.StandardContextValve.invokeInternal(Standard
> ContextValve.java:245)
>         at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
> alve.java:199)
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
> eContext.java:151)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:567)
>         at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
> ava:184)
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
> eContext.java:151)
>         at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
> ava:164)
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
> eContext.java:149)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:567)
>         at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
> ve.java:156)
>         at
> org.apache.catalina.core.StandardValveContext.invokeNext(StandardValv
> eContext.java:151)
>         at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.jav
> a:567)
>         at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
> 
>         at
> org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:20
> 6)
>         at
> org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
> :833)
>         at
> org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.proce
> ssConnection(Http11Protocol.java:732)
>         at
> org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java
> :619)
>         at
> org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
> ool.java:688)
>         at java.lang.Thread.run(Thread.java:536)
> 
> 
> My Env:
> JDK 1.4
> Tomcat 5.0
> StrutsTestCase 2.1.0
> 
> my webapp is mhxhex
> the structure is
> mhxhex
>    |---- jsp
>    |---- media
>    |---- META-INF
>    |---- WEB-INF
> 
> WEB-INF contains:
>  web.xml
>   |--- classes
>   |--- config (Struts-config.xml, tiles-defs.xml,
> validation.xml,validator-rules.xml, cactus.properties)
>   |--- lib (all JAR files required by the project)
>   |--- tlds
> 
> My testcase is
> package com.mgh.mhhe.web.action;
> 
> import org.apache.cactus.*;
> import servletunit.*;
> import servletunit.struts.*;
> import junit.framework.*;
> import junit.extensions.*;
> import org.apache.struts.action.*;
> 
> 
> public class DoLoginActionTest extends
> CactusStrutsTestCase {
> 
>     private DoLoginAction DoLogin;
> 
>     public DoLoginActionTest(String testName) {
>         super(testName);
>     }
> 
>     public void testSuccessfulLogin() {
>        setRequestPathInfo("/submitLoginAction");
> 
> addRequestParameter("email","srikanthu@mail.com");
>        addRequestParameter("password","12345678");
>        actionPerform();
>        verifyForward("success");
> 	   verifyForwardPath("site.index");
>        verifyNoActionErrors();
>     }
> 
>     public static void main(String[] args) {
> 
> junit.textui.TestRunner.run(DoLoginActionTest.class);
>     }
> }
> 
> __________________________________
> Do you Yahoo!?
> Yahoo! Finance Tax Center - File online. File on time.
> http://taxes.yahoo.com/filing.html
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org