You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Michael Della Bitta <md...@columbia.edu> on 2003/12/02 20:18:38 UTC

configuring velocity + velocityServlet: feeling stupid

Hello,

This is not my first rollout of a Velocity-based application, which  
makes me feel more stupid, because I'm having trouble getting Velocity  
initialized with this application. I'm running Velocity 1.3.1 and  
Tomcat 4.1.24 on Solaris. hitting my first servlet for the application  
responds with the following stack trace:

VelocityServlet : Error processing the template
java.lang.NullPointerException
java.lang.NullPointerException
         at  
org.apache.catalina.connector.ResponseBase.setContentType(ResponseBase.j 
ava:875)
         at  
org.apache.catalina.connector.HttpResponseBase.setContentType(HttpRespon 
seBase.java:852)
         at  
org.apache.catalina.connector.ResponseFacade.setContentType(ResponseFaca 
de.java:197)
         at  
org.apache.velocity.servlet.VelocityServlet.setContentType(VelocityServl 
et.java:489)
         at  
org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.ja 
va:366)
         at  
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java: 
333)
         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(Applica 
tionFilterChain.java:247)
         at  
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt 
erChain.java:193)
         at  
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv 
e.java:256)
         at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:644)
         at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
481)
         at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
         at  
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv 
e.java:187)
         at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:644)
         at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
481)
         at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
         at  
org.apache.catalina.core.StandardContext.invoke(StandardContext.java: 
2398)
         at  
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java 
:181)
         at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:644)
         at  
org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa 
lve.java:167)
         at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:642)
         at  
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java 
:165)
         at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:642)
         at  
org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java: 
510)
         at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:642)
         at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
481)
         at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
         at  
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve. 
java:175)
         at  
org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i 
nvokeNext(StandardPipeline.java:644)
         at  
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java: 
481)
         at  
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
         at  
org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:466)
         at  
org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:585)
         at java.lang.Thread.run(Thread.java:534)


As my servlet's name is never mentioned, it seems as if the problem is  
either with my configuration file or with my runtime environment.  
Anybody have any pointers?

Michael Della Bitta
Columbia University


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


Re: configuring velocity + velocityServlet: feeling stupid

Posted by Michael Della Bitta <md...@columbia.edu>.
On Dec 2, 2003, at 4:17 PM, Nathan Bubna wrote:

> Will Glass-Husain said:
>> The NPE is being generated from Tomcat due to a null value for the 
>> content
>> type.  That's a bit strange, the default content type should have 
>> been set
>> when the servlet was init.
>
> yeah, that's a trip.  did you override the init(ServletConfig) method 
> in your
> subclass?  if so, you need to be sure to call super.init(ServletConfig)
>

Hot dog, we have a wiener! :) That was it, thanks a lot!

Michael

p.s. This obviously does not absolve me from being stupid. :)


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


Re: configuring velocity + velocityServlet: feeling stupid

Posted by Nathan Bubna <na...@esha.com>.
Will Glass-Husain said:
> The NPE is being generated from Tomcat due to a null value for the content
> type.  That's a bit strange, the default content type should have been set
> when the servlet was init.

yeah, that's a trip.  did you override the init(ServletConfig) method in your
subclass?  if so, you need to be sure to call super.init(ServletConfig)

> (see
>
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java?rev=1.26&content-type=text/vnd.viewcvs-markup )
>
> It's also a little odd that your servlet isn't in the stack trace.

as long as he doesn't override doGet(), doRequest(), or setContentType(), then
this is to be expected.

> Does
> your web.xml file map to the servlet you wrote?  (Maybe you could post your
> web.xml to the list).  What's the URL you use to call the servlet?

i'm more curious about what methods you override/implement in your subclass.
something is screwy with the init.  and it might not hurt to see pertinent
sections of your velocity.properties.

also, FYI, VelocityServlet is deprecated in forthcoming versions of Velocity
in favor of the VelocityViewServlet from the VelocityTools project. :)

