Re: JDBC issue

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

Re: JDBC issue

От:
Stephen Davies <sdavies@sdc.com.au>
Дата:
On 12/7/26 16:43, Christophe Pettus wrote:
> 
> 
>> On Jul 12, 2026, at 00:01, Stephen Davies  wrote:
>>
>> I have several JDBC-based programs on my Rocky Linux 9.8 box.
>> Postgresql 17.10 and JDBC 42.7.2.
>> As of today, these programs all fail because the JDBC connections do not work and the following code example produces no output except:
>>
>> "org.apache.jasper.JasperException: An exception occurred processing [/jsp/browsewineries.jsp] at line [48] st1 is null".
> 
> 
> Look at catalina.out (or journalctl -u tomcat) for the e.printStackTrace() output; that should get you the real exception.  You can also check the PostgreSQL logs to see if it even made it to opening the connection.
> 
> 
Stacktrace:
	org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:570)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:456)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:350)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:301)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

Root Cause

java.lang.NullPointerException: Cannot invoke 
"java.sql.Statement.executeQuery(String)" because "st1" is null
	org.apache.jsp.jsp.browsewineries_jsp._jspService(browsewineries_jsp.java:171)
	org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:62)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
	org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:428)
	org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:350)
	org.apache.jasper.servlet.JspServlet.service(JspServlet.java:301)
	jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

Tells me nothing more.
The code has to go past the connection and statement lines to get to the 
query line.
This code has been working for several years before today.
psql access to the same databases still works.


Re: JDBC issue

От:
Stephen Davies <sdavies@sdc.com.au>
Дата:
I restarted postgresql with logging and now get:

Connection failed.
Caused by: java.net.SocketTimeoutException: Connect timed out

This explains the long delay between hitting Search and seeing the error 
screen but does not explain why the connection is timing out.




Re: JDBC issue

От:
Stephen Davies <sdavies@sdc.com.au>
Дата:
Sorry. Problem solved.
It was the firewall on the postgresql server box.
It gets updated daily and must somehow have led to this issue.

Apologies again for wasting space.


Re: JDBC issue

От:
shammat@gmx.net
Дата:
Am 12.07.26 um 09:40 schrieb Stephen Davies:
> Root Cause
> 
> java.lang.NullPointerException: Cannot invoke "java.sql.Statement.executeQuery(String)" because "st1" is null
>      org.apache.jsp.jsp.browsewineries_jsp._jspService(browsewineries_jsp.java:171)
>      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:62)
> 
> Tells me nothing more.
> The code has to go past the connection and statement lines to get to the query line.
> This code has been working for several years before today.
There is a variable named "st1" in the servlet code which is NULL.

This is not a Postgres error, but an error in your code.

You need to check how st1 is populated in the Java code.

If I had to guess: the code retrieves data from the database and receives a NULL
value that it does not expect and thus not check.




FAQ