Author Topic: Errors in dbsrver VM when loaddb_postgres.sh is executed  (Read 806 times)

Miles

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +0/-0
Errors in dbsrver VM when loaddb_postgres.sh is executed
« on: May 31, 2017, 04:37:30 AM »
I have put postgresql-9.2-1004.jdbc4.jar in /opt and follow Example VM Setup Guide V1.03 and find some errors as below.

[root@dbserver other_scripts]# ./loaddb_postgres.sh
Script started Wed May 31 15:28:28 CST 2017
sleep 10
Starting Database Load
Loading database with orders_injection_rate = 500
Loading database with numThreads  = 4
Loading Databases ...
INFO : IR supplied : 500
INFO : stepped IR  : 500
java.lang.ClassNotFoundException: org.postgresql.Driver
   at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
   at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
   at java.security.AccessController.doPrivileged(Native Method)
   at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
   at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
   at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
   at java.lang.Class.forName0(Native Method)
   at java.lang.Class.forName(Class.java:190)
   at org.spec.jappserver.load.DatabaseConnection.getConnection(DatabaseConnection.java:201)
   at org.spec.jappserver.load.LoadCorp.main(LoadCorp.java:114)
   at org.spec.jappserver.load.LoadAll.main(LoadAll.java:51)
Exception in thread "main" java.lang.RuntimeException: Failed to load Corp domain properlyorg.postgresql.Driver
   at org.spec.jappserver.load.LoadAll.main(LoadAll.java:55)
Ignoring read() errors...
Ignoring read() errors...
Ignoring read() errors...
Launcher: done waiting.
Finished Database Load
Script ended Wed May 31 15:28:38 CST 2017

Does it mean that I miss any package?

abond

  • Moderator
  • Newbie
  • *****
  • Posts: 30
  • Karma: +5/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #1 on: May 31, 2017, 11:47:07 AM »
Have you verified that the database is up and accessible?  You could try to connect to it via a standalone client utility like psql. 

AnoopGupta

  • Moderator
  • Jr. Member
  • *****
  • Posts: 60
  • Karma: +0/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #2 on: June 06, 2017, 06:50:35 PM »
Hello Miles,

ClassNotFound exception suggests that the loader is unable to locate the jdbc jar file you have under /opt.

Please check your jdbc jar name and location specified in /opt/SPECjAppServer2004/config/glassfish.env and update it to point to your /opt/postgresql-9.2-1004.jdbc4.jar

If you continue to see this issue, please attach your glassfish.env file, as well as output of the following command:
jar -tvf /opt/postgresql-9.2-1004.jdbc4.jar | grep postgresql | grep Driver


Miles

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #3 on: June 13, 2017, 01:58:27 AM »
Hi abond
I connect to specdb on the DBServer from the AppServer using psql -h specdb -U spec -d specdb:

[root@appserver bin]# psql -h specdb -U spec -d specdb
psql: could not connect to server: Connection refused
   Is the server running on host "specdb" (10.10.1.5) and accepting
   TCP/IP connections on port 5432?

Hi AnoopGupta
I have attached my glassfish.env file.
The result returned by typing the command is as below: 

[root@dbserver Desktop]# jar -tvf /opt/postgresql-9.2-1004-jdbc4.jar | grep postgresql | grep Driver
   769 Fri Nov 01 13:40:46 CST 2013 org/postgresql/Driver$1.class
  2790 Fri Nov 01 13:40:46 CST 2013 org/postgresql/Driver$ConnectThread.class
 15877 Fri Nov 01 13:40:46 CST 2013 org/postgresql/Driver.class
  1093 Fri Nov 01 13:40:52 CST 2013 org/postgresql/util/PSQLDriverVersion.class
[root@dbserver Desktop]#

Thanks for both of your help!

abond

  • Moderator
  • Newbie
  • *****
  • Posts: 30
  • Karma: +5/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #4 on: June 20, 2017, 10:33:35 AM »
Hey Miles,

Is this issue still a problem for you? 

If so, can you log into the postgresql database using psql on the dbserver itself?  If so, have you tried disabling the firewall on the dbserver and retrying your psql database connection from the appserver?

