You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Darren Davison <da...@davison.uk.net> on 2004/06/11 14:58:05 UTC

ClasspathResourceLoader

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1


Is there a known issue with loading a macro library from inside a jar file 
(I've seen one or two similar posts in list archives about it)?

I'm trying to do just that, but the resource is never found:

2004-06-11 13:44:15,087 ERROR [org.apache.velocity.app.VelocityEngine] - 
<ResourceManager : unable to find resource 'com/foo/bar/macros.vm' in any 
resource loader.>

However, if I move it out of a jar and into WEB-INF/classes/com/foo/bar then 
it is found and loaded:

2004-06-11 13:48:10,181 INFO [org.apache.velocity.app.VelocityEngine] - 
<ResourceManager : found com/foo/bar/macros.vm with loader 
org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader>

The jar file is in WEB-INF/lib

Cheers,
- -- 
Darren Davison
Public Key: http://www.davison.uk.net/pages/key.htm
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.2.4 (GNU/Linux)

iD8DBQFAyaxhKLMLAN01aw0RAs79AJ0XZ802cPY5PJaIDs2zYfbS6aB15ACfTStj
iM2dR3poWBqD2U8znOMEVVQ=
=aWKJ
-----END PGP SIGNATURE-----

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


Re: ClasspathResourceLoader

Posted by Darren Davison <da...@davison.uk.net>.
> Hi
>
> I've had problems with some class loaders with relative pathnames. Try
>
> /com/foo/bar/macros.vm

well it's not really relative to anything - it's the classpath, and the
same path works when it's in WEB-INF/classes just not in a jar file.

Anyway, I tried it just for fun and it suffers exactly the same problem.

Cheers!

-- 
Darren Davison
Public Key: http://www.davison.uk.net/pages/key.htm



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


Re: ClasspathResourceLoader

Posted by Ilkka Priha <im...@surfeu.fi>.
Hi

I've had problems with some class loaders with relative pathnames. Try

/com/foo/bar/macros.vm

-- Ilkka


Darren Davison wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
> 
> 
> Is there a known issue with loading a macro library from inside a jar file 
> (I've seen one or two similar posts in list archives about it)?
> 
> I'm trying to do just that, but the resource is never found:
> 
> 2004-06-11 13:44:15,087 ERROR [org.apache.velocity.app.VelocityEngine] - 
> <ResourceManager : unable to find resource 'com/foo/bar/macros.vm' in any 
> resource loader.>
> 
> However, if I move it out of a jar and into WEB-INF/classes/com/foo/bar then 
> it is found and loaded:
> 
> 2004-06-11 13:48:10,181 INFO [org.apache.velocity.app.VelocityEngine] - 
> <ResourceManager : found com/foo/bar/macros.vm with loader 
> org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader>
> 
> The jar file is in WEB-INF/lib
> 
> Cheers,
> - -- 
> Darren Davison
> Public Key: http://www.davison.uk.net/pages/key.htm
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.2.4 (GNU/Linux)
> 
> iD8DBQFAyaxhKLMLAN01aw0RAs79AJ0XZ802cPY5PJaIDs2zYfbS6aB15ACfTStj
> iM2dR3poWBqD2U8znOMEVVQ=
> =aWKJ
> -----END PGP SIGNATURE-----
> 
> ---------------------------------------------------------------------
> 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