velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <>
Subject Re: NullPointerException in init() during redeploy
Date Tue, 06 Jul 2010 03:01:33 GMT
Yeah, that certainly sounds like a Jetty classloader/resourcestream
issue.  have you tried contacting the Jetty people?  I really don't
know what could be done to compensate besides the modifications you
made early to hardcode properties.

On Mon, Jul 5, 2010 at 6:36 PM, B. Scott Smith <> wrote:
> OK, I tried deploying my original application in JBoss 3.x with embedded
> Jetty. When I attempted to deploy my upgraded app, I received the same
> Velocity errors. I then tried deploying in JBoss 5.1 with embedded Tomcat.
> When I deployed the upgraded app, I received no errors, and it performed as
> expected.
> So, this would imply that this is an issue with Jetty? Is there something I
> might be able to do in my app to compensate?
>  - Scott
> On 7/1/2010 3:40 PM, B. Scott Smith wrote:
>> I am using Jetty 6.1.24 (latest stable release). I tried a much older
>> version (Jetty 4.2.x) and the problem also occurs.
>> I am running JREv1.6, but it also fails on JREv1.4.2.
>> I will try to setup an environment to deploy it in Tomcat and see, but it
>> may take a while.
>> In doing more tests, I have discovered some additional things.
>> First, I added a line in
>> org.apache.velocity.runtime.RuntimeInstance#setDefaultProperties():
>> log.error("getResourceAsStream() returned null:
>> "+getClass().getResource('/'+DEFAULT_RUNTIME_PROPERTIES));
>> and this shows a valid URL, so it is able to find the resource, but won't
>> provide an inputStream to it. It prints:
>> getResourceAsStream() returned null:
>>  jar:file:<path to my
>> app>/WEB-INF/lib/velocity-dep.jar!/org/apache/velocity/runtime/defaults/
>> Second, if I copy all of the default properties into my own
>> file, and return with no error from
>> setDefaultProperties(), it then blows up in initializeDirectives() with the
>> same problem (inputStream is null). If I modify it to hardcode the 8
>> properties from the file and return, then my
>> application runs fine. So, the ONLY issue is trying to load these properties
>> files from the velocity-dep.jar, no other issues occur.
>> Somehow, my ClassLoader is getting messed up, and I can't figure out how
>> to "reset" it.
>>  - Scott
>> On 7/1/2010 2:07 PM, Antonio Petrelli wrote:
>>> 2010/7/1 B. Scott Smith<>:
>>>> The input stream it is returning is NULL. This only seems to happen when
>>>> I
>>>> re-deploy into my Servlet Container (I am using Jetty). If I then shut
>>>> down
>>>> the entire JVM and restart, the application runs fine.
>>> What version of Jetty are you using? If you deploy it in, say, Tomcat,
>>> does it work?
>>> Antonio
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail:
>>> For additional commands, e-mail:
> ---------------------------------------------------------------------
> To unsubscribe, e-mail:
> For additional commands, e-mail:

To unsubscribe, e-mail:
For additional commands, e-mail:

View raw message