You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@velocity.apache.org by Adam Jordens <ad...@autechre.success-info.com> on 2001/05/02 22:27:10 UTC

Issues Getting iPlanet & Velocity Working

I am having some problems getting iPlanet Web Server & Application Server
(ias 6.0 SP2) working with Velocity.

First things first,  the servlet output:

VelocityServlet : Error processing the template
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'spike/sample.vm'
org.apache.velocity.exception.ResourceNotFoundException: Unable to find
resource 'spike/sample.vm' at
org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:367)
at org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:666) at
org.apache.velocity.servlet.VelocityServlet.getTemplate(VelocityServlet.java:489)
at
ca.qtrade.admin.spike.FrameworkServlet.handleRequest(FrameworkServlet.java:37)
at
org.apache.velocity.servlet.VelocityServlet.doRequest(VelocityServlet.java:326)
at
org.apache.velocity.servlet.VelocityServlet.doGet(VelocityServlet.java:287)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:740) at
javax.servlet.http.HttpServlet.service(HttpServlet.java:865) at
com.netscape.server.servlet.servletrunner.ServletInfo.service(Unknown
Source) at
com.netscape.server.servlet.servletrunner.ServletRunner.execute(Unknown
Source) at com.kivasoft.applogic.AppLogic.execute(Unknown Source) at
com.kivasoft.applogic.AppLogic.execute(Unknown Source) at
com.kivasoft.thread.ThreadBasic.run(Native Method) at
java.lang.Thread.run(Thread.java:479) 


I've packaged everything in a war file and deployed it using the iPlanet
Deployment Tool.  This particular development machine is Windows 2000 SP1.


Here is the source code of the servlet in question:

package *.*.*.spike;

import org.apache.velocity.context.Context;
import org.apache.velocity.servlet.VelocityServlet;
import org.apache.velocity.Template;
import org.apache.velocity.app.Velocity;
import java.util.Properties;

public class FrameworkServlet extends VelocityServlet {

    protected java.util.Properties loadConfiguration
(javax.servlet.ServletConfig config)
                                                  throws
java.io.IOException,

java.io.FileNotFoundException
    {
      Properties p = new Properties();
      p.setProperty("resource.loader", "file");
      p.setProperty("file.resource.loader.path", 
"e:\\velocity.properties");
      p.setProperty("runtime.log", "e:\\velocity.log");
      p.setProperty("file.resource.loader.cache", "true");
      p.setProperty("file.resource.loader.class",
"org.apache.velocity.runtime.resource.loader.FileResourceLoader");
      p.setProperty("file.resource.loader.modificationCheckInterval",
"2");
      return p;
    }

    public Template handleRequest(Context context) throws Exception{            
      Template tmpl = getTemplate("spike/sample.vm");
      return tmpl;      
    }
}


I have specified the initial parameters of the servlet as "properties -
WEB-INF/velocity.properties" but it did make a difference.  I have also
searched the drives for the velocity.log file and it does not appear to be 
getting created (however,  other servlets can read and write to the
filesystem with no problems).

Does anyone have any suggestions as to how I would go about getting
iPlanet to recognize the velocity templates.


Regards,
Adam.


Re: Issues Getting iPlanet & Velocity Working

