velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Will Glass-Husain" <wgl...@forio.com>
Subject Re: Velocity.init() problem
Date Sun, 04 Jan 2004 21:56:34 GMT
Have you done a logging or System.out.println on the value returned by
getServletContext().getRealPath("templates/")) to make sure it is the same
under both systems?

I browsed Bugzilla briefly and there were a few bugs in getRealPath in early
versions of Tomcat 4.0.x.  None seemed to apply directly to your situation,
but I advise checking to see if the path is generated correctly.

WILL


----- Original Message ----- 
From: "Algirdas M." <snk@splius.lt>
To: <velocity-user@jakarta.apache.org>
Sent: Sunday, January 04, 2004 2:43 PM
Subject: Velocity.init() problem


> Hello,
>
> I have j2se 1.3 and tomcat 4.0.3 on the server.
> I'm executing this code:
>
>         Velocity.setProperty(Velocity.FILE_RESOURCE_LOADER_PATH,
>                 getServletContext().getRealPath("templates/"));
>
>         Velocity.setProperty(Velocity.RUNTIME_LOG,
>                 getServletContext().getRealPath("velocity.log"));
>
>         try {
>             Velocity.init();
>         } catch (Exception e) {
>             e.printStackTrace(System.out);
>         }
>
> ..and I'm getting this exception:
>
> java.lang.NullPointerException
>         at java.io.Reader.<init>(Reader.java:64)
>         at java.io.InputStreamReader.<init>(InputStreamReader.java:89)
>         at java.io.InputStreamReader.<init>(InputStreamReader.java:61)
>         at org.apache.commons.collections.ExtendedProperties.load(Unknown
Source)
>         at org.apache.commons.collections.ExtendedProperties.load(Unknown
Source)
>         at
org.apache.velocity.runtime.RuntimeInstance.setDefaultProperties(RuntimeInst
ance.java:298)
>         at
org.apache.velocity.runtime.RuntimeInstance.initializeProperties(RuntimeInst
ance.java:423)
>         at
org.apache.velocity.runtime.RuntimeInstance.init(RuntimeInstance.java:266)
>         at
org.apache.velocity.runtime.RuntimeSingleton.init(RuntimeSingleton.java:169)
>         at org.apache.velocity.app.Velocity.init(Velocity.java:123)
>         at xxx.objects.View.initGetMethod(View.java:133)
>         at xxx.objects.View.doGet(View.java:66)
>         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.access$0(ApplicationFilterCh
ain.java:197)
>         at
org.apache.catalina.core.ApplicationFilterChain$1.run(ApplicationFilterChain
.java:176)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterCh
ain.java:172)
>         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.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:1122
)
>         at java.lang.Thread.run(Thread.java:484)
>
>
>
>   On my local computer I have j2sdk 1.4.2_03 and Tomcat 4.1.29 and the
>   same code works fine - without exception.
>
>   Where is the problem?
>
>
>   Thank you.
>
> -- 
> Best regards,
>  Algirdas                          mailto:snk@splius.lt
>
>
> ---------------------------------------------------------------------
> 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


Mime
View raw message