Thanks,
Andy

AnoopGupta

  • Moderator
  • Jr. Member
  • *****
  • Posts: 60
  • Karma: +0/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #5 on: June 20, 2017, 12:40:56 PM »
Hi Miles,

As I said in my previous post, please set JDBC_CLASSPATH=/opt/postgresql-9.2-1004.jdbc4.jar in your glassfish.env to fix ClassNotFoundException.

You will still need to look into whether postgresql is up and running and that you can connect to it using psql from DBServer and AppServer. Please follow Andy's suggestion.

Thanks,
Anoop
 

Miles

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #6 on: June 29, 2017, 01:14:06 AM »
Hi
I have set JDBC_CLASSPATH=/opt/postgresql-9.2-1004.jdbc4.jar in my glassfish.env
and use command "service postgresql status" to check "postmaster (pid 2287) is running...".
The issue still happens.

Thanks.

abond

  • Moderator
  • Newbie
  • *****
  • Posts: 30
  • Karma: +5/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #7 on: June 29, 2017, 02:44:20 PM »
Hey Miles,

I am sorry to hear you are still having trouble getting the database connections to work. 

Do you still get an error when you try to execute the "psql -h specdb -U spec -d specdb" command from the appserver?  Have you had a chance to try the command "psql -Uspec -d specdb" from the dbserver itself?  The goal here is to verify whether the database is accessible locally and just the remote connections to the database are failing. 

Thanks,
Andy

AnoopGupta

  • Moderator
  • Jr. Member
  • *****
  • Posts: 60
  • Karma: +0/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #8 on: July 06, 2017, 12:56:23 PM »
Please respond to what Andy has asked. In addition, I noticed a typo:

You have set JDBC_CLASSPATH=/opt/postgresql-9.2-1004.jdbc4.jar, however when you ran the jar tvf command, your jar file was /opt/postgresql-9.2-1004-jdbc4.jar

There is a difference of . vs - between 1004 and jdbc4

Miles

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #9 on: July 06, 2017, 10:44:10 PM »
Hi
I have replaced "postgresql-9.2.1004.jdbc4.jar" with "postgresql-9.2-1004.jdbc4.jar".
I am so careless.
Thank you so much!

from appserver:
[root@appserver bin]# psql -h specdb -U spec -d specdb
psql: could not connect to server: Connection refused
   Is the server running on host "specdb" (10.10.1.5) and accepting
   TCP/IP connections on port 5432?

from dbserver:
[root@dbserver Desktop]# psql -U spec -d specdb
psql: FATAL:  Ident authentication failed for user "spec"

./loaddb_postgres.sh
[root@dbserver other_scripts]# ./loaddb_postgres.sh
Script started Fri Jul 7 10:36:25 CST 2017
sleep 10
Starting Database Load
Loading database with orders_injection_rate = 500
Loading database with numThreads  = 4
Loading Databases ...
INFO : IR supplied : 500
INFO : stepped IR  : 500
org.postgresql.util.PSQLException: Connection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:207)
   at org.postgresql.core.ConnectionFactory.openConnection(ConnectionFactory.java:64)
   at org.postgresql.jdbc2.AbstractJdbc2Connection.<init>(AbstractJdbc2Connection.java:136)
   at org.postgresql.jdbc3.AbstractJdbc3Connection.<init>(AbstractJdbc3Connection.java:29)
   at org.postgresql.jdbc3g.AbstractJdbc3gConnection.<init>(AbstractJdbc3gConnection.java:21)
   at org.postgresql.jdbc4.AbstractJdbc4Connection.<init>(AbstractJdbc4Connection.java:31)
   at org.postgresql.jdbc4.Jdbc4Connection.<init>(Jdbc4Connection.java:24)
   at org.postgresql.Driver.makeConnection(Driver.java:397)
   at org.postgresql.Driver.connect(Driver.java:267)
   at java.sql.DriverManager.getConnection(DriverManager.java:571)
   at java.sql.DriverManager.getConnection(DriverManager.java:215)
   at org.spec.jappserver.load.DatabaseConnection.getConnection(DatabaseConnection.java:212)
   at org.spec.jappserver.load.LoadCorp.main(LoadCorp.java:114)
   at org.spec.jappserver.load.LoadAll.main(LoadAll.java:51)
