Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

conn null #12

Open
Irshu786 opened this issue Aug 26, 2023 · 1 comment
Open

conn null #12

Irshu786 opened this issue Aug 26, 2023 · 1 comment

Comments

@Irshu786
Copy link

org.apache.jasper.JasperException: An exception occurred processing [/index.jsp] at line [47]

44: products = prodDao.getAllProductsByType(type);
45: message = "Showing Results for '" + type + "'";
46: } else {
47: products = prodDao.getAllProducts();
48: }
49: if (products.isEmpty()) {
50: message = "No items found for the search '" + (search != null ? search : type) + "'";

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:599)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:488)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
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.Connection.prepareStatement(String)" because "con" is null
com.shashi.service.impl.ProductServiceImpl.getAllProducts(ProductServiceImpl.java:196)
org.apache.jsp.index_jsp._jspService(index_jsp.java:183)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:456)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:658)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)

Note The full stack trace of the root cause is available in the server logs.

Even though mysql is running fine, it still says conn is null.

@KunalShirsat
Copy link

KunalShirsat commented Oct 15, 2023

you are facing this issue on local or on cloud.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants