velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nathan Bubna <nbu...@gmail.com>
Subject Re: Null pointer with parser pool in 1.6.3
Date Mon, 21 Jun 2010 19:27:58 GMT
Ok, that shows that the NPE occurs during RuntimeInstance.evaluate,
which is being called by [View]RenderTool.evaluate.  So, the engine
being used by ViewRenderTool is not fully initialized prior to the
template evaluation.

I know you think 1.6.4 didn't have relevant changes, but this
certainly smells like
https://issues.apache.org/jira/browse/VELOCITY-750  (appears down at
the moment, see
http://velocity.apache.org/engine/devel/changes-report.html or mail
archives for limited or less-convenient info)

I would strongly recommend upgrading to 1.6.4.  If you can confirm
this still happens with 1.6.4 under JDK 1.5+, i will try to find more
time to help debug/fix this.  Right now, lacking confirmation that
this was not fixed in 1.6.4, i need to move onto other things.

On Mon, Jun 21, 2010 at 12:10 PM, Jason Tesser <jasontesser@gmail.com> wrote:
> Here is the stack
>
> http://pastebin.com/UVz7GHkz
>
> Thanks,
> Jason Tesser
> dotCMS Lead Development Manager
> 1-305-858-1422
>
>
> On Mon, Jun 21, 2010 at 2:38 PM, Nathan Bubna <nbubna@gmail.com> wrote:
>
>> It happens during init?  Is there any chance you could show me the
>> relevant stack trace?  That would really help me understand this.
>>
>> On Mon, Jun 21, 2010 at 7:21 AM, Jason Tesser <jasontesser@gmail.com>
>> wrote:
>> > OK so a few clarifications
>> >
>> > 1. We do init in our own init servlet.  this happens before any web
>> request
>> > private synchronized static void init(){
>> >        if(ve != null)
>> >            return;
>> >        ve = new VelocityEngine();
>> >        try{
>> >            ve.init(SystemProperties.getProperties());
>> >            dotResourceLoaderClassName =
>> > SystemProperties.get(SystemProperties.get("resource.loader") +
>> > ".resource.loader.class");
>> >            Logger.info(VelocityUtil.class,
>> > SystemProperties.getProperties().toString());
>> >        }catch (Exception e) {
>> >            Logger.error(VelocityUtil.class,e.getMessage(),e);
>> >        }
>> >    }
>> >
>> > 2. The actual issue is that the init within velocity runtimeservers is
>> > messed up.  The init method is being run because initialize is set to
>> true
>> > in that class. It gets a null pointer.  Basically we catch it and make
>> the
>> > init run again by setting initialized and initializing to false and
>> making
>> > it run again.
>> >
>> > This happens on one server always but our fix makes the server work.  We
>> > were unable to reproduce this in any other environment.
>> >
>> > The environoment is Linux
>> > /opt/java-dotcms/bin/java -version
>> > java version "1.5.0_18"
>> > Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_18-b02)
>> > Java HotSpot(TM) 64-Bit Server VM (build 1.5.0_18-b02, mixed mode)
>> >
>> > We did have another scenario with the issue we reproduced locally but
>> that
>> > one we fixed by extending rendertool and set the engine.
>> >
>> > Thanks,
>> > Jason Tesser
>> > dotCMS Lead Development Manager
>> > 1-305-858-1422
>> >
>> >
>> > On Mon, Jun 21, 2010 at 10:04 AM, Nathan Bubna <nbubna@gmail.com> wrote:
>> >
>> >> Hmm.  All you did was add an additional check of a particular
>> >> subsystem using double-checked locking, and try/catch logging errors.
>> >> Not an ideal fix.  I would love to know a little more about what
>> >> exactly you are doing when you get the NPE.  Can i see the relevant
>> >> portions of the stack trace?
>> >>
>> >> Also, barring a fix on our end, my recommended fix would be to just
>> >> manually call init().  The auto-init feature was only meant as a
>> >> convenience feature and was never really recommended for advanced
>> >> users, particularly in single-threaded situations.  For multi-threaded
>> >> things like webapps, i would always recommend you do your init at app
>> >> startup (servlet/filter init), and not let it wait until runtime.
>> >>
>> >> PS diffs are easier to read when there aren't dozens of useless style
>> >> tweaks included
>> >>
>> >> On Mon, Jun 21, 2010 at 6:50 AM, Jason Tesser <jasontesser@gmail.com>
>> >> wrote:
>> >> > Here is the DIFF
>> >> >
>> >> > http://pastebin.com/jh13sXgt
>> >> >
>> >> > Java 1.5 and 1.6 experienced on Linux server and Local OSX
>> >> >
>> >> > It automatically inits I believe.
>> >> >
>> >> > Thanks,
>> >> > Jason Tesser
>> >> > dotCMS Lead Development Manager
>> >> > 1-305-858-1422
>> >> >
>> >> >
>> >> > On Mon, Jun 21, 2010 at 9:46 AM, Nathan Bubna <nbubna@gmail.com>
>> wrote:
>> >> >
>> >> >> I think the mailing list stripped the diff off.   So, what Java
>> >> >> version are you using?  Are you manually calling init() or letting
>> >> >> your Engine instance automatically call it when needed?
>> >> >>
>> >> >> On Mon, Jun 21, 2010 at 6:43 AM, Jason Tesser <jasontesser@gmail.com
>> >
>> >> >> wrote:
>> >> >> > OK I know 1.6.4 was released but I didn't see anything in
it that
>> >> would
>> >> >> fix
>> >> >> > this.
>> >> >> >
>> >> >> > We were getting initialized = true in the runtimeservices
but the
>> >> >> parserpool
>> >> >> > would be null
>> >> >> >
>> >> >> > Attached is the diff we used to prevent the issue.  What
do you
>> guys
>> >> >> think?
>> >> >> >
>> >> >> > The whole thing seems weird to me as the init is synced.
>> >> >> >
>> >> >> > Thanks,
>> >> >> > Jason Tesser
>> >> >> > dotCMS Lead Development Manager
>> >> >> > 1-305-858-1422
>> >> >> >
>> >> >> >
>> >> >> >
>> ---------------------------------------------------------------------
>> >> >> > To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> >> >> > For additional commands, e-mail: user-help@velocity.apache.org
>> >> >> >
>> >> >>
>> >> >> ---------------------------------------------------------------------
>> >> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> >> >> For additional commands, e-mail: user-help@velocity.apache.org
>> >> >>
>> >> >>
>> >> >
>> >>
>> >> ---------------------------------------------------------------------
>> >> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> >> For additional commands, e-mail: user-help@velocity.apache.org
>> >>
>> >>
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@velocity.apache.org
>> For additional commands, e-mail: user-help@velocity.apache.org
>>
>>
>

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


Mime
View raw message