Peter,

It is best to place your jar files in the CLASSPATH environment
variable prior to calling
your Perl script.

The CLASSPATH option results in your code being loaded by a different
ClassLoader, which can sometimes cause problems. It you still want tu
try this, place all your jars in the same option line. i.e. numerous
CLASSPATH options are not additive, only the last one will stick.

Patrick



On 5/1/07, Peter L. Berghold <[EMAIL PROTECTED]> wrote:
Here is a "proof of concept" script I threw together in an attempt to
try something:

#!/usr/bin/perl -w
use Inline Java => << 'End_Of_Java_Code' ,CLASSPATH=>
'/home/pberghol/src/www.bayshoredogclub.org/WebRoot/WEB-INF/lib/hibernate3.jar',CLASSPATH=>'/home/pberghol/tmp/bcdchbm.jar';
import org.bcdc.hbm.services.PeopleService;

class FooBar {


    public FooBar(){
    }

    public PeopleService getPersonService() {
        return PeopleService.getInstance();
    }


}
End_Of_Java_Code

use Data::Dumper;

my $foo = new FooBar();



my $psvc = $foo->getPersonService();

printf "%s\n",$psvc->getPersonNameFromID(1);

print Dumper($foo);


When it is run I get:

main::java::lang::NoClassDefFoundError=HASH(0x9fd50e8)

Checking bcdchbm.jar I definitely see the PeopleSerivce.class contained
therein.

To describe at a high level what is going on with this class, it is a
singleton class that instatiates itself (once) when the getInstance()
method is called and returns the one and only instance of that class.

From there you can access the member methods which in turn make
Hibernate calls to access a database.  The HibernateSessionFactory is
also contained within the jar file so that should not be an issue.

I know that Hibernate based applications require a lot of jar files as
well.

This all works fine from within a java application, so I'm just having a
bit of trouble understanding how to get it to work with Inline...

Thoughts?


--
Peter L. Berghold                               Unix Professional
[EMAIL PROTECTED]   AIM: redcowdawg YIM: blue_cowdawg
"Those who fail to learn from history are condemned to repeat it."




--
=====================
Patrick LeBoutillier
Laval, Québec, Canada

Reply via email to