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 sach Beeharry <sa...@googlemail.com> on 2008/12/11 13:23:27 UTC

java.lang.NoSuchFieldError: config

Hi,

I am trying to test my action class using cactus. My web application is on
Tomcat and I am running the test from Eclipse.
But I am getting the following error when the test runs:

java.lang.NoSuchFieldError: config
 at
servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java:101)
 at junit.framework.TestCase.runBare(TestCase.java:128)
 at
org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCactusTestCase.java:155)
 at
org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTestCaller.java:120)
 at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody0(AbstractWebTestController.java:94)
 at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_aroundBody1$advice(AbstractWebTestController.java:218)
 at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(AbstractWebTestController.java:1)

I think this error is caused because the *config* field cannot be found in
the setUp() method of the CactusStrutsTestCase class. May be some
compatibility issue.

    protected void setUp()
        throws Exception
    {
        if(logger.isDebugEnabled())
        {
            logger.debug("Entering");
        }
        try
        {
            if(actionServlet == null)
            {
                actionServlet = new ActionServlet();
            }
            ServletContext servletContext = new StrutsServletContextWrapper*
(config*.getServletContext());

also:

*CactusStrutsTestCase  extends ServletTestCase* and ServletTestCase contains
the attribute *public AbstractServletConfigWrapper config
*
>From the above the config  field should normally be accessible, but it is
not the case.

Can anyone help me solving this?

Thanks in advance.

Sach

Re: java.lang.NoSuchFieldError: config

Posted by sach Beeharry <sa...@googlemail.com>.
Thanks Daniel, I added the strutstest-2.1.4-2.4-patched-cactus180.jar to my
classpath and things work fine now.

Regards,
Sach

2008/12/11 Daniel Lipofsky <Da...@bricsnet.com>

> I don't remember what error I had, but I know I
> had to patch StrutsTest 2.1.4 to work with Cactus 1.8.0.
> Try this patch (at bottom of page) and see if it helps:
> http://danlipofsky.com/technical/cactus/
>
> - Dan
>
> > -----Original Message-----
> > From: sach Beeharry [mailto:sachtruth@googlemail.com]
> > Sent: Thursday, December 11, 2008 5:23 AM
> > To: cactus-user@jakarta.apache.org
> > Subject: java.lang.NoSuchFieldError: config
> >
> > Hi,
> >
> > I am trying to test my action class using cactus. My web application
> is
> > on
> > Tomcat and I am running the test from Eclipse.
> > But I am getting the following error when the test runs:
> >
> > java.lang.NoSuchFieldError: config
> >  at
> >
> servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java
> > :101)
> >  at junit.framework.TestCase.runBare(TestCase.java:128)
> >  at
> >
> org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstrac
> > tCactusTestCase.java:155)
> >  at
> >
> org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstract
> > WebTestCaller.java:120)
> >  at
> >
> org.apache.cactus.internal.server.AbstractWebTestController.handleReque
> > st_aroundBody0(AbstractWebTestController.java:94)
> >  at
> >
> org.apache.cactus.internal.server.AbstractWebTestController.handleReque
> > st_aroundBody1$advice(AbstractWebTestController.java:218)
> >  at
> >
> org.apache.cactus.internal.server.AbstractWebTestController.handleReque
> > st(AbstractWebTestController.java:1)
> >
> > I think this error is caused because the *config* field cannot be
> found
> > in
> > the setUp() method of the CactusStrutsTestCase class. May be some
> > compatibility issue.
> >
> >     protected void setUp()
> >         throws Exception
> >     {
> >         if(logger.isDebugEnabled())
> >         {
> >             logger.debug("Entering");
> >         }
> >         try
> >         {
> >             if(actionServlet == null)
> >             {
> >                 actionServlet = new ActionServlet();
> >             }
> >             ServletContext servletContext = new
> > StrutsServletContextWrapper*
> > (config*.getServletContext());
> >
> > also:
> >
> > *CactusStrutsTestCase  extends ServletTestCase* and ServletTestCase
> > contains
> > the attribute *public AbstractServletConfigWrapper config
> > *
> > From the above the config  field should normally be accessible, but it
> > is
> > not the case.
> >
> > Can anyone help me solving this?
> >
> > Thanks in advance.
> >
> > Sach
>
>  ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>
>

RE: java.lang.NoSuchFieldError: config

Posted by Daniel Lipofsky <Da...@bricsnet.com>.
I don't remember what error I had, but I know I
had to patch StrutsTest 2.1.4 to work with Cactus 1.8.0.
Try this patch (at bottom of page) and see if it helps:
http://danlipofsky.com/technical/cactus/

- Dan

> -----Original Message-----
> From: sach Beeharry [mailto:sachtruth@googlemail.com]
> Sent: Thursday, December 11, 2008 5:23 AM
> To: cactus-user@jakarta.apache.org
> Subject: java.lang.NoSuchFieldError: config
> 
> Hi,
> 
> I am trying to test my action class using cactus. My web application
is
> on
> Tomcat and I am running the test from Eclipse.
> But I am getting the following error when the test runs:
> 
> java.lang.NoSuchFieldError: config
>  at
>
servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java
> :101)
>  at junit.framework.TestCase.runBare(TestCase.java:128)
>  at
>
org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(Abstrac
> tCactusTestCase.java:155)
>  at
>
org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(Abstract
> WebTestCaller.java:120)
>  at
>
org.apache.cactus.internal.server.AbstractWebTestController.handleReque
> st_aroundBody0(AbstractWebTestController.java:94)
>  at
>
org.apache.cactus.internal.server.AbstractWebTestController.handleReque
> st_aroundBody1$advice(AbstractWebTestController.java:218)
>  at
>
org.apache.cactus.internal.server.AbstractWebTestController.handleReque
> st(AbstractWebTestController.java:1)
> 
> I think this error is caused because the *config* field cannot be
found
> in
> the setUp() method of the CactusStrutsTestCase class. May be some
> compatibility issue.
> 
>     protected void setUp()
>         throws Exception
>     {
>         if(logger.isDebugEnabled())
>         {
>             logger.debug("Entering");
>         }
>         try
>         {
>             if(actionServlet == null)
>             {
>                 actionServlet = new ActionServlet();
>             }
>             ServletContext servletContext = new
> StrutsServletContextWrapper*
> (config*.getServletContext());
> 
> also:
> 
> *CactusStrutsTestCase  extends ServletTestCase* and ServletTestCase
> contains
> the attribute *public AbstractServletConfigWrapper config
> *
> From the above the config  field should normally be accessible, but it
> is
> not the case.
> 
> Can anyone help me solving this?
> 
> Thanks in advance.
> 
> Sach

---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org


Re: java.lang.NoSuchFieldError: config

Posted by Franz Roth <fr...@gmx.de>.
Hi, yesterday I had the same but with the pageContext-Object;
Well, there was an jar from gwt with some apache-classes inside 
(gwt-dev-windows.jar). Took that away and all worked fine :)
-> check Your classpath.
Greez
Franz

Raúl Villalba schrieb:
> Hi,
>
> I have the exactly error. Please help!!!
>
> -----Mensaje original-----
> De: sach Beeharry [mailto:sachtruth@googlemail.com] 
> Enviado el: jueves, 11 de diciembre de 2008 13:23
> Para: cactus-user@jakarta.apache.org
> Asunto: java.lang.NoSuchFieldError: config
>
> Hi,
>
> I am trying to test my action class using cactus. My web application is on
> Tomcat and I am running the test from Eclipse.
> But I am getting the following error when the test runs:
>
> java.lang.NoSuchFieldError: config
>  at
> servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java:101)
>  at junit.framework.TestCase.runBare(TestCase.java:128)
>  at
> org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCact
> usTestCase.java:155)
>  at
> org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTe
> stCaller.java:120)
>  at
> org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_ar
> oundBody0(AbstractWebTestController.java:94)
>  at
> org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_ar
> oundBody1$advice(AbstractWebTestController.java:218)
>  at
> org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(Ab
> stractWebTestController.java:1)
>
> I think this error is caused because the *config* field cannot be found in
> the setUp() method of the CactusStrutsTestCase class. May be some
> compatibility issue.
>
>     protected void setUp()
>         throws Exception
>     {
>         if(logger.isDebugEnabled())
>         {
>             logger.debug("Entering");
>         }
>         try
>         {
>             if(actionServlet == null)
>             {
>                 actionServlet = new ActionServlet();
>             }
>             ServletContext servletContext = new StrutsServletContextWrapper*
> (config*.getServletContext());
>
> also:
>
> *CactusStrutsTestCase  extends ServletTestCase* and ServletTestCase contains
> the attribute *public AbstractServletConfigWrapper config
> *
> >From the above the config  field should normally be accessible, but it is
> not the case.
>
> Can anyone help me solving this?
>
> Thanks in advance.
>
> Sach
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: cactus-user-help@jakarta.apache.org
>
>   



---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org


RE: java.lang.NoSuchFieldError: config

Posted by Raúl Villalba <ra...@fullsix.com>.
Hi,

I have the exactly error. Please help!!!

-----Mensaje original-----
De: sach Beeharry [mailto:sachtruth@googlemail.com] 
Enviado el: jueves, 11 de diciembre de 2008 13:23
Para: cactus-user@jakarta.apache.org
Asunto: java.lang.NoSuchFieldError: config

Hi,

I am trying to test my action class using cactus. My web application is on
Tomcat and I am running the test from Eclipse.
But I am getting the following error when the test runs:

java.lang.NoSuchFieldError: config
 at
servletunit.struts.CactusStrutsTestCase.setUp(CactusStrutsTestCase.java:101)
 at junit.framework.TestCase.runBare(TestCase.java:128)
 at
org.apache.cactus.internal.AbstractCactusTestCase.runBareServer(AbstractCact
usTestCase.java:155)
 at
org.apache.cactus.internal.server.AbstractWebTestCaller.doTest(AbstractWebTe
stCaller.java:120)
 at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_ar
oundBody0(AbstractWebTestController.java:94)
 at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest_ar
oundBody1$advice(AbstractWebTestController.java:218)
 at
org.apache.cactus.internal.server.AbstractWebTestController.handleRequest(Ab
stractWebTestController.java:1)

I think this error is caused because the *config* field cannot be found in
the setUp() method of the CactusStrutsTestCase class. May be some
compatibility issue.

    protected void setUp()
        throws Exception
    {
        if(logger.isDebugEnabled())
        {
            logger.debug("Entering");
        }
        try
        {
            if(actionServlet == null)
            {
                actionServlet = new ActionServlet();
            }
            ServletContext servletContext = new StrutsServletContextWrapper*
(config*.getServletContext());

also:

*CactusStrutsTestCase  extends ServletTestCase* and ServletTestCase contains
the attribute *public AbstractServletConfigWrapper config
*
>From the above the config  field should normally be accessible, but it is
not the case.

Can anyone help me solving this?

Thanks in advance.

Sach


---------------------------------------------------------------------
To unsubscribe, e-mail: cactus-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: cactus-user-help@jakarta.apache.org