Re: Deploying my application (nesting the jar)

From: Benjamin Stookey <jamstooks(at)yahoo(dot)com>
To: pgsql-jdbc(at)postgresql(dot)org
Subject: Re: Deploying my application (nesting the jar)
Date: 2005-11-22 19:23:22
Message-ID: 20051122192322.69845.qmail@web35001.mail.mud.yahoo.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-jdbc

So if I extract the jar and include the class files in
my project classpath, do I still instantiate the
driver using:

Class.forName("org.postgresql.Driver").newInstance();

I appologize for my ignorance on this one.

Below is the .classpath file created by Eclipse. The
extracted jar is excluded from the source, but
included as a library. However, I get the "no suitable
driver" SQLException. Also, when I included the Jar as
a library it worked fine, just when I come to
deploying this it gets complicated.

Thanks,
-Ben

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry
excluding="org/|org/postgresql/|org/|org/|org/postgresql
/|org/postgresql/core/|org/postgresql/core/types/|org/postgresql/core/v2/|org/po
stgresql/core/v3/|org/postgresql/ds/|org/postgresql/ds/common/|org/postgresql/fa
stpath/|org/postgresql/geometric/|org/postgresql/jdbc2/|org/postgresql/jdbc2/opt
ional/|org/postgresql/jdbc3/|org/postgresql/largeobject/|org/postgresql/ssl/|org
/postgresql/translation/|org/postgresql/util/|org/postgresql/xa/|org/postgresql/
jdbc3/|org/postgresql/|org/" kind="src" path=""/>
<classpathentry kind="con"
path="org.eclipse.jdt.launching.JRE_CONTAINER
"/>
<classpathentry kind="lib" path="org"/>
<classpathentry kind="output" path="bin"/>
</classpath>

--- Mark Lewis <mark(dot)lewis(at)mir3(dot)com> wrote:

> Well, you could actually nest the jar inside of
> another jar (we've done
> it here before), but you need to do some ugly things
> like using your own
> classloader and doing some tricks to avoid the
> must-be-the-same-
> classloader security checks DriverManager does.
>
> Just including the postgres driver classes directly
> in your jar file is
> simpler, and that's what we mostly do when we need
> to bundle an
> application with build-in PostgreSQL support. Not
> sure why it's not
> working for you.
>
> -- Mark Lewis
>
> On Mon, 2005-11-21 at 15:27 -0800, Benjamin Stookey
> wrote:
> > I realize that it's not possible to nest the jar
> in
> > another jar, but I was wondering if anyone could
> give
> > me a suggestion for deploying my application using
> > this jar file.
> >
> > I did try extracting the jar to include the class
> > files in my classpath (is this a bad idea?), but
> once
> > I did that I get the "No suitable driver"
> > SQLException. I'm probably making some blundering
> > mistake with my classpath, but I can't figure it
> out.
> >
> > How have other people done this? Ideally, I'd like
> my
> > application to be in one jar file to make it
> easier
> > for my users. I'm still hoping this is possible...
> >
> > Thanks for the help,
> > -Ben
> >
> > /**
> > * @develEnv ECLIPSE
> > * @javaVer JAVA 1.4.2_08
> > * @OPSystem SUSE LINUX
> > */
> >
> >
> >
> >
> > __________________________________
> > Yahoo! Mail - PC Magazine Editors' Choice 2005
> > http://mail.yahoo.com
> >
> > ---------------------------(end of
> broadcast)---------------------------
> > TIP 2: Don't 'kill -9' the postmaster
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 5: don't forget to increase your free space map
> settings
>



__________________________________
Yahoo! Mail - PC Magazine Editors' Choice 2005
http://mail.yahoo.com

In response to

Responses

Browse pgsql-jdbc by date

  From Date Subject
Next Message Kevin Grittner 2005-11-22 20:51:02 rollback ignored until end of transaction block
Previous Message Vit Timchishin 2005-11-22 11:53:44 Re: Deadlock problem