jakarta-cactus-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Qingxian Wang <qingxian_w...@sunsystems.com>
Subject NullPointerException when verifying forward
Date Tue, 03 Sep 2002 10:19:38 GMT
Hi,

I am using Struts1.1b2 with Cacturs1.4b1.  When I am running a test case,
the NullPointerException is thrown out by
org.apache.cactus.server.AbstractWebTestCaller.doGetResults() method even
though the forwarded page is correct. Do you have any idear of what is wrong
or what I have missed?

Thanks 

Qingxian 

 The code is as the follows:

//----------------------------  code
---------------------------------------------------------------
public class CactusTest_DeployActions extends CactusStrutsTestCase {

    public CactusTest_DeployActions(String testName) {
        super(testName);
    }   
    
    public void setUp() throws Exception {  
        super.setUp(); 
        _deployService = ServiceProvider.getDeploymentService();
    }

    public void tearDown() throws Exception { 
        _deployService = null;
        super.tearDown(); 
    }        
    
    public void testViewActivatedComponents() throws Exception {
        setRequestPathInfo("/viewactivatedcomponents.do");
        addRequestParameter("method", "getActivatedComponents");
        actionPerform();
        
        // verifyForward() method causes NullPointerException eventhough the
request is forward to the correct page.
       if (thereAreActivatedComponents()) {    
            if (log.isDebugEnabled()) {
                log.debug("testViewActivatedComponents: Verifying forward to
" + ActionMappingConstants.SUCCESS_KEY);
            }
            // try to see if any component found        
            verifyForward(ActionMappingConstants.SUCCESS_KEY);
        } else {
            if (log.isDebugEnabled()) {
                log.debug("testViewActivatedComponents: Verifying forward to
" + ActionMappingConstants.SUCCESS_KEY);
            }
            // no component found
 
verifyForward(ActionMappingConstants.NO_COMPONENT_FOUND_FROM_DEPLOYER_KEY);
        }
    }
    
    /**
     * Check if there is any activated components
     */ 
    private boolean thereAreActivatedComponents() throws Exception {
        
        Collection components =
_deployService.selectActivatedComponents(_deployService.getDeployedComponent
s());
        if (components == null || components.size() == 0) {
            return false;    
        }
        
        return true;
    }
    
    private IDeployComponentService _deployService;
    private static final Category log =
Category.getInstance(CactusTest_DeployActions.class);
}

//--------------------------------------------end of code
------------------------------------------------------------------------

The error messages at the client side are as follows:

//--------------------------------------------client side error
messages--------------------------------------------------------------------
----
1)
testViewActivatedComponents(com.systemsunion.framework.tools.web.deployer.ac
tion.CactusTest_DeployActions)
org.apache.cactus.util.ChainedRuntimeException: Failed to get the test
results. This is probably due to an error that happened on the server side
when trying to execute the tests. Here is what was returned by the server :
[




<html lang="en">
<head>  
  
  <title>No Component Found</title>    
  <link rel="stylesheet" href="../stylesheets/deployer_style_ie.css"
type="text/css">  
  <base href="http://localhost:8080/evodeployer/layouts/root_layout.jsp">
</head>

<body>


<!-- ============================================================ -->
<!-- Begin topBanner -->


<!-- ============================================================ -->


<table background='../images/top.gif' 
       width='700' 
       height='75' 
       border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td>
     

<pre><h1>Evolution</h1></pre>
<div align="right"> 
    <pre><a href="http://rdsspr2k/evoweb/" title="Go to the Evolution Web
site">http://evolution.systemsunion.com</a>         </pre>
</div>     
    </td>
  </tr>
</table> 
<!-- ============================================================ -->
<!-- End topBanner -->

<!-- ============================================================ -->
<!-- Begin lowerBanner -->


<!-- ============================================================ -->


<table background='../images/top1.gif' 
       width='700' 
       height='13' 
       border="0" cellspacing="0" cellpadding="0" align="center">
  <tr> 
    <td>
     

<img
src="/evodeployer/images/pixel.gif;jsessionid=ECAE23290901FA222BEF9C6F7F8386
9B" height="1" width="1">      
    </td>
  </tr>
</table> 
<!-- ============================================================ -->
<!-- End lowerBanner -->

<!-- ============================================================ -->
<!-- Begin body content -->
<br>



<br>
<br>
<br>

<CENTER>
<b>No component found from the deployer.  <a href="/evodeployer/secure/main.
jsp;jsessionid=ECAE23290901FA222BEF9C6F7F83869B" title="Back to deploy tool
main page">Back to main page</a>.</b>
</CENTER>
<br>
<br>
<br>
<!-- End body content -->

<!-- ============================================================ -->
<!-- Begin footer -->
<br>



<table width="700" border="0" cellspacing="0" cellpadding="0"
align="center">
  <tr> 
    <td rowspan="2" width="65"> 
      <div align="left">
        <font size="2" face="Arial, Helvetica, sans-serif" color="#3333FF">
            <img
src="/evodeployer/images/logo.gif;jsessionid=ECAE23290901FA222BEF9C6F7F83869
B" height="58" width="60" alt="Systems Union"> 
        </font>
      </div>      
    </td>
    <td width="635">
        <font size="2" face="Arial, Helvetica, sans-serif">
            Copyright 2002 Systems Union Plc. All Rights Reserved 
        </font>
    </td>
  </tr>
  <tr> 
    <td width="635">
        <font size="2" face="Arial, Helvetica, sans-serif">Browse our
            <a href="http://rdsspr2k/evoforums/" title="R&D Evolution
Developers Forums"><font color="#0000FF">: <font color="#006699">R&D
Evolution Developers Forums</font></font></a>
        with questions or comments. <br>
      Websites:<a href="http://rdsspr2k/evoweb/" title="Go to the Evolution
Web site"><font color="#006699">http://evolution.systemsunion.com</font></a>

      <font color="#3333FF"><br>
      </font>
    </td>
  </tr>
</table> 
<!-- End footer -->

</body>
</html>


]
	at
org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(AbstractHttpCli
ent.java;org/apache/cactus/util/log/LogAspect.java(1k):120)
	at
org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHttpClien
t.java;org/apache/cactus/util/log/LogAspect.java(1k):1236)
	at
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java;o
rg/apache/cactus/util/log/LogAspect.java(1k):104)
	at
