java.sql.SQLException: Before start of result set, org.apache.jasper.JasperException: : Tech Guru India java.sql.SQLException: Before start of result set, org.apache.jasper.JasperException: :: Tech Guru India

java.sql.SQLException: Before start of result set, org.apache.jasper.JasperException:




org.apache.jasper.JasperException: An exception occurred processing JSP page /admin-message.jsp at line 73

Stacktrace:
 org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:505)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:398)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)

javax.servlet.ServletException: java.sql.SQLException: Before start of result set
 org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
 org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
 org.apache.jsp.admin_002dmessage_jsp._jspService(admin_002dmessage_jsp.java:175)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)


root cause 

java.sql.SQLException: Before start of result set
 com.mysql.jdbc.SQLError.createSQLException(SQLError.java:910)
 com.mysql.jdbc.ResultSet.checkRowPos(ResultSet.java:692)
 com.mysql.jdbc.ResultSet.getStringInternal(ResultSet.java:5476)
 com.mysql.jdbc.ResultSet.getString(ResultSet.java:5420)
 com.mysql.jdbc.ResultSet.getString(ResultSet.java:5436)
 org.apache.jsp.admin_002dmessage_jsp._jspService(admin_002dmessage_jsp.java:132)
 org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:374)
 org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:342)
 org.apache.jasper.servlet.JspServlet.service(JspServlet.java:267)
 javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
 org.netbeans.modules.web.monitor.server.MonitorFilter.doFilter(MonitorFilter.java:390)




Solution:

This Error generally occurs when you try to fetch record without initializing the record set.

For example,
rs is your record set
statement is you statement bind with connection.

You write,
rs = statement.executeQuery("some query")

out.print(rs.getString("column name"));

This will give error!

Use rs.next(); before you print any field.

if you have used rs.last() to count rows,
use, rs.beforeFirst();
and then rs.next();

Cheers,
Kiran Patel!


We will send you more information, Enter your email address:


Related Posts with Thumbnails

Share/Save/Bookmark

0 comments:

Post a Comment