Обсуждение: Setting up DSPACE for Postgres access

Поиск
Список
Период
Сортировка

Setting up DSPACE for Postgres access

От
Ashwin Kutty
Дата:
Hi all,

I sent this message to the jdbc list and received no response there and so
am posting to this list hoping I could get some help here.

Thanks in advance.

---------- Forwarded message ----------
Date: Fri, 17 Oct 2003 11:54:19 -0300 (ADT)
From: Ashwin Kutty <akutty@dal.ca>
Reply-To: Ashwin Kutty <Ashwin.Kutty@Dal.Ca>
To: pgsql-jdbc@postgresql.org
Subject: Setting up DSPACE for Postgres access


I am currently testing a product by the name of dspace
(http://www.dspace.org) and require installing java since dspace is
completely java based.  The problem is that during its installation it
needs to talk to pgsql via jdbc and I am getting the error:
Exception occurred:org.apache.commons.dbcp.DbcpException:
java.sql.SQLException: Driver not found for URL:
jdbc:postgresql://dspace.library.dal.ca:5432/dspace
org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Driver not
found for URL: jdbc:postgresql://dspace.library.dal.ca:5432/dspace

I cannot ofcourse go beyond this since they have to talk to each other and
if that doesnt happen nothing else is going to work.  In terms of the
system and the env var's; here goes:

RH Linux 9 (kernel 2.4.20)
j2sdk1.4.2_01
dspace - 1.1.1
postgres - 7.3.4

environment var's:

CLASSPATH=/home/dspace/j2sdk1.4.2_01:/dspace/lib/postgresql.jar:/dspace/lib:/usr/local/pgsql/share/java:/dspace/config:/dspace/lib:/dspace/lib/activation.jar:/dspace/lib/commons-cli.jar:/dspace/lib/commons-collections.jar:/dspace/lib/commons-dbcp.jar:/dspace/lib/commons-pool.jar:/dspace/lib/cos.jar:/dspace/lib/dspace.jar:/dspace/lib/handle.jar:/dspace/lib/jena.jar:/dspace/lib/log4j.jar:/dspace/lib/lucene.jar:/dspace/lib/mail.jar:/dspace/lib/oaicat.jar:/dspace/lib/oro.jar:/dspace/lib/servlet.jar:/dspace/lib/xalan.jar:/dspace/lib/xerces.jar:/home/dspace/j2sdk1.4.2_01/lib:/home/dspace/j2sdk1.4.2_01:/home/dspace/j2sdk1.4.2_01/jre/lib:/home/dspace/j2sdk1.4.2_01/jre/javaws:/home/dspace/dspace-1.1.1-source/build/classes:/usr/local/pgsql/share/java:/usr/local/pgsql/share/java/postgresql.jar
PGDATA=/usr/local/pgsql/data
PGSQL_HOME=/usr/local/pgsql/bin
JAVA_HOME=/home/dspace/j2sdk1.4.2_01

PATH=/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin:/home/dspace/apache-ant-1.5.4/bin:/usr/local/pgsql/share/java:/usr/local/pgsql/bin:/home/dspace/j2sdk1.4.2_01:/home/dspace/j2sdk1.4.2_01/bin:/home/dspace/bin
JAVA_OPTS=-Xmx512M -Xms64M -Dfile.encoding=UTF-8
JSSE_HOME=/home/dspace/j2sdk1.4.2_01/jre/lib

Any help would be greatly appreciated.

Thanks.



Re: Setting up DSPACE for Postgres access

От
Richard Huxton
Дата:
On Thursday 23 October 2003 14:20, Ashwin Kutty wrote:
>
> I am currently testing a product by the name of dspace
> (http://www.dspace.org) and require installing java since dspace is
> completely java based.  The problem is that during its installation it
> needs to talk to pgsql via jdbc and I am getting the error:
> Exception occurred:org.apache.commons.dbcp.DbcpException:
> java.sql.SQLException: Driver not found for URL:
> jdbc:postgresql://dspace.library.dal.ca:5432/dspace
> org.apache.commons.dbcp.DbcpException: java.sql.SQLException: Driver not
> found for URL: jdbc:postgresql://dspace.library.dal.ca:5432/dspace

It's complaining that it cannot find a driver. The obvious steps are:
 1. Check you have your JDBC driver installed and configured.
 2. Check you can connect using it.
 3. Check it is in the relevant PATH
How far along this process have you got?

If you've done all those, we'll have to figure out why it can't find the
driver.
--
  Richard Huxton
  Archonet Ltd

Re: Setting up DSPACE for Postgres access

От
Ashwin Kutty
Дата:
> It's complaining that it cannot find a driver. The obvious steps are:
>  1. Check you have your JDBC driver installed and configured.

Yes.  I have done so.  Included in the Classpath env var as well.  I have
gone so far as to downloading it from jdbc.postgresql.org rather than
using the compiled one I have.  Still no luck.

>  2. Check you can connect using it.

Via a test program?  Done, no luck.. Same ol same ol..

>  3. Check it is in the relevant PATH

Besides the Classpath, does it need to be in the Path as well?  If so, no
I havent added it in, but will do so if its required.

> How far along this process have you got?

I am actually to the point of pulling teeth, cause I have added every jar
file I can think of and find in the classpath, re-installed everything and
still the case remains the same.  I am guessing its just not finding it
due to some foolish little quirk I am missing some place.  I even have tcp_ip
turned on btw in postgres to accept connections both from the box itself
and another machine through which I am using pgadmin and connecting fine.

> If you've done all those, we'll have to figure out why it can't find the
> driver.

I thought and still under the impression that its looking in the classpath
for this and I have edited /etc/profile to include it, checked env before
running the program and it according to it the jar file is included fine
and the classpath does have it; but still nothing.  Checked file
permissions on the jar file and its fine as well.  I have made changes to
the user's bash_profile as well to see if its a user related issue and
still nothing.  Su'ed in as root and tried it out and yet nothing.  Its
like for some reason the file just cant be found.

Any ideas and assistance would be greatly appreciated.

Thanks.


Re: Setting up DSPACE for Postgres access

От
Dardo D Kleiner
Дата:
Whenever I need to use the postgresql JDBC driver in my programs, I
have to manually include the line:

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

somewhere *before* I call DriverManager.getConnection.

Try this in your test program and see if it works.  Unfortunately,
you may not be able to modify the installer to support this, but
there might be another way?

HTH!

--
Dardo D. Kleiner
Connection Machine Facility, Center for Computational Sciences
Naval Research Laboratory (Washington, DC)
dkleiner@cmf.nrl.navy.mil -- 202.404.7019



Re: Setting up DSPACE for Postgres access

От
Richard Huxton
Дата:
On Thursday 23 October 2003 15:52, Ashwin Kutty wrote:
>
> I thought and still under the impression that its looking in the classpath
> for this and I have edited /etc/profile to include it, checked env before
> running the program and it according to it the jar file is included fine
> and the classpath does have it; but still nothing.  Checked file
> permissions on the jar file and its fine as well.  I have made changes to
> the user's bash_profile as well to see if its a user related issue and
> still nothing.  Su'ed in as root and tried it out and yet nothing.  Its
> like for some reason the file just cant be found.

Looking at the dspace docs (system prerequisites):
"Then when PostgreSQL has compiled, copy the new postgresql.jar to
dspace-1.1/lib."

Strikes me as a bit strange it won't just use the classpath, but have you got
the jar in there too?

--
  Richard Huxton
  Archonet Ltd

Re: Setting up DSPACE for Postgres access

От
Ashwin Kutty
Дата:
> Looking at the dspace docs (system prerequisites):
> "Then when PostgreSQL has compiled, copy the new postgresql.jar to
> dspace-1.1/lib."
>
> Strikes me as a bit strange it won't just use the classpath, but have you got
> the jar in there too?

Yes and in j2sdk's lib directory and in pgsql's share directory and it is
all being called in the classpath.. no luck, still..


Re: Setting up DSPACE for Postgres access

От
Ashwin Kutty
Дата:
Agreed, however if its working fine on someone else's end then the problem
is local to my environment.  People do have difficulties setting up DSPACE
but I currently have the front-end running fine.  The dependencies are
just crazy along with third party apps for DSPACE.  However, all that is
done, its working and the front-end is up.  I have what most others dont
and dont have what most others do.  The jar part of it really gets me
cause all it needs is the CLASSPATH env var pointing to the appropriate
jar as I have done so many times in the past.

I know Java is on ok cause I have Tomcat running on the server fine as
well which is required for DSPACE as well.  I just dont get why the
program cannot find the jar var.  The create-administrator script runs the
script such that the call tends to be:
java -Xmx256m -classpath $FULLPATH "org.dspace.administer.CreateAdministrator"

Where, $FULLPATH=$CLASSPATH:$JARS:$DSPACEDIR/config
Where $JARS=`echo $DSPACEDIR/lib/*.jar | sed 's/ /\:/g'`

Now, the postgresql.jar gets pointed to twice; once from the script with
the JARS var and the second with the pointing to it from the $CLASSPATH
var set by me.  I even echo the $FULLPATH var right before it hits the
java command and the echo brings up the huge PATH created by the script
that contains the jar files and the directories.  I dont get however how
the script can have it in the $FULLPATH var but not use it when sent to
the command line?

On Thu, 23 Oct 2003, Dardo D Kleiner wrote:

> Whenever I need to use the postgresql JDBC driver in my programs, I
> have to manually include the line:
>
> Class.forName("org.postgresql.Driver");
>
> somewhere *before* I call DriverManager.getConnection.
>
> Try this in your test program and see if it works.  Unfortunately,
> you may not be able to modify the installer to support this, but
> there might be another way?
>
> HTH!
>
> --
> Dardo D. Kleiner
> Connection Machine Facility, Center for Computational Sciences
> Naval Research Laboratory (Washington, DC)
> dkleiner@cmf.nrl.navy.mil -- 202.404.7019
>
>
>

---
"The difference between genius and stupidity is that genius has its
limits."  - Albert Einstein

Ashwin
kutty..
Systems Administrator
Dalhousie University Libraries
(902) 494-2694


Re: Setting up DSPACE for Postgres access

От
Richard Huxton
Дата:
On Thursday 23 October 2003 18:07, Ashwin Kutty wrote:
>
> Now, the postgresql.jar gets pointed to twice; once from the script with
> the JARS var and the second with the pointing to it from the $CLASSPATH
> var set by me.  I even echo the $FULLPATH var right before it hits the
> java command and the echo brings up the huge PATH created by the script
> that contains the jar files and the directories.  I dont get however how
> the script can have it in the $FULLPATH var but not use it when sent to
> the command line?

Given everything else you've tried, I think you might be on the right track
here and somehow your environment variables are getting clobbered. How or why
I couldn't say (I'd suspect Tomcat, but you say you can't even run the
create-administator app).

The only other thing I can think of is that for some reason it's looking for
the wrong class. If dspace comes with the source, it might be worth checking
whether there isn't a mistake in the Class.forname() call.

I must admit, I don't know much java - can you use "strace" to track system
calls, or is there a similar utility that would let you see what files it is
searching for?
--
  Richard Huxton
  Archonet Ltd

Re: Setting up DSPACE for Postgres access

От
Andrew Rawnsley
Дата:
Have you tried placing the jars in the $JAVA_HOME/jre/lib/ext
directory? Jars there
are automatically searched by the JVM.


On Thursday, October 23, 2003, at 01:52 PM, Richard Huxton wrote:

> On Thursday 23 October 2003 18:07, Ashwin Kutty wrote:
>>
>> Now, the postgresql.jar gets pointed to twice; once from the script
>> with
>> the JARS var and the second with the pointing to it from the
>> $CLASSPATH
>> var set by me.  I even echo the $FULLPATH var right before it hits the
>> java command and the echo brings up the huge PATH created by the
>> script
>> that contains the jar files and the directories.  I dont get however
>> how
>> the script can have it in the $FULLPATH var but not use it when sent
>> to
>> the command line?
>
> Given everything else you've tried, I think you might be on the right
> track
> here and somehow your environment variables are getting clobbered. How
> or why
> I couldn't say (I'd suspect Tomcat, but you say you can't even run the
> create-administator app).
>
> The only other thing I can think of is that for some reason it's
> looking for
> the wrong class. If dspace comes with the source, it might be worth
> checking
> whether there isn't a mistake in the Class.forname() call.
>
> I must admit, I don't know much java - can you use "strace" to track
> system
> calls, or is there a similar utility that would let you see what files
> it is
> searching for?
> --
>   Richard Huxton
>   Archonet Ltd
>
> ---------------------------(end of
> broadcast)---------------------------
> TIP 6: Have you searched our list archives?
>
>                http://archives.postgresql.org
>
--------------------

