Please tell me how i can run jsp page in Linux Tomcate server...
i found the error -

org.apache.jasper.JasperException: /USERINFO.jsp
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:433)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:361)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.io.FileNotFoundException: /USERINFO.jsp
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:278)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)

i am trying to connect remote mysql database which is run on linux (o/s) tomcat server.
i found these exception -

The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /UserData.jsp:35

32:
33: <%
34: String sql2="select * from 'USERINFO' ";
35: Statement pst2=connection.createStatement();
36: ResultSet rs2=pst2.executeQuery(sql2);
37:
38: if(rs2.next())


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.NullPointerException
org.apache.jsp.UserData_jsp._jspService(UserData_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.

Don't use scriptlets in your JSP. Move this out into a Bean. If you still have a problem, post the Bean, and the JSP tags you use to access it, and we'll continue.

No, your actual probelm is that connection is probably not defined. But that is beside the point. Scriptlets have no place in JSP's anymore. Youre still allowed to use them (mainly for backwards compatability), but you shouldn't be using them. It makes maintenance of the application a living hell.

I found this exception
please solve this ...


org.apache.jasper.JasperException: Exception in JSP: /UserData.jsp:36

33:
34: <%
35: String sql2="SELECT * FROM USERINFO";
36: pst2=connection.createStatement();
37:
38: rs=pst2.executeQuery(sql2);
39:


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


root cause

java.lang.NullPointerException
org.apache.jsp.UserData_jsp._jspService(UserData_jsp.java:81)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:803)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.25 logs.

type Exception report

message

description The server encountered an internal error () that prevented it from fulfilling this request.

exception

org.apache.jasper.JasperException: Exception in JSP: /d1.jsp:27

24:         System.out.println("Error occurred " + e);
25:      }
26:      try {
27:         stmt = conn.createStatement();
28:         result = stmt.executeQuery("SELECT * FROM student");
29:      }
30:      catch (SQLException e) {

Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:373)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

java.lang.NullPointerException
org.apache.jsp.d1_jsp._jspService(d1_jsp.java:69)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


note The full stack trace of the root cause is available in the Apache Tomcat/5.5.28 logs.

Edited 6 Years Ago by peter_budo: Keep it Organized - For easy readability, always wrap programming code within posts in [code] (code blocks)

If you have read what you just posted you would have seen that is says:
d1.jsp:27
NullPointerException.

At the above line you are using something which is null

Please send Solution

org.apache.jasper.JasperException: Exception in JSP: /jsp/crg/q4.jsp:13

10: Connection con=null;
11: %>
12: <%
13: Class.forName("com.mysql.jdbc.Driver");
14: con=DriverManager.getConnection("jdbc:mysql://localhost:3306/mydatasource?user=root&password=crg");
15: String month=request.getParameter("month");
16: PreparedStatement pstmt=con.prepareStatement("select * from Item where month like ?");


Stacktrace:
org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:451)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:355)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

javax.servlet.ServletException: com.mysql.jdbc.Driver
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:841)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:774)
org.apache.jsp.jsp.crg.q4_jsp._jspService(q4_jsp.java:102)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:98)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:331)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:329)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:265)
javax.servlet.http.HttpServlet.service(HttpServlet.java:729)


root cause

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

root cause

java.lang.ClassNotFoundException: com.mysql.jdbc.Driver

It cannot find the class com.mysql.jdbc.Driver. You need to download the mysql-connector.jar and set it to your classpath. That jar contains the class you are missing: com.mysql.jdbc.Driver.

And for the rest of your questions, if any, please start a new Thread.

This article has been dead for over six months. Start a new discussion instead.