- This topic has 1 reply, 1 voice, and was last updated 18 years, 2 months ago by vamsi_t.
-
AuthorPosts
-
vamsi_tMemberthe following error occured during execution
Please somebody help me.
———————————————————————————————————–
description The server encountered an internal error () that prevented it from fulfilling this request.
exception
org.apache.jasper.JasperException: could not execute query
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:358)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)root cause
org.hibernate.exception.SQLGrammarException: could not execute query
org.hibernate.exception.ErrorCodeConverter.convert(ErrorCodeConverter.java:70)
org.hibernate.exception.JDBCExceptionHelper.convert(JDBCExceptionHelper.java:43)
org.hibernate.loader.Loader.doList(Loader.java:1596)
org.hibernate.loader.Loader.list(Loader.java:1577)
org.hibernate.loader.hql.QueryLoader.list(QueryLoader.java:395)
org.hibernate.hql.ast.QueryTranslatorImpl.list(QueryTranslatorImpl.java:271)
org.hibernate.impl.SessionImpl.list(SessionImpl.java:844)
org.hibernate.impl.QueryImpl.list(QueryImpl.java:74)
org.apache.jsp.Emplist_jsp._jspService(Emplist_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:133)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:311)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:301)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:248)
javax.servlet.http.HttpServlet.service(HttpServlet.java:856)note The full stack trace of the root cause is available in the Tomcat logs.
———————————————————————————————————–
Actual coding is
——————<%@ page language=”java” import=”java.util.*” pageEncoding=”UTF-8″%>
<%@ page language=”java” import=”org.mysql.*” %>
<%@ page language=”java” import=”org.hibernate.*” %>
<%@ page language=”java” import=”org.hibernate.cfg.*” %>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+”://”+request.getServerName()+”:”+request.getServerPort()+path+”/”;
%><!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN”>
<html>
<head>
<base href=”<%=basePath%>”><title>My JSP ‘Employeelist.jsp’ starting page</title>
<meta http-equiv=”pragma” content=”no-cache”>
<meta http-equiv=”cache-control” content=”no-cache”>
<meta http-equiv=”expires” content=”0″>
<meta http-equiv=”keywords” content=”keyword1,keyword2,keyword3″>
<meta http-equiv=”description” content=”This is my page”><!–
<link rel=”stylesheet” type=”text/css” href=”styles.css”>
–>
</head><body>
<%
String vhql=”from Employee order by name “;
Session sess=FirstSessionFactory.currentSession();
Query qry=sess.createQuery(vhql);
List emplist=qry.list();
Object ea[]=emplist.toArray();
out.print(“<html><head><title>Employee List</title></head>”);
out.println(“<body>”);
out.println(“<table cellpadding=5 cellspacing=0 align=center style=’font-family:arial;font-size:13px;’>”);
out.println(“<tr bgcolor=#dddddd><th>Employee Id</th><th> Employee Name</th><th>Employee Salary</th></tr>”);
for (int i=0;i<ea.length;i++){
Employee e=(Employee)ea[i];
if(i%2==0)
out.print(“<tr bgcolor=#EEFFEE>”);
else
out.print(“<tr>”);
out.print(“<td>”+e.getEno()+”</td>”);
out.print(“<td>”+e.getEname()+”</td>”);
out.print(“<td>”+e.getSalary()+”</td></tr>”);
}
out.println(“</table>”);
%>
</body>
</html>Thanks inadvance
vamsi
vamsi_tMemberGot the error .. Sorry for all
vamsi
-
AuthorPosts