Andrew Rawnsley
President
The Ravensfield Digital Resource Group, Ltd.
(740) 587-0114
www.ravensfield.com


Re: Setting up DSPACE for Postgres access

От
Ashwin Kutty
Дата:
> Given everything else you've tried, I think you might be on the right track
> here and somehow your environment variables are getting clobbered. How or why
> I couldn't say (I'd suspect Tomcat, but you say you can't even run the
> create-administator app).

Tomcat only uses the minor few and runs like a charm.  It doesnt seem to
be only the create-administrator app.  As I mentioned earlier, this occurs
with any app trying to connect to pgsql via jdbc.  I used the psql.java
file to compile and test that comes bundled in the postgres source.  The
error I received was as follows:

Exception in thread "main" java.lang.NoClassDefFoundError: loaded class
psql was in fact named example.psql
   at 0x40268e17: java.lang.Throwable.Throwable(java.lang.String)
(/usr/lib/./libgcj.so.3)
   at 0x4025bc8e: java.lang.Error.Error(java.lang.String)
(/usr/lib/./libgcj.so.3)
   at 0x4025d6b6: java.lang.LinkageError.LinkageError(java.lang.String)
(/usr/lib/./libgcj.so.3)
   at 0x4025eb36:
java.lang.NoClassDefFoundError.NoClassDefFoundError(java.lang.String)
(/usr/lib/./libgcj.so.3)
   at 0x4022d555: ?? (??:0)
   at 0x4022c96e: _Jv_ClassReader.handleClassBegin(int, int, int)