org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase.jav
a:260)
	at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
	at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195)
org.apache.cactus.client.ParsingException: Not a valid response
	at
org.apache.cactus.client.WebTestResultParser.readRootElement(WebTestResultPa
rser.java;org/apache/cactus/util/log/LogAspect.java(1k):140)
	at
org.apache.cactus.client.WebTestResultParser.dispatch29_parse(WebTestResultP
arser.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
	at
org.apache.cactus.client.WebTestResultParser.around29_parse(WebTestResultPar
ser.java;org/apache/cactus/util/log/LogAspect.java(1k):1236)
	at
org.apache.cactus.client.WebTestResultParser.parse(WebTestResultParser.java;
org/apache/cactus/util/log/LogAspect.java(1k):96)
	at
org.apache.cactus.client.AbstractHttpClient.callGetResult(AbstractHttpClient
.java;org/apache/cactus/util/log/LogAspect.java(1k):230)
	at
org.apache.cactus.client.AbstractHttpClient.dispatch2_doTest(AbstractHttpCli
ent.java;org/apache/cactus/util/log/LogAspect.java(1k):114)
	at
org.apache.cactus.client.AbstractHttpClient.around2_doTest(AbstractHttpClien
t.java;org/apache/cactus/util/log/LogAspect.java(1k):1236)
	at
org.apache.cactus.client.AbstractHttpClient.doTest(AbstractHttpClient.java;o
rg/apache/cactus/util/log/LogAspect.java(1k):104)
	at
org.apache.cactus.AbstractWebTestCase.runGenericTest(AbstractWebTestCase.jav
a:260)
	at
org.apache.cactus.ServletTestCase.runTest(ServletTestCase.java:133)
	at
org.apache.cactus.AbstractTestCase.runBare(AbstractTestCase.java:195)

//--------------------------------------------end client side error
messages--------------------------------------------------------------------
----

The par of the server log and the error messages at the server side are as
follows:

//--------------------------------------------server log and the error
messages --------------------------------------------------------------

        STDOUT|   'deployer.nocomponentfound' - processed as definition
11:17:25|tools.web.deployer.action.CactusTest_DeployActions|
testViewActivatedComponents: Verifying forward to Success
11:17:25|he.cactus.server.AbstractHttpServletRequestWrapper| Using simulated
context : [/evodeployer]
11:17:25|    servletunit.struts.StrutsServletContextWrapper|
<getAttribute([org.apache.struts.action.MAPPINGS])
11:17:25|    org.apache.cactus.server.ServletContextWrapper|
<getAttribute([org.apache.struts.action.MAPPINGS])
11:17:25|    org.apache.cactus.server.ServletContextWrapper| >getAttribute =
[org.apache.struts.action.ActionMappings@c66812]
11:17:25|    servletunit.struts.StrutsServletContextWrapper| >getAttribute =
[org.apache.struts.action.ActionMappings@c66812]
11:17:25|    org.apache.cactus.server.ServletTestRedirector|
<doGet([org.apache.catalina.connector.HttpRequestFacade@6a5d72],
[org.apache.catalina.connector.HttpResponseFacade@1d07e4])
11:17:25|    org.apache.cactus.server.ServletTestRedirector|
<doPost([org.apache.catalina.connector.HttpRequestFacade@6a5d72],
[org.apache.catalina.connector.HttpResponseFacade@1d07e4])
11:17:25|    org.apache.cactus.server.ServletTestRedirector| -------------
Start Servlet service
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
<setHttpServletRequest([org.apache.catalina.connector.HttpRequestFacade@6a5d
72])
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
>setHttpServletRequest
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
<setHttpServletResponse([org.apache.catalina.connector.HttpResponseFacade@1d
07e4])
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
>setHttpServletResponse
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
<setServletContext([org.apache.catalina.core.ApplicationContextFacade@8393ef
])
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
>setServletContext
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
<setServletConfig([org.apache.catalina.core.StandardWrapperFacade@654dec])
11:17:25|   org.apache.cactus.server.ServletImplicitObjects|
>setServletConfig
11:17:25|    org.apache.cactus.server.ServletTestController|
<handleRequest([org.apache.cactus.server.ServletImplicitObjects@ddb605])
11:17:25|              org.apache.cactus.server.ServletUtil|
<getQueryStringParameter([Cactus_Service=GET_RESULTS], [Cactus_Service])
11:17:25|              org.apache.cactus.server.ServletUtil|
>getQueryStringParameter = [GET_RESULTS]
11:17:25|org.apache.cactus.server.AbstractWebTestController| Service to call
= GET_RESULTS
11:17:25|              org.apache.cactus.ServiceEnumeration|
<equals([GET_RESULTS])
11:17:25|              org.apache.cactus.ServiceEnumeration| >equals =
[false]
11:17:25|              org.apache.cactus.ServiceEnumeration|
<equals([GET_RESULTS])
11:17:25|              org.apache.cactus.ServiceEnumeration| >equals =
[true]
11:17:25|    org.apache.cactus.server.AbstractWebTestCaller| Test Result =
[null]
11:17:25|                    org.jboss.web.localhost.Engine|
StandardWrapperValve[ServletRedirector]: Servlet.service() for servlet
ServletRedirector threw exception
java.lang.NullPointerException
	at
org.apache.cactus.server.AbstractWebTestCaller.doGetResults(AbstractWebTestC
aller.java:196)
	at
org.apache.cactus.server.AbstractWebTestController.dispatch87_handleRequest(
AbstractWebTestController.java;org/apache/cactus/util/log/LogAspect.java(1k)
:131)
	at
org.apache.cactus.server.AbstractWebTestController.around87_handleRequest(Ab
stractWebTestController.java;org/apache/cactus/util/log/LogAspect.java(1k):1
149)
	at
org.apache.cactus.server.AbstractWebTestController.handleRequest(AbstractWeb
TestController.java;org/apache/cactus/util/log/LogAspect.java(1k):101)
	at
org.apache.cactus.server.ServletTestRedirector.dispatch113_doPost(ServletTes
tRedirector.java;org/apache/cactus/util/log/LogAspect.java(1k):123)
	at
org.apache.cactus.server.ServletTestRedirector.around113_doPost(ServletTestR
edirector.java;org/apache/cactus/util/log/LogAspect.java(1k):1149)
	at
org.apache.cactus.server.ServletTestRedirector.doPost(ServletTestRedirector.
java;org/apache/cactus/util/log/LogAspect.java(1k):109)
	at
org.apache.cactus.server.ServletTestRedirector.dispatch112_doGet(ServletTest
Redirector.java;org/apache/cactus/util/log/LogAspect.java(1k):96)
	at
org.apache.cactus.server.ServletTestRedirector.around112_doGet(ServletTestRe
director.java;org/apache/cactus/util/log/LogAspect.java(1k):1149)
	at
org.apache.cactus.server.ServletTestRedirector.doGet(ServletTestRedirector.j
ava;org/apache/cactus/util/log/LogAspect.java(1k):92)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:740)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
	at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Application
