Hi Charles,

Thanks for your response.

1. We are still at Dynamo 5.1, as per the company policy.  I'm not sure how
things work with 5.6.1, but in 5.1 we are using Dynamo Nucleus and the
CONFIGPATH framework to integrate our applications into the Dynamo
application server.  This is quite proprietary to Dynamo.  This does not
require the use of web.xml files, but has the concept of config files in the
CONFIGPATH (this is similar to the unix PATH variable)  which look like java
properties files which map a servlet to a name.  But I've been able to set
up it such that appropriate Servlets are being invoked.  Also, 5.1 supports
Servlet spec 2.2.  So my feeling is that the basic requirements are being
met.

2. I've gone through the Cactus Configuration guide and semantically mapped
the web.xml to Dynamo proprietary setup.

3. Now coming to the use of the jsp, Dynamo 5.1 has a bug due to which if a
Servlet is directly invoked, any RequestDispatch.forward(.) calls from
within the Servlet cause it to go into an infinite loop.  But if a JSP is
the primary recipient of the request which further hands over the request
processing to the Servlet, that works fine.  Hence the JSP shows up in the
middle.  The JSP code is very simple and is shown below.  This code also
shows how the Nucleus is used to get the servlet and hand over the
processing to the servlet :

<%@ page import="org.apache.cactus.server.ServletTestRedirector" %>

<%!
   public static final String sccsID = "%TC-INFO%";
   final static String servletPath = "/craa/servlet/ServletRedirector" ;
   final static ServletTestRedirector servlet =
(ServletTestRedirector)Nucleus.getGlobalNucleus().resolveName(servletPath);
// --- end of Declarations ---
%>

<% // --- main control begins here ---
   // Request dispatcher's forward method wasn't working if the servlet is
directly called with the current Dynamo version
   // So using the JSP Controller and calling the sevlet's service method
from JSP
   servlet.doGet(request,response);
%>

4. The NullPointerException is occuring in the file
framework/src/java/share/org/apache/cactus/server/AbstractWebTestCaller.java
at line number 196, so either the "writer" or the "result" or both are null.
:

176      public void doGetResults() throws ServletException
177      {
178          // One could think there is a potential risk that the client
side of
179          // Cactus will request the result before it has been written to
the
180          // context scope as the HTTP request will not block in some
containers.
181          // However this will not happend because on the client side,
once the
182          // first request is done to execute the test, all the result is
read
183          // by the AutoReadHttpURLConnection class, thus ensuring that
the
184          // request is fully finished and the resukt has been committed
...
185
186          WebTestResult result =
187              (WebTestResult)
(this.webImplicitObjects.getServletContext().
188              getAttribute(TEST_RESULTS));
189
190          LOGGER.debug("Test Result = [" + result + "]");
191
192          // Write back the results to the outgoing stream as an XML
string.
193          try {
194
195              Writer writer = getResponseWriter();
196              writer.write(result.toXml());
197              writer.close();
198
199          } catch (IOException e) {
200              String message = "Error writing WebTestResult instance to
output "
201                  + "stream";
202              LOGGER.error(message, e);
203              throw new ServletException(message, e);
204          }
205      }

The final option for me would be to add some debug statements to the above
file around line 196 and do a build.  I'm not exactly sure how to do that
but I can't think of anything else now.

Thanks
Shriniwas Wagle


> -----Original Message-----
> From: Charles Massey [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 03, 2002 6:29 PM
> To: 'Cactus Users List'
> Subject: RE: NullPointerException at
> org.apache.cactus.server.AbstractWebT estC
> aller.doGetResults(AbstractWebTestCaller.java:196)
> 
> 
> Hi Shriniwas,
> 
> I'm using Dynamo - so I can probably help you here.  We're still using
> Cactus 1.3, and I haven't tried running Cactus 1.4 on Dynamo yet.
> 
> To start, you mention below that you are not following the 
> web.xml and .war
> format.  Does this mean that you are not declaring your <servlet>
> definitions in the web.xml file?  I have found that using the "Cactus
> Configuration" guide has helped a lot (
> http://jakarta.apache.org/cactus/howto_config.html ).  It is true that
> Dynamo uses .dar files to package files, but you may still 
> need to declare
> the ServletRedirector and/or JspRedirector in your web.xml if 
> you intend to
> use them.
> 
> Looking at the following section in your stack trace, what does
> servlet_redirector.jsp do?  It looks like it is throwing a
> NullPointerException in this code also (or from the servlet) ?
> 
> [/atg/dynamo/server/HttpServer-0:ipaddr=10.136.42.72;path=/en_
> US/servlet_tes
> t_runner.jsp;sessionid=4QWWRQKZKB12UCULHTOCFEQ] INFO  httpclient.wire
> - << "<HEAD><TITLE>500 Internal Server Error</TITLE></HEAD>
> <H1>500 Internal Server Error</H1><BODY>
> The servlet invoked by the requested URL 
> //en_US/servlet_redirector.jsp
> raised the exception:<br><br>java.lang.NullPointerException<P>
> </BODY>
> " 
> 14:50:29,946
> [/atg/dynamo/server/HttpServer-0:ipaddr=10.136.42.72;path=/en_
> US/servlet_tes
> t_runner.jsp;sessionid=4QWWRQKZKB12UCULHTOCFEQ] DEBUG 
> httpclient.HttpMethod
> - HttpMethodBase.execute(): closing connection since we're 
> using HTTP/1.0 
> 14:50:29,947
> 
> 
> To help you further I need more information.  I have been 
> able to integrate
> Cactus 1.3 into Dynamo 5.6.1 by using the ServletRedirector 
> redirector and
> subclassing ServletTestCase for my tests.
> 
> Charley
> 
> 
> 
> -----Original Message-----
> From: Wagle, Shriniwas [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, September 03, 2002 12:36 PM
> To: '[EMAIL PROTECTED]'
> Subject: NullPointerException at
> org.apache.cactus.server.AbstractWebTestC
> aller.doGetResults(AbstractWebTestCaller.java:196)
> 
> 
> I've recently started working with Cactus and after trying to 
> make it work
> over the last couple of days, I'm feeling rather stuck.  So 
> any help would
> be appreciated.  I apologize for the rather long traces.  I 
> hope they are of
> some help.
> 
> Environment :
>       jakarta-cactus-12-1.4
>       Dynamo Application Server 5.1 on SunOS 5.8
>       jdk 1.2
> 

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to