Tiles and Cactus

2002-03-25 Thread Holman, Cal

I am trying to test my site using Cactus and HTTPUnit and am having
problems.  The site works fine when Tomcat is started and a human navigates
the site.  In other words the /test/do/home/home resolves and the template
definition for tiles is rendered.  But under Cactus I get 500 errors for any
request I make.  The action is being triggered for the mapping and seems to
fail in forwarding to 'success' which is a template definition.  The action
mapping is below as is the template definition.  The Cactus and HTTPUnit
tests worked prior to migrating to Struts 1.1 b1 and Tiles and have not been
modified.  I was using Struts 1.0 and Components when the tests worked.   I
am using Tomcat 4.0.3 standalone on Win2k.

Any advice would be welcome.  Thanks


2002-03-25 07:07:23 StandardHost[localhost]: Mapping request URI
'/test/do/home/home'
2002-03-25 07:07:23 StandardHost[localhost]:  Mapped to context '/test'
2002-03-25 07:07:23 StandardWrapperValve[action]: Servlet.service() for
servlet action threw exception
java.lang.NullPointerException
at
org.apache.struts.action.RequestProcessor.getServletContext(RequestProcessor
.java:1030)
at
org.apache.struts.tiles.TilesRequestProcessor.doForward(TilesRequestProcesso
r.java:114)
at
org.apache.struts.action.RequestProcessor.processActionForward(RequestProces
sor.java:408)
at
org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:269)
at
org.apache.struts.action.ActionServlet.process(ActionServlet.java:1109)
at
com.holmansite.controller.MyActionServlet.process(MyActionServlet.java:65)
at
org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:452)
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.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:2343)
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:
1012)
at
org.apache.catalina.connector.http.HttpProcessor.run(HttpProcessor.java:1107
)
at java.lang.Thread.run(Thread.java:484)


Action Mapping

action path=/home/home
 type=com.holmansite.controller.WelcomeAction
scope=request
validate=false
input=/pages/home/homePage.jsp
forward name=success path=home.pagedef/
/action

Template definition

  definition name=home.pagedef path=/template.jsp
  put name=title  value=Holman Family Home Page /
  

RE: Tiles and Cactus

2002-03-25 Thread Holman, Cal

Cedric I started Tomcat and then the tests same results - when done I
could no longer navigate the site manually - same error Cactus is
generating.  I restarted could get in and navigate, no problem, ran the
tests and broke it.  I think I have isolated the issue - I ran HTTPTest
cases first and they worked!! 

I am using an extension to Cactus called StrutsTest and it is documented for
Struts 1.0.  That could be my issue.  I will write a test using only cactus
and see it I get the same result.  The StrutsTest could be depending on
something or changing something based on Struts 1.0 specs.
http://strutstestcase.sourceforge.net/

Thanks for your time. 

Cal

-Original Message-
From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]]
Sent: Monday, March 25, 2002 11:41
To: Holman, Cal
Subject: Re: Tiles and Cactus


  I continue this discution off the mailing list to avoid disturbing others
people.

  Can you / have you try to :

  1. start web server and web application without starting cactus
  2. access manually some ot your pages
  3. then start cactus

  Unfortunately, I don't know much about Cactus. But the message indicate
that
the servlet attribute is not set.
  Tiles is actually initialized after plugins. I will provide a plugin to
initialize it. If you want, you can do it yourself very easily  : just
implement
a plugin calling the tiles initialization method (
DefinitionsUtil.createDefinitionsFactory(getServletContext(),
servlet.getServletConfig());  ).

  What is strange is that your trace indicate that TilesRequestProcessor is
initialized. But this initialization use the servlet attribute. After that,
a
request can't find it !


Holman, Cal wrote:

 Cedric  These are the messages from the startup of Tomcat initializing
the
 application.  I initialize Log4J and some init parameters in my init
routine
 and then the validator plug in is being initialized.  The tests are
 submitted after successful launch of Tomcat - I am using Ant 1.4 and a
 Cactus task to initiate.  Looks like Tiles is initiated after plugins.
But
 all the init stuff is over prior to the Cactus request.

 From Tomcat log:

 2002-03-25 07:06:48 StandardWrapper[/test:default]: Loading container
 servlet default
 2002-03-25 07:06:48 default: init
 2002-03-25 07:06:48 action: init
 2002-03-25 07:06:52 action: Tiles definition factory loaded
 2002-03-25 07:06:52 StandardWrapper[/test:invoker]: Loading container
 servlet invoker

 2002-03-25 07:07:02 ServletRedirector: init
 2002-03-25 07:07:02 ServletRedirector: init
 2002-03-25 07:07:03 ServletRedirector: Tiles definition factory loaded for
 processor
 2002-03-25 07:07:03 StandardHost[localhost]: Mapping request URI
 '/test/ServletRedirector/'
 2002-03-25 07:07:03 StandardHost[localhost]:  Mapped to context '/test'

 Ant Console:

  [java] log4j: Adding appender named [XMLFile] to category [root].
  [java] 2002-03-25 07:06:49,639 INFO  [main]
controller.MyActionServlet
 (MyActionServlet.java:120) - Log initialized
  [java] 2002-03-25 07:06:49,669 INFO  [main]
controller.MyActionServlet
 (MyActionServlet.java:149) - WhatsNew initialized
 C:\tomcat\webapps\test\WEB-INF\WhatsNewItems.xml
  [java] 2002-03-25 07:06:49,679 INFO  [main]
controller.MyActionServlet
 (MyActionServlet.java:167) - XML initialized
 C:\tomcat\webapps\test\WEB-INF\log4j_output.xml
  [java] 2002-03-25 07:06:50,880 INFO  [main] impl.Log4JCategoryLog
 (Log4JCategoryLog.java:148) - Loading validation rules file from
 '/WEB-INF/validator-rules.xml'

 Cal

 -Original Message-
 From: Cedric Dumoulin [mailto:[EMAIL PROTECTED]]
 Sent: Monday, March 25, 2002 10:29
 To: Struts Users Mailing List
 Subject: Re: Tiles and Cactus

   Checking the errors trace, it appear that struts.action.RequestProcessor
 has no
 or has loose its reference to the servlet.

   This reference is initialized by a call to init(...) which is done when
 servlet
 is initialized. Maybe cactus calls Struts before its complete
initialization
 ?

 Cedric

   This can be due to

 Holman, Cal wrote:

  I am trying to test my site using Cactus and HTTPUnit and am having
  problems.  The site works fine when Tomcat is started and a human
 navigates
  the site.  In other words the /test/do/home/home resolves and the
template
  definition for tiles is rendered.  But under Cactus I get 500 errors for
 any
  request I make.  The action is being triggered for the mapping and seems
 to
  fail in forwarding to 'success' which is a template definition.  The
 action
  mapping is below as is the template definition.  The Cactus and HTTPUnit
  tests worked prior to migrating to Struts 1.1 b1 and Tiles and have not
 been
  modified.  I was using Struts 1.0 and Components when the tests worked.
 I
  am using Tomcat 4.0.3 standalone on Win2k.
 
  Any advice would be welcome.  Thanks
 
  2002-03-25 07:07:23 StandardHost[localhost]: Mapping request URI
  '/test/do/home/home'
  2002-03-25 07:07:23 StandardHost[localhost]:  Mapped to context '/test