FilterChain.java:247)
	at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:193)
	at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.ja
va:243)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.ja
va:190)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase
.java:475)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.valves.CertificatesValve.invoke(CertificatesValve.java:2
46)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardContext.invoke(StandardContext.java:2347)
	at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:180
)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherValve.
java:170)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:170
)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:468)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
64)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java
:174)
	at
org.apache.catalina.core.StandardPipeline.invokeNext(StandardPipeline.java:5
66)
	at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:472)
	at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:943)
	at
org.apache.catalina.connector.http.HttpProcessor.process(HttpProcessor.java:
1027)
	at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1125
)
	at java.lang.Thread.run(Thread.java:536)
11:17:25|he.cactus.server.AbstractHttpServletRequestWrapper| Using simulated
context : [/evodeployer]
11:17:25|    org.apache.cactus.server.AbstractWebTestCaller| Test result :
[Test failed, Exception message = [was expecting
'/evodeployerdeployer.nocomponentfound' but received
'/evodeployer/layouts/root_layout.jsp']]
11:17:25|    org.apache.cactus.server.AbstractWebTestCaller| Result saved in
context scope
11:17:25|    org.apache.cactus.server.ServletTestController| >handleRequest
11:17:25|    org.apache.cactus.server.ServletTestRedirector| >doPost
11:17:25|    org.apache.cactus.server.ServletTestRedirector| >doGet

//--------------------------------------------end the server log and the
error messages ------------------------------------------------------

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


Mime
View raw message