(/usr/lib/./libgcj.so.3)
   at 0x4022ab61: _Jv_ClassReader.parse() (/usr/lib/./libgcj.so.3)
   at 0x4022a97f: _Jv_DefineClass(java.lang.Class, byte[], int, int)
(/usr/lib/./libgcj.so.3)
   at 0x40247e6f: java.lang.ClassLoader.defineClass0(java.lang.String,
byte[], int, int, java.security.ProtectionDomain) (/usr/lib/./libgcj.so.3)
   at 0x4025aaa3: java.lang.ClassLoader.defineClass(java.lang.String,
byte[], int, int, java.security.ProtectionDomain) (/usr/lib/./libgcj.so.3)
   at 0x4025aa13: java.lang.ClassLoader.defineClass(java.lang.String,
byte[], int, int) (/usr/lib/./libgcj.so.3)
   at 0x402f1f2e: java.net.URLClassLoader.findClass(java.lang.String)
(/usr/lib/./libgcj.so.3)
   at 0x40248197:
gnu.gcj.runtime.VMClassLoader.findClass(java.lang.String)
(/usr/lib/./libgcj.so.3)
   at 0x4025a904: java.lang.ClassLoader.loadClass(java.lang.String,
boolean) (/usr/lib/./libgcj.so.3)
   at 0x402488d9: _Jv_FindClass(_Jv_Utf8Const, java.lang.ClassLoader)
