Обсуждение: java.lang.ExceptionInInitializerError at driver load attempt.
This short Java Class: import java.sql.*; public class TestIt { static public void main (String args[]) { try { // Load the driver here ... Class.forName ("org.postgresql.Driver"); } catch (Exception e) { System.out.println ("Yep, got an exception."); e.printStackTrace(); return; } } } give this Java stack trace (at the Class.forName call): java.lang.ExceptionInInitializerError: [exception was kaffe.util.NotImplemented: java.lang.Runtime.addShutdownHook()] at java.lang.Class.forName(Class.java:native) at java.lang.Class.forName(Class.java:52) at TestIt.main(TestIt.java:9) kaffe.util.NotImplemented: java.lang.Runtime.addShutdownHook() at java.lang.Throwable.fillInStackTrace(Throwable.java:native) at java.lang.Throwable.<init>(Throwable.java:38) at java.lang.Error.<init>(Error.java:21) at kaffe.util.NotImplemented.<init>(NotImplemented.java:22) at java.lang.Runtime.addShutdownHook(Runtime.java:163) at org.postgresql.core.ConnectionHook.<init>(ConnectionHook.java:54) at org.postgresql.core.ConnectionHook.<clinit>(ConnectionHook.java:41) at java.lang.Class.forName(Class.java:native) at java.lang.Class.forName(Class.java:52) at TestIt.main(TestIt.java:9) Any idea what is going on here? The postmaster was started with pg_ctl start -l logfile -o "-i". I have the Java J2SE (Java 2) jdk 1.3.1_02 installed in /usr/java. I am using the RedHat 7.2 supplied precompiled driver which is installed in the /usr/share/pgsql/jdbc7.1-1.2.jar file. My system is a AMD k6-2 550MHz. Has anyone ever seen this error before? Thanks.
Hello, Can you please check which javac you're using? You can check this with 'which javac'. This will probably say /usr/bin/javacwhich is a part of the kaffe rpm in redhat 7.2. Kaffe is an open source implementation of a java virtual machineand class libraries (http://www.kaffe.org) and is't completely finished yet. You can remove this kaffe package with'rpm -e kaffe' if you only want to use the sun jdk or you can use the full path to the javac of the sun jdk or maybeyou can change the path to /usr/java/bin/:${PATH}. Kind regards, Dries On Fri, 18 Jan 2002 00:20:58 -0600 Name <craig@isp01.net> wrote: > This short Java Class: > import java.sql.*; > public class TestIt > { > static public void main (String args[]) > { > try { > // Load the driver here ... > Class.forName ("org.postgresql.Driver"); > } > catch (Exception e) { > System.out.println ("Yep, got an exception."); > e.printStackTrace(); > return; > } > } > } > give this Java stack trace (at the Class.forName call): > java.lang.ExceptionInInitializerError: [exception was > kaffe.util.NotImplemented: java.lang.Runtime.addShutdownHook()] > at java.lang.Class.forName(Class.java:native) > at java.lang.Class.forName(Class.java:52) > at TestIt.main(TestIt.java:9) > kaffe.util.NotImplemented: java.lang.Runtime.addShutdownHook() > at java.lang.Throwable.fillInStackTrace(Throwable.java:native) > at java.lang.Throwable.<init>(Throwable.java:38) > at java.lang.Error.<init>(Error.java:21) > at kaffe.util.NotImplemented.<init>(NotImplemented.java:22) > at java.lang.Runtime.addShutdownHook(Runtime.java:163) > at org.postgresql.core.ConnectionHook.<init>(ConnectionHook.java:54) > at org.postgresql.core.ConnectionHook.<clinit>(ConnectionHook.java:41) > at java.lang.Class.forName(Class.java:native) > at java.lang.Class.forName(Class.java:52) > at TestIt.main(TestIt.java:9) > Any idea what is going on here? The postmaster was started with pg_ctl start > -l logfile -o "-i". > I have the Java J2SE (Java 2) jdk 1.3.1_02 installed in /usr/java. > I am using the RedHat 7.2 supplied precompiled driver which is installed in > the /usr/share/pgsql/jdbc7.1-1.2.jar file. > My system is a AMD k6-2 550MHz. > Has anyone ever seen this error before? > Thanks. > ---------------------------(end of broadcast)--------------------------- > TIP 5: Have you checked our extensive FAQ? > http://www.postgresql.org/users-lounge/docs/faq.html --
Thank you Dries. Yes, I was using the /usr/bin/java and /usr/bin/javac. I didn't know I even had such in my /usr/bin directory. After using the "correct" /usr/java/.../bin/java and javac everything works fine. I guess I had better get my /usr/java/bin in front of my /usr/bin in the PATH env variable. That explains why we were seeing the references to kaffe in the stack trace. Once again, thanks much. > Hello, > > Can you please check which javac you're using? You can check this with > 'which javac'. This will probably say /usr/bin/javac which is a part of the > kaffe rpm in redhat 7.2. Kaffe is an open source implementation of a java > virtual machine and class libraries (http://www.kaffe.org) and is't > completely finished yet. You can remove this kaffe package with 'rpm -e > kaffe' if you only want to use the sun jdk or you can use the full path to > the javac of the sun jdk or maybe you can change the path to > /usr/java/bin/:${PATH}. > > Kind regards, > Dries > > > > On Fri, 18 Jan 2002 00:20:58 -0600 > > Name <craig@isp01.net> wrote: > > This short Java Class: > > > > import java.sql.*; > > > > public class TestIt > > { > > static public void main (String args[]) > > { > > try { > > // Load the driver here ... > > Class.forName ("org.postgresql.Driver"); > > } > > catch (Exception e) { > > System.out.println ("Yep, got an exception."); > > e.printStackTrace(); > > return; > > } > > } > > } > > > > give this Java stack trace (at the Class.forName call): > > > > java.lang.ExceptionInInitializerError: [exception was > > kaffe.util.NotImplemented: java.lang.Runtime.addShutdownHook()] > > at java.lang.Class.forName(Class.java:native) > > at java.lang.Class.forName(Class.java:52) > > at TestIt.main(TestIt.java:9) > > kaffe.util.NotImplemented: java.lang.Runtime.addShutdownHook() > > at java.lang.Throwable.fillInStackTrace(Throwable.java:native) > > at java.lang.Throwable.<init>(Throwable.java:38) > > at java.lang.Error.<init>(Error.java:21) > > at kaffe.util.NotImplemented.<init>(NotImplemented.java:22) > > at java.lang.Runtime.addShutdownHook(Runtime.java:163) > > at org.postgresql.core.ConnectionHook.<init>(ConnectionHook.java:54) > > at org.postgresql.core.ConnectionHook.<clinit>(ConnectionHook.java:41) > > at java.lang.Class.forName(Class.java:native) > > at java.lang.Class.forName(Class.java:52) > > at TestIt.main(TestIt.java:9) > > > > Any idea what is going on here? The postmaster was started with pg_ctl > > start -l logfile -o "-i". > > > > I have the Java J2SE (Java 2) jdk 1.3.1_02 installed in /usr/java. > > I am using the RedHat 7.2 supplied precompiled driver which is installed > > in the /usr/share/pgsql/jdbc7.1-1.2.jar file. > > > > My system is a AMD k6-2 550MHz. > > > > Has anyone ever seen this error before? > > > > Thanks. > > > > ---------------------------(end of broadcast)--------------------------- > > TIP 5: Have you checked our extensive FAQ? > > > > http://www.postgresql.org/users-lounge/docs/faq.html