Thread: JSP pages don't work with database after postgres downgrade
I recently had to downgrade a version of postgres on a devleopment box from 7.3.2 to 7.2.2 to bring it in line with a production server. I reinstalled postgres, postgres-server and postgres-jdbc. Now when I try to run pages from a web application written in JSP using apache/tomcat they don't work. By "don't work" I specifically mean that the 1st page is one where the user's username and password are checked against a table in the database. This is coming back with a logon failed message even though I know that the username and password are correct. So I am assuming that the JSP pages are having trouble connecting to the database. Does anyone know how I can go about debugging this to find the root of the problem? Regards, Phill
"Phill Edwards" <philledwards@gmail.com> writes: > I recently had to downgrade a version of postgres on a devleopment box > from 7.3.2 to 7.2.2 to bring it in line with a production server. If you are working for someone who is running 7.2.2 as a production server, my recommendation is to resign immediately. 7.3.2 is not a lot better, but 7.2.2? It is way past time to force-feed them a clue ... mere inability-to-login problems are *not* what I'm worried about. regards, tom lane
Phill Edwards wrote: >I recently had to downgrade a version of postgres on a devleopment box >from 7.3.2 to 7.2.2 to bring it in line with a production server. I >reinstalled postgres, postgres-server and postgres-jdbc. Now when I >try to run pages from a web application written in JSP using >apache/tomcat they don't work. > >By "don't work" I specifically mean that the 1st page is one where the >user's username and password are checked against a table in the >database. This is coming back with a logon failed message even though >I know that the username and password are correct. So I am assuming >that the JSP pages are having trouble connecting to the database. > > > To help you, we would need to know a) if you can run a very simple jsp test to ensure that database connectivity is occuring (i.e. can you pull and display a record) and b) if you are using an cryptography (like MD5) in your password checks. >Does anyone know how I can go about debugging this to find the root of >the problem? > > You can set the debug level up on PostgreSQL. This is done by modifying the startup script. Best Wishes, Chris Travers Metatron Technology Consulting
Attachment
> To help you, we would need to know a) if you can run a very simple jsp > test to ensure that database connectivity is occuring (i.e. can you pull > and display a record) and b) if you are using an cryptography (like MD5) > in your password checks. The user logon screen is a simple jsp script - all it does it check the username and password against some values in a table. There is no cryptography involved. Is there a simple test page somewhere for JSP/Postgres that I could use to try to track down the cause of this? Regards, Phill
Phill Edwards wrote: >>To help you, we would need to know a) if you can run a very simple jsp >>test to ensure that database connectivity is occuring (i.e. can you pull >>and display a record) and b) if you are using an cryptography (like MD5) >>in your password checks. > > > The user logon screen is a simple jsp script - all it does it check > the username and password against some values in a table. There is no > cryptography involved. > > Is there a simple test page somewhere for JSP/Postgres that I could > use to try to track down the cause of this? Check your postgresql logs firstly. -- Postgresql & php tutorials http://www.designmagick.com/
> Check your postgresql logs firstly. Nothing's showing up in the logs. I can see that postgres has successfully started in syslog when I restart it. I'm not getting anything at all being written to /var/log/postgresql even though debug_level = 4 in /var/lib/pgsql/data/postgresql.conf Does this mean that tomcat isn't even getting into the database? Regards, Phill
> > Check your postgresql logs firstly. > > Nothing's showing up in the logs. I can see that postgres has > successfully started in syslog when I restart it. I'm not getting > anything at all being written to /var/log/postgresql even though > debug_level = 4 in /var/lib/pgsql/data/postgresql.conf > > Does this mean that tomcat isn't even getting into the database? I can see these errors in /usr/local/tomcat/logs/catalina.out: Unable to instantiate DB connection pool. Technical error message: java.lang.NullPointerException A null connection was relinquished. Does that shed any more light on the matter? Regards, Phill
Phill Edwards wrote: > I can see these errors in /usr/local/tomcat/logs/catalina.out: > > Unable to instantiate DB connection pool. > Technical error message: > java.lang.NullPointerException > A null connection was relinquished. > > Does that shed any more light on the matter? Err, yes. As the message suggests, your Tomcat server cannot create the connection pool which it makes available to the web applications it runs. You need to check $CATALINA_HOME/conf/Catalina/localhost/${your-app-name}.xml or the deployment descriptor in the application codebase at /META-INF/server.xml (both of these paths are from memory). In there you should find a <Resource>...</Resource> element with the connection parameters, including username, password and the JDBC driver class. You should check that the Driver classname is correct for the JDBC jar you're using.