You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Carsten Burghardt <cb...@magic-shop.de> on 2002/01/21 14:42:44 UTC

confused about ResourceNotFoundException

Hi all,

I've got a littlle problem with my Velocity 1.2-rc1. I use the 
VelocityServlet to load templates and that works fine here on my local box. 
My velocity.properties is pretty simple as you can see below. I overloaded 
the loadConfiguration() so that it searches the config-file and the macros in 
the servlet-directory. My servlet-engine is JServ.
Now I uploaded all my stuff to another server, installed everything 
(classpath, JServ, ...) and when I access my servlets I get the following 
ResourceNotFoundException:
-- snip
org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
resource '/usr/local/httpd/htdocs/magicshop/shop/admin/login.html'
        at 
org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:438)
        at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:736)
        at 
org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:718)
        at 
org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:337)
        at 
org.apache.velocity.servlet.VelocityServlet.getTemplate(VelocityServlet.java:499)
        at ShopAdmin.handleRequest(ShopAdmin.java:197)
        at 
org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:331)
        at 
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:292)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
        at 
org.apache.jserv.JServConnection.processRequest(JServConnection.java:317)
        at org.apache.jserv.JServConnection.run(JServConnection.java:188)
        at java.lang.Thread.run(Thread.java:484)
--- snip
The problem is: that file exists and is readable. I can access it via the 
Webserver. The same error occurs with every file. I also tried to set the 
path explicitly to that directory - no difference.
Any ideas?

Thanks and Regards,

Carsten Burghardt

--- velocity.properties:
resource.loader = file

file.resource.loader.description = Velocity File Resource Loader
file.resource.loader.class = 
org.apache.velocity.runtime.resource.loader.FileResourceLoader
file.resource.loader.path = /
file.resource.loader.cache = false
file.resource.loader.modificationCheckInterval = 2
-- snip

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: confused about ResourceNotFoundException

Posted by Simon Christian <si...@cpd.co.uk>.

Carsten Burghardt wrote:

> On Tuesday 22 January 2002 17:44, you wrote:
> 
>>Hi Carsten,
>>
>>I'm (still) using JServ myself so feel we're in the same boat a bit! It
>>looks, from your more recent messages, like the file permissions are fine.
>>
>>I wonder if the problem is to do with either the VelocityEngine being
>>initialised prior to your overloaded loadConfiguration()
>>method i.e. in another servlet, or if there are some default initArgs to
>>the servlets in your zone (or another one) which include a 'properties='
>>pair which is being read instead of your own properties. This has
>>certainly had me running in circles before! I can imagine  this being
>>something of a pain for anyone running servlets on a shared box of which
>>they don't have full control.
>>
> 
> You're cool! I copied the properties-file for the zone from another and that 
> one had default args:
> servlets.default.initArgs=configfile=/path/to/file
> So the wrong config-file was loaded. Thanks!
> 


Glad it worked :)

> 
>>Moving to the Separate Instance model rather than the Singleton one may
>>well provide you with a better solution.
>>
> 
> Hmm, I don't see a reason for that. I just need one instance I think. Are 
> there any benefits?
> 
> 


Well it depends on what you intend to be doing in the future: using the 
seperate instance method allows you more fine-grained control over the 
individual servlets. You can use a different properties file for each 
servlet and so use differing template directories, loggers etc.

- simon



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: confused about ResourceNotFoundException

Posted by Carsten Burghardt <cb...@magic-shop.de>.
On Tuesday 22 January 2002 17:44, you wrote:
> Hi Carsten,
>
> I'm (still) using JServ myself so feel we're in the same boat a bit! It
> looks, from your more recent messages, like the file permissions are fine.
>
> I wonder if the problem is to do with either the VelocityEngine being
> initialised prior to your overloaded loadConfiguration()
> method i.e. in another servlet, or if there are some default initArgs to
> the servlets in your zone (or another one) which include a 'properties='
> pair which is being read instead of your own properties. This has
> certainly had me running in circles before! I can imagine  this being
> something of a pain for anyone running servlets on a shared box of which
> they don't have full control.

You're cool! I copied the properties-file for the zone from another and that 
one had default args:
servlets.default.initArgs=configfile=/path/to/file
So the wrong config-file was loaded. Thanks!

> Moving to the Separate Instance model rather than the Singleton one may
> well provide you with a better solution.

Hmm, I don't see a reason for that. I just need one instance I think. Are 
there any benefits?


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: confused about ResourceNotFoundException

Posted by Simon Christian <si...@cpd.co.uk>.
Hi Carsten,

I'm (still) using JServ myself so feel we're in the same boat a bit! It 
looks, from your more recent messages, like the file permissions are fine.

I wonder if the problem is to do with either the VelocityEngine being 
initialised prior to your overloaded loadConfiguration()
method i.e. in another servlet, or if there are some default initArgs to 
the servlets in your zone (or another one) which include a 'properties=' 
pair which is being read instead of your own properties. This has 
certainly had me running in circles before! I can imagine  this being 
something of a pain for anyone running servlets on a shared box of which 
they don't have full control.

Moving to the Separate Instance model rather than the Singleton one may 
well provide you with a better solution.

- simon


Carsten Burghardt wrote:

> Hi all,
> 
> I've got a littlle problem with my Velocity 1.2-rc1. I use the 
> VelocityServlet to load templates and that works fine here on my local box. 
> My velocity.properties is pretty simple as you can see below. I overloaded 
> the loadConfiguration() so that it searches the config-file and the macros in 
> the servlet-directory. My servlet-engine is JServ.
> Now I uploaded all my stuff to another server, installed everything 
> (classpath, JServ, ...) and when I access my servlets I get the following 
> ResourceNotFoundException:
> -- snip
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find 
> resource '/usr/local/httpd/htdocs/magicshop/shop/admin/login.html'
>         at 
> org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:438)
>         at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:736)
>         at 
> org.apache.velocity.runtime.RuntimeInstance.getTemplate(RuntimeInstance.java:718)
>         at 
> org.apache.velocity.runtime.RuntimeSingleton.getTemplate(RuntimeSingleton.java:337)
>         at 
> org.apache.velocity.servlet.VelocityServlet.getTemplate(VelocityServlet.java:499)
>         at ShopAdmin.handleRequest(ShopAdmin.java:197)
>         at 
> org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:331)
>         at 
> org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:292)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:499)
>         at javax.servlet.http.HttpServlet.service(HttpServlet.java:588)
>         at 
> org.apache.jserv.JServConnection.processRequest(JServConnection.java:317)
>         at org.apache.jserv.JServConnection.run(JServConnection.java:188)
>         at java.lang.Thread.run(Thread.java:484)
> --- snip
> The problem is: that file exists and is readable. I can access it via the 
> Webserver. The same error occurs with every file. I also tried to set the 
> path explicitly to that directory - no difference.
> Any ideas?
> 
> Thanks and Regards,
> 
> Carsten Burghardt
> 



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: confused about ResourceNotFoundException

Posted by Wido Hillmann <wi...@epost.de>.
Ok, your right ive'seen it with your dir command.
Maybe if you try to read the file via jserv you get an idea why it can't
be read by velocity. To me it would be much easier to find out IO
related issues with standard IO File related functions.

My experience so far is, it's not easy to find a file with velocity, but
velocity was never the reason why i'cant access a file.

-wido