Caused by: java.net.ConnectException: Connection refused
   at java.net.PlainSocketImpl.socketConnect(Native Method)
   at java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSocketImpl.java:339)
   at java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPlainSocketImpl.java:200)
   at java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocketImpl.java:182)
   at java.net.SocksSocketImpl.connect(SocksSocketImpl.java:392)
   at java.net.Socket.connect(Socket.java:579)
   at java.net.Socket.connect(Socket.java:528)
   at org.postgresql.core.PGStream.<init>(PGStream.java:60)
   at org.postgresql.core.v3.ConnectionFactoryImpl.openConnectionImpl(ConnectionFactoryImpl.java:101)
   ... 13 more
Exception in thread "main" java.lang.RuntimeException: Failed to load Corp domain properlyConnection refused. Check that the hostname and port are correct and that the postmaster is accepting TCP/IP connections.
   at org.spec.jappserver.load.LoadAll.main(LoadAll.java:55)
Ignoring read() errors...
Ignoring read() errors...
Ignoring read() errors...
Launcher: done waiting.
Finished Database Load
Script ended Fri Jul 7 10:36:36 CST 2017




lroderic

  • Moderator
  • Full Member
  • *****
  • Posts: 134
  • Karma: +6/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #10 on: July 10, 2017, 05:05:19 PM »
Hi Miles.

Going through the checklist here....

Is the firewall turned off? Andy asked but I don't think you confirmed. Is SELINUX off?

Lisa

Miles

  • Jr. Member
  • **
  • Posts: 63
  • Karma: +0/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #11 on: July 10, 2017, 11:15:54 PM »
Hi Andy
Sorry, I didn't reply your question.
Both firewall and SELINUX are turned off.

Another problem is
"http://specdelivery:8000/Supplier/DeliveryServlet?cmd=switchlog"
 returned "HTTP Status 404" from my appserver, but it was successful to
 execute "ant -f build_glassfish.xml".

Thanks.
« Last Edit: July 10, 2017, 11:36:03 PM by Miles »

lroderic

  • Moderator
  • Full Member
  • *****
  • Posts: 134
  • Karma: +6/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #12 on: July 11, 2017, 01:53:34 PM »
Hey Miles,

I'm reproducing the example VM environment for db/appserver, and I've found mistakes in the documentation (that I helped write and recently updated thinking it was finished for good).  :-[ I'm sorry to hear this is still a problem, and I'm working on it.

Thanks for your patience.

Lisa

lroderic

  • Moderator
  • Full Member
  • *****
  • Posts: 134
  • Karma: +6/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #13 on: July 11, 2017, 05:29:09 PM »
Please make sure you have the link for the JDBC driver. Issue this command:

# ls -l /opt/SPECjAppServer2004/jdbc/postgresql.jar

You should see this:

lrwxrwxrwx 1 root root 34 Jul 11 18:39 /opt/SPECjAppServer2004/jdbc/postgresql.jar -> /opt/postgresql-9.2-1004.jdbc4.jar


Lastly, make sure there's only one instance of the following parameters in /etc/sysctl.conf:

kernel.sem = 500 64000 400 512
kernel.shmmax = 137438953472
kernel.shmmni = 11118096
kernel.shmall = 8294967296

I found that running the makeme_dbserver.sh script more than once messes these up. Do you see any PostgreSQL errors at the end of /var/log/messages?

Lisa

lroderic

  • Moderator
  • Full Member
  • *****
  • Posts: 134
  • Karma: +6/-0
Re: Errors in dbsrver VM when loaddb_postgres.sh is executed
« Reply #14 on: July 11, 2017, 05:48:11 PM »
I think I found it - make sure specdb is set correctly in /etc/hosts. The makeme_exampleVM.sh script adds example VM names and addresses, and for dbserver it adds:

10.10.1.5       dbserver1-int specdb

You can use either the internal or external address for dbserver, but just make sure it's in there. Give that a try and let us know.

Lisa