...
> > VelocityServlet : Error processing the template
> > java.lang.NullPointerException
> > java.lang.NullPointerException
> >          at
> > org.apache.catalina.connector.ResponseBase.setContentType(ResponseBase.j
> > ava:875)
...
> > org.apache.velocity.servlet.VelocityServlet.setContentType(VelocityServl
> > et.java:489)
> >          at
> > org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.ja
> > va:366)
> >          at
> > org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:
> > 333)
...

Nathan Bubna
nathan@esha.com


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


Re: configuring velocity + velocityServlet: feeling stupid

Posted by Will Glass-Husain <wg...@forio.com>.
Hi,

The NPE is being generated from Tomcat due to a null value for the content
type.  That's a bit strange, the default content type should have been set
when the servlet was init.

(see
http://cvs.apache.org/viewcvs.cgi/jakarta-tomcat-4.0/catalina/src/share/org/apache/catalina/connector/ResponseBase.java?rev=1.26&content-type=text/vnd.viewcvs-markup )

It's also a little odd that your servlet isn't in the stack trace.  Does
your web.xml file map to the servlet you wrote?  (Maybe you could post your
web.xml to the list).  What's the URL you use to call the servlet?

WILL

----- Original Message ----- 
From: "Michael Della Bitta" <md...@columbia.edu>
To: "'Velocity Users List'" <ve...@jakarta.apache.org>
Sent: Tuesday, December 02, 2003 11:18 AM
Subject: configuring velocity + velocityServlet: feeling stupid


> Hello,
>
> This is not my first rollout of a Velocity-based application, which
> makes me feel more stupid, because I'm having trouble getting Velocity
> initialized with this application. I'm running Velocity 1.3.1 and
> Tomcat 4.1.24 on Solaris. hitting my first servlet for the application
> responds with the following stack trace:
>
> VelocityServlet : Error processing the template
> java.lang.NullPointerException
> java.lang.NullPointerException
>          at
> org.apache.catalina.connector.ResponseBase.setContentType(ResponseBase.j
> ava:875)
>          at
> org.apache.catalina.connector.HttpResponseBase.setContentType(HttpRespon
> seBase.java:852)
>          at
> org.apache.catalina.connector.ResponseFacade.setContentType(ResponseFaca
> de.java:197)
>          at
> org.apache.velocity.servlet.VelocityServlet.setContentType(VelocityServl
> et.java:489)
>          at
> org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.ja
> va:366)
>          at
> org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:
> 333)
>          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(Applica
> tionFilterChain.java:247)
>          at
> org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilt
> erChain.java:193)
>          at
> org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValv
> e.java:256)
>          at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:644)
>          at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> 481)
>          at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
>          at
> org.apache.catalina.core.StandardContextValve.invoke(StandardContextValv
> e.java:187)
>          at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:644)
>          at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> 481)
>          at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
>          at
> org.apache.catalina.core.StandardContext.invoke(StandardContext.java:
> 2398)
>          at
> org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java
> :181)
>          at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:644)
>          at
> org.apache.catalina.valves.ErrorDispatcherValve.invoke(ErrorDispatcherVa
> lve.java:167)
>          at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:642)
>          at
> org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java
> :165)
>          at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:642)
>          at
> org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:
> 510)
>          at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:642)
>          at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> 481)
>          at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
>          at
> org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.
> java:175)
>          at
> org.apache.catalina.core.StandardPipeline$StandardPipelineValveContext.i
> nvokeNext(StandardPipeline.java:644)
>          at
> org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:
> 481)
>          at
> org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:996)
>          at
> org.apache.ajp.tomcat4.Ajp13Processor.process(Ajp13Processor.java:466)
>          at
> org.apache.ajp.tomcat4.Ajp13Processor.run(Ajp13Processor.java:585)
>          at java.lang.Thread.run(Thread.java:534)
>
>
> As my servlet's name is never mentioned, it seems as if the problem is
> either with my configuration file or with my runtime environment.
> Anybody have any pointers?
>
> Michael Della Bitta
> Columbia University
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-user-help@jakarta.apache.org
>


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