Complete stack trace displayed in web page. Web.xml follows after thant
VelocityViewServlet : Error processing the template
Invocation of method 'setForward' in class
org.apache.velocity.tools.struts.StrutsLinkTool threw exception class
java.lang.NullPointerException :
nullorg.apache.velocity.exception.MethodInvocationException: Invocation
of method 'setForward' in class
org.apache.velocity.tools.struts.StrutsLinkTool threw exception class
java.lang.NullPointerException : null
at
org.apache.velocity.runtime.parser.node.ASTMethod.execute(ASTMethod.java
:309)
at
org.apache.velocity.runtime.parser.node.ASTReference.execute(ASTReferenc
e.java:207)
at
org.apache.velocity.runtime.parser.node.ASTReference.render(ASTReference
.java:250)
at
org.apache.velocity.runtime.parser.node.SimpleNode.render(SimpleNode.jav
a:271)
at org.apache.velocity.Template.merge(Template.java:296)
at
org.apache.velocity.tools.view.servlet.VelocityViewServlet.mergeTemplate
(VelocityViewServlet.java:630)
at
org.apache.velocity.tools.view.servlet.VelocityViewServlet.doRequest(Vel
ocityViewServlet.java:455)
at
org.apache.velocity.tools.view.servlet.VelocityViewServlet.doGet(Velocit
yViewServlet.java:411)
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(Applica
tionFilterChain.java:284)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
erChain.java:204)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
e.java:256)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardCon
textValve.java:245)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
e.java:199)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
:195)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
:164)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:149)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
64)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
java:156)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveCo
ntext.java:151)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:5
64)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:972)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:211)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:80
5)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processC
onnection(Http11Protocol.java:696)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:60
5)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool
.java:677)
at java.lang.Thread.run(Thread.java:534)
Web.xml:
<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>
<display-name>Struts Blank Application</display-name>
<!-- Standard Action Servlet Configuration (with debugging) -->
<servlet>
<servlet-name>action</servlet-name>
<servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
<init-param>
<param-name>config</param-name>
<param-value>/WEB-INF/struts-config.xml</param-value>
</init-param>
<init-param>
<param-name>debug</param-name>
<param-value>2</param-value>
</init-param>
<init-param>
<param-name>detail</param-name>
<param-value>2</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<!-- Define Velocity template compiler -->
<servlet>
<servlet-name>velocity</servlet-name>
<servlet-class>
org.apache.velocity.tools.view.servlet.VelocityViewServlet
</servlet-class>
<init-param>
<param-name>org.apache.velocity.toolbox</param-name>
<param-value>/WEB-INF/toolbox.xml</param-value>
</init-param>
<init-param>
<param-name>org.apache.velocity.properties</param-name>
<param-value>/WEB-INF/velocity.properties</param-value>
</init-param>
<load-on-startup>10</load-on-startup>
</servlet>
<!-- Map *.vm files to Velocity -->
<servlet-mapping>
<servlet-name>velocity</servlet-name>
<url-pattern>*.vm</url-pattern>
</servlet-mapping>
<!-- Standard Action Servlet Mapping -->
<servlet-mapping>
<servlet-name>action</servlet-name>
<url-pattern>*.do</url-pattern>
</servlet-mapping>
<!-- The Usual Welcome File List -->
<welcome-file-list>
<welcome-file>templates/welcome.vm</welcome-file>
<!--
<welcome-file>index.jsp</welcome-file>
-->
</welcome-file-list>
</web-app>
> -----Original Message-----
> From: Nathan Bubna [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 10, 2003 12:02 PM
> To: Velocity Users List; [EMAIL PROTECTED]
> Subject: Re: Problem using Velocity strut tools as the welcome file
>
> Rich Garabedian said:
> > I'm writing some rudimentary tests to get Velocity up-and-running
with
> > Jakarta struts. I have a very small logon example. It works
perfectly
> > with jsp's. It works perfectly with velocity as well UNLESS I change
the
> > welcome page
> ...
> > To this:
> > <welcome-file-list>
> > <welcome-file>welcome.vm</welcome-file>
> > </welcome-file-list>
>
> but it works when a velocity template isn't the welcome file? hmm.
>
> ...
> > Error I get is this:
> >
> > Invocation of method 'setForward' in class
> > org.apache.velocity.tools.struts.StrutsLinkTool threw exception
class
> > java.lang.NullPointerException : null
> > org.apache.velocity.exception.MethodInvocationException: Invocation
of
> > method 'setForward' in class
> > org.apache.velocity.tools.struts.StrutsLinkTool threw exception
class
> > java.lang.NullPointerException : null
>
> well, this means that the template is being processed by the
> VelocityViewServlet and the tools are being put in the context. of
> course,
> the error message for invocation exceptions still sucks in 1.1-beta1.
> this
> has been improved since then to give the stack trace for MIE's. so
using
> a
> nightly build might give you/us more information.
>
> > I've included my stuts config file at the bottom of this email as
well.
> >
> > Can anyone tell me if this is expected behavior?
>
> no. a quick glance through the code makes me think that the problem
is
> that
> Struts' ActionServlet is not initialized at the point that
setForward() is
> called. there's not many things under setForward() that could throw
an
> NPE.
> it pretty much looks like either the ServletRequest, ServletContext,
or
> ModuleConfig is null. my money's on the module config. hard to be
sure
> without a stack trace though.
>
> > I'm using:
> >
> > struts 1.1
> > velocity-tools-1.1-beta1
> > jakarta-tomcat-5.0.16
> >
>
> can we see what your web.xml looks like? also, if only to try and
figure
> this
> out, you might try having a your welcome file point to a dummy struts
> action
> that just redirects to welcome.vm.
>
> Nathan Bubna
> [EMAIL PROTECTED]
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]