Ok,
I've taken your advice and used the non-turbine version of torque.  By
setting the full path, TurbineConfig finds TurbineResources.properties fine.

//here's a sample that compiles and throws a new runtime exception
public static void main(String args[])
 {
  try{
    TurbineConfig tc = new
TurbineConfig("c:/torque","TurbineResources.properties");
    tc.init();
    Criteria crit = new Criteria();
    Vector v = SimplePeer.doSelect(crit);
    }catch(Exception e){
      System.out.println(e.getMessage());
    }
  } // end main

The error indicates an invalid logfile setting:
java.lang.Error: VelocityService runtime logfile is misconfigured: 'null' is
not a valid logfile ...
at
org.apache.turbine.services.velocity.TurbineVelocityService.initVelocity(Tur
bineVelocityService.java:427)

A closer look at the code reveals a static variable being used:
Velocity.RUNTIME_LOG:

// heres the TurbineVelocityService.java code
private void initVelocity() throws InitializationException
{
 // Now we have to perform a couple of path translations
 // for our log file and template paths.
 String path = getRealPath(
getConfiguration().getString(Velocity.RUNTIME_LOG, null));
...

The current version of  org.apache.velocity.app.Velocity does not use any
static variables.

Therefore, is this a BUG???
And why isn't there a simple "Hello Peers" application out there that works?

Brad


----- Original Message -----
From: "Daniel Rall" <>
To: <[EMAIL PROTECTED]>
Sent: Monday, August 13, 2001 7:30 PM
Subject: Re: Peers outside of Turbine?


> "Brad Matlack" <[EMAIL PROTECTED]> writes:
>
> > Is it possible to user Peers in a normal Java application, or in a web
> > application that is not using the Turbine framework?
>
> Yes, but I would only recommend doing this with the
> jakarta-turbine-torque module from (not with the version of Torque
> embedded in Turbine 2.1).
>
> > I have successfully used Torque to generate my "om" and "map" files, but
> > cannot figure out how to initilize the system.
> >
> > // this is my code segment
> > TurbineConfig tc = new
TurbineConfig("/app","TurbineResources.properties");
> > tc.init();
> > Criteria crit = new Criteria();
> > Vector v = TestPeer.doSelect(crit);
> >
> > This is the error: ...TurbineConfig users must use a path relative to
web
> > application root
>
> This looks for your config file in your file system at
> /app/TurbineResources.properties.  That first parameter specifies web
> application root.
>
> > Should I be using TurbineConfig?
>
> In 2.1, yes.
>
>                              Daniel Rall
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>


---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to