Posted by Adam Jordens <ad...@autechre.success-info.com>.
> Adam Jordens wrote:
> > 
> > I am having some problems getting iPlanet Web Server & Application Server
> > (ias 6.0 SP2) working with Velocity.
> > 
> > First things first,  the servlet output:
> > 
> > VelocityServlet : Error processing the template
> > org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> > resource 'spike/sample.vm'
> > org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> > resource 'spike/sample.vm' at
> > org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:367)
> > at org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:666) at
> > org.apache.velocity.servlet.VelocityServlet.getTemplate(VelocityServlet.java:489)
> > at
> > ca.qtrade.admin.spike.FrameworkServlet.handleRequest(FrameworkServlet.java:37)
> > [SNIP]
> > 
> > I've packaged everything in a war file and deployed it using the iPlanet
> > Deployment Tool.  This particular development machine is Windows 2000 SP1.
> > 
> > Here is the source code of the servlet in question:
> > 
> > package *.*.*.spike;
> > 
> > import org.apache.velocity.context.Context;
> > import org.apache.velocity.servlet.VelocityServlet;
> > import org.apache.velocity.Template;
> > import org.apache.velocity.app.Velocity;
> > import java.util.Properties;
> > 
> > public class FrameworkServlet extends VelocityServlet {
> > 
> >     protected java.util.Properties loadConfiguration
> > (javax.servlet.ServletConfig config)
> >                                                   throws
> > java.io.IOException,
> > 
> > java.io.FileNotFoundException
> >     {
> >       Properties p = new Properties();
> >       p.setProperty("resource.loader", "file");
> >       p.setProperty("file.resource.loader.path",
> > "e:\\velocity.properties");
> 
> ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> 
> Sure you want to do that? :)
> 
> How about
> 
> p.setProperty("file.....path", "e:\\<yourtemplatedirectory>" );

Actually,  that was originally what i had it set to,  but on a whim i saw
a msg somewhere that said to try it that way.  Either way,  I don't think
it made a difference.

> >       p.setProperty("runtime.log", "e:\\velocity.log");
> >       p.setProperty("file.resource.loader.cache", "true");
> >       p.setProperty("file.resource.loader.class",
> > "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
> >       p.setProperty("file.resource.loader.modificationCheckInterval",
> > "2");
> >       return p;
> >     }
> 
> I am a put worried that you can't find the log file : I would try this -
> get rid of all p.setProperty() statements for now (except for the
> "file.resource.loader.path" one, and depend on the defaults for the
> moment - see where velocity creates it's log.

Originally I only had the path specified but that gave the same result.  

> It should be in the directory that you used to start the servlet runner
> - I think you mentioned windows -> if you are running iPlanet as a
> service, there may be a 'current directory' issue there, so if you could
> start by trying to launch from the command line, if possible, that would
> help.
> 
> Once you get a handle on where the log is going, then add a
> setProperty() to alter where the log goes, and see if you are successful
> there.

Yes,  it would be helpful to see where the log is going.  There is a
solaris dev box with the same software installed.  I might see if I have
any better luck deploying to it.


Thanks,
Adam.


Re: Issues Getting iPlanet & Velocity Working

Posted by "Geir Magnusson Jr." <ge...@optonline.net>.
Adam Jordens wrote:
> 
> I am having some problems getting iPlanet Web Server & Application Server
> (ias 6.0 SP2) working with Velocity.
> 
> First things first,  the servlet output:
> 
> VelocityServlet : Error processing the template
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource 'spike/sample.vm'
> org.apache.velocity.exception.ResourceNotFoundException: Unable to find
> resource 'spike/sample.vm' at
> org.apache.velocity.runtime.resource.ResourceManager.getResource(ResourceManager.java:367)
> at org.apache.velocity.runtime.Runtime.getTemplate(Runtime.java:666) at
> org.apache.velocity.servlet.VelocityServlet.getTemplate(VelocityServlet.java:489)
> at
> ca.qtrade.admin.spike.FrameworkServlet.handleRequest(FrameworkServlet.java:37)
> [SNIP]
> 
> I've packaged everything in a war file and deployed it using the iPlanet
> Deployment Tool.  This particular development machine is Windows 2000 SP1.
> 
> Here is the source code of the servlet in question:
> 
> package *.*.*.spike;
> 
> import org.apache.velocity.context.Context;
> import org.apache.velocity.servlet.VelocityServlet;
> import org.apache.velocity.Template;
> import org.apache.velocity.app.Velocity;
> import java.util.Properties;
> 
> public class FrameworkServlet extends VelocityServlet {
> 
>     protected java.util.Properties loadConfiguration
> (javax.servlet.ServletConfig config)
>                                                   throws
> java.io.IOException,
> 
> java.io.FileNotFoundException
>     {
>       Properties p = new Properties();
>       p.setProperty("resource.loader", "file");
>       p.setProperty("file.resource.loader.path",
> "e:\\velocity.properties");

^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Sure you want to do that? :)

How about

p.setProperty("file.....path", "e:\\<yourtemplatedirectory>" );


>       p.setProperty("runtime.log", "e:\\velocity.log");
>       p.setProperty("file.resource.loader.cache", "true");
>       p.setProperty("file.resource.loader.class",
> "org.apache.velocity.runtime.resource.loader.FileResourceLoader");
>       p.setProperty("file.resource.loader.modificationCheckInterval",
> "2");
>       return p;
>     }

I am a put worried that you can't find the log file : I would try this -
get rid of all p.setProperty() statements for now (except for the
"file.resource.loader.path" one, and depend on the defaults for the
moment - see where velocity creates it's log.

It should be in the directory that you used to start the servlet runner
- I think you mentioned windows -> if you are running iPlanet as a
service, there may be a 'current directory' issue there, so if you could
start by trying to launch from the command line, if possible, that would
help.

Once you get a handle on where the log is going, then add a
setProperty() to alter where the log goes, and see if you are successful
there.

Let us know.

geir

-- 
Geir Magnusson Jr.                           geirm@optonline.net
System and Software Consulting

Developing for the web?  See http://jakarta.apache.org/velocity/