(/usr/lib/./libgcj.so.3)
   at 0x40244cdd: java.lang.Class.forName(java.lang.String, boolean,
java.lang.ClassLoader) (/usr/lib/./libgcj.so.3)
   at 0x40244d9f: java.lang.Class.forName(java.lang.String)
(/usr/lib/./libgcj.so.3)
   at 0x402ad01d: gnu.gcj.runtime.FirstThread.run()
(/usr/lib/./libgcj.so.3)
   at 0x4024fc4c: _Jv_ThreadRun(java.lang.Thread) (/usr/lib/./libgcj.so.3)
   at 0x4021c8ac: _Jv_RunMain(java.lang.Class, byte const, int, byte
const, boolean) (/usr/lib/./libgcj.so.3)
   at 0x08048910: ?? (??:0)
   at 0x420156a4: __libc_start_main (/lib/tls/libc.so.6)
   at 0x080486c1: ?? (??:0)


> The only other thing I can think of is that for some reason it's looking for
> the wrong class. If dspace comes with the source, it might be worth checking
> whether there isn't a mistake in the Class.forname() call.

Put it this way, the build works for the rest and after some testing found
that outside of create-admin I cant connect to it.

> I must admit, I don't know much java - can you use "strace" to track system
> calls, or is there a similar utility that would let you see what files it is
> searching for?

strace revealed nothing really that could explain this behaviour.

Thanks a lot for all the assistance btw, I really appreciate it.

Hope you have some more ideas to help out.