Problem with "/etc/alternatives/java" and "pg74.215.jdbc3.jar".

Joel rees at ddcom.co.jp
Thu Feb 24 01:55:21 UTC 2005


> I'm trying to connect to a postgresql database through the postgresql 
> jdbc driver, but appears the errors below:
> 
> "$ java TesteJDBC_PGSQL
> libgcj-java-placeholder.sh
> 
> This script is a placeholder for the /usr/bin/java
> master link required by jpackage.org conventions.  libgcj's
> rmiregistry, rmic and jar tools are now slave symlinks to these
> masters, and are managed by the alternatives(8) system.

I discovered this the hard way, too.

> This change was necessary because the rmiregistry, rmic and jar tools
> installed by previous versions of libgcj conflicted with symlinks
> installed by jpackage.org JVM packages.
> Iniciando a conexao com o BD...
> Exception in thread "main" java.lang.NoClassDefFoundError: while 
> resolving class: org.postgresql.Driver
>     at java.lang.VMClassLoader.resolveClass(java.lang.Class) 
> (/usr/lib/libgcj.so.5.0.0)
>     at java.lang.Class.initializeClass() (/usr/lib/libgcj.so.5.0.0)
>     at java.lang.Class.forName(java.lang.String, boolean, 
> java.lang.ClassLoader) (/usr/lib/libgcj.so.5.0.0)
>     at java.lang.Class.forName(java.lang.String) (/usr/lib/libgcj.so.5.0.0)
>     at TesteJDBC_PGSQL.Conecta() (Unknown Source)
>     at TesteJDBC_PGSQL.main(java.lang.String[]) (Unknown Source)
> Caused by: java.lang.ClassNotFoundException: javax.net.ssl.SSLSocket not 
> found in [file:/usr/share/java/pg74.215.jdbc3.jar, file:./, core:/]
> "
> 
> "...
> public static Connection Conecta()
>    {
> 
>      String url= "jdbc:postgresql:mydb";
>      Connection con;
>      try
>      {
>          System.out.println("Iniciando a conexao com o BD...");
> 
>          Class.forName("org.postgresql.Driver");
>          con = DriverManager.getConnection (url,"","");
> 
>          System.out.println("Banco de Dados Ok e Pronto...");
>          return con;
>          }
> 
>          catch(ClassNotFoundException fnf)
>          {
>          System.out.println("Houve uma ClassNotFoundException: "+fnf);
>          return null;
>          }
>          catch(SQLException sql)
>          {
>          System.out.println("Houve uma SQLException: "+sql);
>          return null;
>          }
>    }
> ..."
> 
> My login has permission to create databases and users and I have created 
> a database called mydb. I can use the command 'psql' with this database. 
> I did set TCP/IP to true in /var/lib/pgsql/data/postgresql.conf, too.
> 
> I'm using the followed configuration:
> kernel-2.6.10-1.766_FC3
> kernel-utils-2.4-13.1.49_FC3
> postgresql-7.4.7-3.FC3.1
> postgresql-jdbc-7.4.7-3.FC3.1
> postgresql-libs-7.4.7-3.FC3.1
> postgresql-server-7.4.7-3.FC3.1
> gcc-java-3.4.2-6.fc3
> 
> Does this problem due the libgcj, please?

Likely to be due in part to libgcj.

> Should I remove the gcc-java and install other java, please?

I have been told that if I don't want to use the gnu compiler, I should
remove the links. I have not been told how to find all the links that
need to be replaced. Since I don't see the expected configuration
information in the alternatives configurations, I have no idea what
links need to be replaced.

I have not been told why they are there.

I just put my own install of Java up in $PATH ahead of /usr/bin -- Put
scripts called java.sh and java.csh in /etc/profile.d , containing the
appropriate export and setenv commands, something like

    if ! echo ${PATH} | grep -q ${JAVA_HOME}/bin ; then
        export PATH=${JAVA_HOME}/bin:${PATH}
    fi

plus other appropriate stuff in java.sh. But testing the path was
probably more work than necessary.

I'm sure I'll sometime find some link in one of the lib directories
biting me, however.

> 
> TIA,
> Vinicius.
> 
> P.S.: Does this mailing list the best place to put this type of problem?

Apparently not. I'm not sure where would be better, however.

--
Joel Rees   <rees at ddcom.co.jp>
digitcom, inc.   株式会社デジコム
Kobe, Japan   +81-78-672-8800
** <http://www.ddcom.co.jp> **




More information about the fedora-list mailing list