Carsten Burghardt wrote:
> 
> Well, the file-permissions are 644 so JServ should at least read it.
> 
> ----- Original Message -----
> From: "Wido Hillmann" <wi...@epost.de>
> To: "Velocity Users List" <ve...@jakarta.apache.org>
> Sent: Monday, January 21, 2002 10:12 PM
> Subject: Re: confused about ResourceNotFoundException
> 
> > just an idea,
> >
> > are you sure you have the permission to read the file via jserv ?
> >
> > -wido
> >
> > Carsten Burghardt wrote:
> > >
> > > Hi all,
> > >
> > > I've got a littlle problem with my Velocity 1.2-rc1. I use the
> > > VelocityServlet to load templates and that works fine here on my local
> box.
> > > My velocity.properties is pretty simple as you can see below. I
> overloaded
> > > the loadConfiguration() so that it searches the config-file and the
> macros in
> > > the servlet-directory. My servlet-engine is JServ.
> > > Now I uploaded all my stuff to another server, installed everything
> > > (classpath, JServ, ...) and when I access my servlets I get the
> following
> > > ResourceNotFoundException:
> > ...
> >
> > --
> > To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> <ma...@jakarta.apache.org>
> >
> >
> 
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: confused about ResourceNotFoundException

Posted by Carsten Burghardt <cb...@emedia-consult.de>.
Well, the file-permissions are 644 so JServ should at least read it.

----- Original Message -----
From: "Wido Hillmann" <wi...@epost.de>
To: "Velocity Users List" <ve...@jakarta.apache.org>
Sent: Monday, January 21, 2002 10:12 PM
Subject: Re: confused about ResourceNotFoundException


> just an idea,
>
> are you sure you have the permission to read the file via jserv ?
>
> -wido
>
> Carsten Burghardt wrote:
> >
> > Hi all,
> >
> > I've got a littlle problem with my Velocity 1.2-rc1. I use the
> > VelocityServlet to load templates and that works fine here on my local
box.
> > My velocity.properties is pretty simple as you can see below. I
overloaded
> > the loadConfiguration() so that it searches the config-file and the
macros in
> > the servlet-directory. My servlet-engine is JServ.
> > Now I uploaded all my stuff to another server, installed everything
> > (classpath, JServ, ...) and when I access my servlets I get the
following
> > ResourceNotFoundException:
> ...
>
> --
> To unsubscribe, e-mail:
<ma...@jakarta.apache.org>
> For additional commands, e-mail:
<ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: confused about ResourceNotFoundException

Posted by Wido Hillmann <wi...@epost.de>.
just an idea,

are you sure you have the permission to read the file via jserv ?

-wido

Carsten Burghardt wrote:
> 
> Hi all,
> 
> I've got a littlle problem with my Velocity 1.2-rc1. I use the
> VelocityServlet to load templates and that works fine here on my local box.
> My velocity.properties is pretty simple as you can see below. I overloaded
> the loadConfiguration() so that it searches the config-file and the macros in
> the servlet-directory. My servlet-engine is JServ.
> Now I uploaded all my stuff to another server, installed everything
> (classpath, JServ, ...) and when I access my servlets I get the following
> ResourceNotFoundException:
...

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: confused about ResourceNotFoundException

Posted by "Geir Magnusson Jr." <ge...@yahoo.com>.
On 1/21/02 8:42 AM, "Carsten Burghardt" <cb...@magic-shop.de> wrote:

> Hi all,
> 
> I've got a littlle problem with my Velocity 1.2-rc1.

Switch to the release version! :)
 
>I use the 
> VelocityServlet to load templates and that works fine here on my local box.
> My velocity.properties is pretty simple as you can see below. I overloaded
> the loadConfiguration() so that it searches the config-file and the macros in
> the servlet-directory. My servlet-engine is JServ.

Wow.

> Now I uploaded all my stuff to another server, installed everything
> (classpath, JServ, ...) and when I access my servlets I get the following
> ResourceNotFoundException:
> -- snip
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource '/usr/local/httpd/htdocs/magicshop/shop/admin/login.html'
>       at 

> --- snip
> The problem is: that file exists and is readable. I can access it via the
> Webserver. The same error occurs with every file. I also tried to set the
> path explicitly to that directory - no difference.
> Any ideas?

That file really exists as-is with that path?


-- 
Geir Magnusson Jr.                                     geirm@optonline.net
System and Software Consulting
"They that can give up essential liberty to obtain a little temporary safety
deserve neither liberty nor safety." - Benjamin Franklin



_________________________________________________________
Do You Yahoo!?
Get your free @yahoo.com address at http://mail.yahoo.com


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>