Question: How can I fix this error in my java code? This is the error output: org.apache.jasper.JasperException: An exception occurred processing [listCustomers.jsp] at line [17]14: 15:

How can I fix this error in my java code?

This is the error output:

org.apache.jasper.JasperException: An exception occurred processing [listCustomers.jsp] at line [17]14:     <%@ include file="header.html"%>15:     

List of Participating Companies

16: 17: 18: select * from customer19: order by cus_lname20: Stacktrace: org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:607) org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:481) org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386) org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330) javax.servlet.http.HttpServlet.service(HttpServlet.java:741) org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

javax.servlet.ServletException: javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection"        org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:667)        org.apache.jsp.listCustomers_jsp._jspService(listCustomers_jsp.java:190)        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)        javax.servlet.http.HttpServlet.service(HttpServlet.java:741)        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:458)        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)        javax.servlet.http.HttpServlet.service(HttpServlet.java:741)        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

Root Cause

javax.servlet.jsp.JspException: Unable to get connection, DataSource invalid: "java.sql.SQLRecoverableException: IO Error: The Network Adapter could not establish the connection"        org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.getConnection(QueryTagSupport.java:285)        org.apache.taglibs.standard.tag.common.sql.QueryTagSupport.doStartTag(QueryTagSupport.java:168)        org.apache.jsp.listCustomers_jsp._jspx_meth_sql_005fquery_005f0(listCustomers_jsp.java:214)        org.apache.jsp.listCustomers_jsp._jspService(listCustomers_jsp.java:158)        org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)        javax.servlet.http.HttpServlet.service(HttpServlet.java:741)        org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:458)        org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:386)        org.apache.jasper.servlet.JspServlet.service(JspServlet.java:330)        javax.servlet.http.HttpServlet.service(HttpServlet.java:741)        org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)

------------------------------------------------------------------------------------------------------

Here is my Code:

listCustomers.jsp

<%@ page language="java" contentType="text/html;charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

List of Participating Companies

<%@ include file="header.html"%>

List of Participating Companies

select * from customer

order by cus_lname

First NameLast NameEmailPhone Number
${customer.cus_fname}${customer.cus_lname}${customer.cus_email}${customer.cus_phone}

----------------------------------------------------------------------------------------------------------------------

DataBaseListener.java

<%@ page language="java" contentType="text/html;charset=ISO-8859-1"

pageEncoding="ISO-8859-1"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>

<%@ taglib uri="http://java.sun.com/jsp/jstl/sql" prefix="sql" %>

List of Participating Companies

<%@ include file="header.html"%>

List of Participating Companies

select * from customer

order by cus_lname

First NameLast NameEmailPhone Number
${customer.cus_fname}${customer.cus_lname}${customer.cus_email}${customer.cus_phone}

Step by Step Solution

3.40 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

ANSWER The error message you provided indicates that there is a problem with establishing a database connection in your Java code Specifically the err... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!