• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

JSP, Tomcat, Classpath Error

 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,

I am trying to learn about JSP and I am doing the exercises in the book "Beginning JSP2" from Apress. Until the last exercise, things were going well.

Here is what I am using:
Mac OS X 10.4.6
Tomcat 5.0.28
MySQL 5.0.16
MySQL ConnectorJ 3.1.13

Here is the latest script:

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

<sql:setDataSource var="datasource"
driver="com.mysql.jdbc.Driver"
url="jdbc:mysql://localhost/publish"
user="publishuser" password="XXXXXXXXXX"/>

<sql:query var="books" dataSource="${datasource}">
SELECT id, title, price FROM book
</sql:query>

<html>
<head>
<title>JSP gateway to the Publish Database</title>
</head>

<body>
<table border="1">
<tr>
<td>id</td>
<td>title</td>
<td>price</td>
</tr>

<c:forEach items="${books.rows}" var="row">

<tr>
<td><cut value="${row.id}" /></td>
<td><cut value="${row.title}" /></td>
<td><cut value="${row.price}" /></td>
</tr>

</c:forEach>

</table>
</body>
</html>

Unfortunately, I am getting this error message and I do not understand what it is saying. The message is:

javax.servlet.ServletException: org/aspectj/lang/Signature
org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:825)
org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:758)
org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:80)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
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(Class.java:242)
org.apache.taglibs.standard.tag.common.sql.DataSourceWrapper.setDriverClassName(DataSourceWrapper.java:46)
org.apache.taglibs.standard.tag.common.sql.SetDataSourceTagSupport.doStartTag(SetDataSourceTagSupport.java:102)
org.apache.jsp.bookList_jsp._jspx_meth_sql_setDataSource_0(bookList_jsp.java:100)
org.apache.jsp.bookList_jsp._jspService(bookList_jsp.java:64)
org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:94)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:324)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:236)
javax.servlet.http.HttpServlet.service(HttpServlet.java:802)

It looks like a class is missing. But the instructions only called for the mysql connector jar to go into the WEB-INF/lib directory, so I am at a loss as to what to do next.

Thank you for your time.

Elton
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64617
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Indeed, it means that the org.aspectj.lang.Signature class is missing from the classpath. You'll need to track down where you need to et it from.

But....

You said:

Tomcat 5.0.28


and


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


which means you are using JSTL 1.0 with Tomcat 5.

These are not compatible and will cause you future problems.

If you are using Tomcat 5, you should be sure that your web.xml is declared as a Servlets 2.4 web app, and you should be using JSTL 1.1.

The JSP FAQ has more details.
 
Elton Hughes
Ranch Hand
Posts: 72
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Bear,

Thank you for pointing that out. As someone who is learning from a book, I can only assume the authors had a good reason for mixing things up. The book I am learning from earned 8 horseshoes.

What should the taglib lines be?

Thanks,

Elton
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64617
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
http://java.sun.com/jsp/jstl/core

This assumes you have installed the JSTL 1.1 jars.
 
Stefan Evans
Bartender
Pie
Posts: 1669
10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The aspectj issue is coming from the MySQL driver I believe.
Maybe you have a "test" build of it?
Check that you have the right driver installed.

A related post on the mysql forums.
http://forums.mysql.com/read.php?39,22579,33723#msg-33723
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic