You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@velocity.apache.org by Cyril ROY <cy...@gmail.com> on 2005/10/24 16:45:57 UTC

VelocityEngine not initialised correctly (null) with spring

Hello,

I'm a french new developer.
I'm in an IBM project and new to Spring and velocity technologies.

I have to complete a web application that a person left unfinished when 
leaving the project.

Unfortunately, he left me some errors :(

Velocity engine is here used to produce a document.
Here is the thing : VelocityEngine is declared in my Service 
Implementation Class and initialised via xml spring files.
But the VelocityEngine declared in my class is not initialised (it remains null (the class initialisation)).

The spring files seem OK.

In the console Debug here is what I see

Initialising the VelocityEngine via spring :
INFO  org.apache.velocity.app.VelocityEngine - 
**************************************************************
INFO  org.apache.velocity.app.VelocityEngine - Starting Jakarta Velocity 
v1.4
INFO  org.apache.velocity.app.VelocityEngine - RuntimeInstance initializing.
[...]
ERROR org.apache.velocity.app.VelocityEngine - ResourceManager : unable 
to find resource 'VM_global_library.vm' in any resource loader.
Is this normal?
[...]

Then, when trying to use the VelocityEngine I've got in 
VelocityEngineUtils.mergeTemplate method I've got the following 
exception (since the VelocityEngine is  null): 
java.lang.NullPointerException
   at 
org.springframework.ui.velocity.VelocityEngineUtils.mergeTemplate(VelocityEngineUtils.java:56)

Have you got any idea?
I can send you some code sample if it can help your understanding.

I hope you will be able to help me.

P.S : all apologies for my english.

Thanks,

Cyril ROY


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


Re: VelocityEngine not initialised correctly (null) with spring

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

Sounds like a config error.  We see this error in Velocity when 
VelocityEngine.init() was not called.

 I'm no Spring expert, but Spring should be initializing Velocity for you.

Have you seen this article?  It gives an example.
http://jroller.com/comments/raible/home/sending_velocity_based_e_mail

Best,
WILL


----- Original Message ----- 
From: "Nathan Bubna" <nb...@gmail.com>
To: "Velocity Developers List" <ve...@jakarta.apache.org>
Sent: Monday, October 24, 2005 8:14 AM
Subject: Re: VelocityEngine not initialised correctly (null) with spring


On 10/24/05, Cyril ROY <cy...@gmail.com> wrote:
> Hello,
>
> I'm a french new developer.
> I'm in an IBM project and new to Spring and velocity technologies.
>
> I have to complete a web application that a person left unfinished when
> leaving the project.
>
> Unfortunately, he left me some errors :(
>
> Velocity engine is here used to produce a document.
> Here is the thing : VelocityEngine is declared in my Service
> Implementation Class and initialised via xml spring files.
> But the VelocityEngine declared in my class is not initialised (it remains 
> null (the class initialisation)).
>
> The spring files seem OK.
>
> In the console Debug here is what I see
>
> Initialising the VelocityEngine via spring :
> INFO  org.apache.velocity.app.VelocityEngine -
> **************************************************************
> INFO  org.apache.velocity.app.VelocityEngine - Starting Jakarta Velocity
> v1.4
> INFO  org.apache.velocity.app.VelocityEngine - RuntimeInstance 
> initializing.
> [...]
> ERROR org.apache.velocity.app.VelocityEngine - ResourceManager : unable
> to find resource 'VM_global_library.vm' in any resource loader.
> Is this normal?

yes.  ignore it.

> [...]
>
> Then, when trying to use the VelocityEngine I've got in
> VelocityEngineUtils.mergeTemplate method I've got the following
> exception (since the VelocityEngine is  null):
> java.lang.NullPointerException
>    at
> org.springframework.ui.velocity.VelocityEngineUtils.mergeTemplate(VelocityEngineUtils.java:56)
>
> Have you got any idea?

not really.  i've only just recently begun learning Spring and have
not looked into their Velocity integration yet.  but, it certainly
sounds like the problem is in how Spring is being used or configured.
if the VelocityEngine is initialized (as seen from the logs above),
but is then null when trying to use the VelocityEngineUtils, then it
is some problem with the setting up of VelocityEngineUtils, i'd guess.
  not really a problem with Velocity.

if someone else on this list who knows more about Velocity-Spring
integration doesn't help you, then you should ask someone over on the
spring lists.  they'll have a better idea of what's going on.

> I can send you some code sample if it can help your understanding.
>
> I hope you will be able to help me.
>
> P.S : all apologies for my english.
>
> Thanks,
>
> Cyril ROY
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>
>

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


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


Re: VelocityEngine not initialised correctly (null) with spring

Posted by Nathan Bubna <nb...@gmail.com>.
On 10/24/05, Cyril ROY <cy...@gmail.com> wrote:
> Hello,
>
> I'm a french new developer.
> I'm in an IBM project and new to Spring and velocity technologies.
>
> I have to complete a web application that a person left unfinished when
> leaving the project.
>
> Unfortunately, he left me some errors :(
>
> Velocity engine is here used to produce a document.
> Here is the thing : VelocityEngine is declared in my Service
> Implementation Class and initialised via xml spring files.
> But the VelocityEngine declared in my class is not initialised (it remains null (the class initialisation)).
>
> The spring files seem OK.
>
> In the console Debug here is what I see
>
> Initialising the VelocityEngine via spring :
> INFO  org.apache.velocity.app.VelocityEngine -
> **************************************************************
> INFO  org.apache.velocity.app.VelocityEngine - Starting Jakarta Velocity
> v1.4
> INFO  org.apache.velocity.app.VelocityEngine - RuntimeInstance initializing.
> [...]
> ERROR org.apache.velocity.app.VelocityEngine - ResourceManager : unable
> to find resource 'VM_global_library.vm' in any resource loader.
> Is this normal?

yes.  ignore it.

> [...]
>
> Then, when trying to use the VelocityEngine I've got in
> VelocityEngineUtils.mergeTemplate method I've got the following
> exception (since the VelocityEngine is  null):
> java.lang.NullPointerException
>    at
> org.springframework.ui.velocity.VelocityEngineUtils.mergeTemplate(VelocityEngineUtils.java:56)
>
> Have you got any idea?

not really.  i've only just recently begun learning Spring and have
not looked into their Velocity integration yet.  but, it certainly
sounds like the problem is in how Spring is being used or configured. 
if the VelocityEngine is initialized (as seen from the logs above),
but is then null when trying to use the VelocityEngineUtils, then it
is some problem with the setting up of VelocityEngineUtils, i'd guess.
  not really a problem with Velocity.

if someone else on this list who knows more about Velocity-Spring
integration doesn't help you, then you should ask someone over on the
spring lists.  they'll have a better idea of what's going on.

> I can send you some code sample if it can help your understanding.
>
> I hope you will be able to help me.
>
> P.S : all apologies for my english.
>
> Thanks,
>
> Cyril ROY
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: velocity-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: velocity-dev-help@jakarta.apache.org
>
>

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