[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

solve this my sql exception in jsp

Posted on 2006-03-26
13
Medium Priority
?
473 Views
Last Modified: 2010-04-01
<%@ page language = "java" import ="java.sql.*" %>
<html>
<body>
<%

Connection con = null;

try
{
       Class.forName("com.mysql.jdbc.Driver");
    con = DriverManager.getConnection("jdbc:mysql://localhost:3306/javatest");

     Statement st = con.createStatement();
     ResultSet rs = st.executeQuery("select * from counter");
%>
     <table border =2>

     <%
     while(rs.next())
     {
     %>
          <tr>
          <td><%= rs.getString(1)%></td>

          <td><%= rs.getString(2)%></td>

          <td><%= rs.getString(3)%></td>

          </tr>

    <%
     }
    %>
    </table>
<%
}
catch(Exception d)
{
   out.println("can not display the records");

}

finally
{
    if(con != null)
    {
        try
        {
            con.close();
        }
        catch(SQLException e)
        {
            out.println("Error closing the connection");
        }
    }
}
%>
</body>
</html>


i got exception for this code


ype Exception report

message

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

exception

org.apache.jasper.JasperException: org/aspectj/lang/Signature
      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

javax.servlet.ServletException: org/aspectj/lang/Signature
      org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:858)
      org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:791)
      org.apache.jsp.simplejdbc_jsp._jspService(org.apache.jsp.simplejdbc_jsp:119)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause

java.lang.NoClassDefFoundError: org/aspectj/lang/Signature
      java.lang.Class.forName0(Native Method)
      java.lang.Class.forName(Unknown Source)
      org.apache.jsp.simplejdbc_jsp._jspService(org.apache.jsp.simplejdbc_jsp:52)
      org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:97)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:332)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

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

i put mysql- jav connector 5.0.0b.jar into C:\Program Files\Apache Software Foundation\Tomcat 5.5\webapps\ROOT\WEB-INF\lib this directory

could i want to set ant classpath?
0
Comment
  • 7
  • 6
13 Comments
 
LVL 10

Expert Comment

by:radarsh
ID: 16297898
Alright stmani,

Remove the mysql-connector-java-XXXX-bin-g.jar from your classpath
and just add the mysql-connector-java-XXXX-bin.jar

the -g jar is a debug version and should not be in your classpath

________
radarsh
0
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 16298317
now it dispalys

can not display records.

how could i know  counter table structure in javatest database in mysql
0
 
LVL 10

Expert Comment

by:radarsh
ID: 16298388
Open mysql command line and type

desc counter;

________
radarsh
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 10

Accepted Solution

by:
radarsh earned 1000 total points
ID: 16298400
Don't do out.println("can not display the records");

print the exception stacktrace.

d.printStackTrace();

Otherwise, you won't understand anything.

________
radarsh
0
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 16298434
if i run through eclipse that shows page can not be displayed.

it would  be run with out  ecclipse.

i create a dynamic webproject is called jdbcjsp.

right click that one add jsp file to that.

when i right clikc jdbcjsp folder and select option run as server.

it shows page can not be displayed.


could i modify workspace in ecllpse.

http://localhost:8090/JDBCJSP THIS URL SHOWS IN ECCLIPSE.

FILE NAME IS JDBC.JSP.

IS IT CORRECT.

HOW COULD I RUN THIS PROGRAM IN ECCLIPSE.



0
 
LVL 10

Expert Comment

by:radarsh
ID: 16298465
Where did you put your jsp? It should be directly under WebContent folder.
Make sure your server is running.

Hit http://localhost:8090 and see if you get something.

How is it 8090? Did you change the port? By default it will be 8080.

________
radarsh
0
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 16298603
jsp file is there in webcontentfolder only

>>Hit http://localhost:8090 and see if you get something.

it shows page can not be displayed

>>How is it 8090? Did you change the port? By default it will be 8080.

already i changed the port

0
 
LVL 10

Expert Comment

by:radarsh
ID: 16298708
That means your server is not started! Make sure you start the server
properly and then try rest of the things.

________
radarsh
0
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 16298854
how to start the server.
0
 
LVL 10

Expert Comment

by:radarsh
ID: 16298898
stmani, all this is not relevant to your original question. All you asked was
how to get rid of that exception. And I guess that's solved.

You need to read the tomcat guides for information on how to do things.
http://tomcat.apache.org/tomcat-5.5-doc/index.html

________
radarsh
0
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 16302592
now i got this exception

i put

    %>
    </table>
<%
}
catch(Exception d)
{
 out.println(d.printStackTrace());

}
 that would causes an exception like this
An error occurred at line: 35 in the jsp file: /simplejdbc.jsp


Generated servlet error:
The method println() in the type PrintStream is not applicable for the arguments (void)


      org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:510)
      org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:375)
      org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:314)
      org.apache.jasper.servlet.JspServlet.service(JspServlet.java:264)
      javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

root cause
0
 
LVL 10

Expert Comment

by:radarsh
ID: 16302827
>> out.println(d.printStackTrace());

Should be either out.println(d.getMessage());

or d.printStackTrace();


________
radarsh


0
 
LVL 9

Author Comment

by:Manikandan Thiagarajan
ID: 16306422
Access denied for user ''@'localhost' (using password: NO)

now that would give message like this
0

Featured Post

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

If anyone asked you to network diagram of the internet, it was drawn in the form of a fluffy cloud which further became known as cloud computing. Popularly cloud computing is defined as workloads that run over the internet in a commercial provider’s…
In the below post we have mentioned the best hosting type for startups. Also, check out some of the superlative web hosting companies that are proposing affordable web hosting solutions to host your startup website.
We’ve all felt that sense of false security before—locking down external access to a database or component and feeling like we’ve done all we need to do to secure company data. But that feeling is fleeting. Attacks these days can happen in many w…
Whether it be Exchange Server Crash Issues, Dirty Shutdown Errors or Failed to mount error, Stellar Phoenix Mailbox Exchange Recovery has always got your back. With the help of its easy to understand user interface and 3 simple steps recovery proced…
Suggested Courses
Course of the Month19 days, 5 hours left to enroll

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question