java.lang.ClassNotFoundException:org.apache.commons.lang.UnhandledException

时间:2013-10-30 11:38:03

标签: jsp tomcat servlets

在运行tomcat时,我收到如下错误: (在代码中,直到控制器,它工作正常,但是当涉及JSP页面时,它给出了错误) 请问,任何人都可以帮忙吗?

Oct 30, 2013 4:48:16 PM org.apache.catalina.core.ApplicationDispatcher invoke
SEVERE: Servlet.service() for servlet jsp threw exception
java.lang.ClassNotFoundException: org.apache.commons.lang.UnhandledException
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1680)
    at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1526)
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Class.java:2404)
    at java.lang.Class.getConstructor0(Class.java:2714)
    at java.lang.Class.newInstance0(Class.java:343)
    at java.lang.Class.newInstance(Class.java:325)
    at com.sun.beans.finder.InstanceFinder.instantiate(InstanceFinder.java:96)
    at com.sun.beans.finder.InstanceFinder.find(InstanceFinder.java:66)
    at java.beans.Introspector.findExplicitBeanInfo(Introspector.java:455)
    at java.beans.Introspector.<init>(Introspector.java:405)
    at java.beans.Introspector.getBeanInfo(Introspector.java:174)
    at org.apache.jasper.compiler.Generator$TagHandlerInfo.<init>(Generator.java:3911)
    at org.apache.jasper.compiler.Generator$GenerateVisitor.getTagHandlerInfo(Generator.java:2174)
    at org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1632)
    at org.apache.jasper.compiler.Node$CustomTag.accept(Node.java:1530)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
    at org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2411)
    at org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2417)
    at org.apache.jasper.compiler.Node$Root.accept(Node.java:495)
    at org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2361)
    at org.apache.jasper.compiler.Generator.generate(Generator.java:3461)
    at org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:231)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:354)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:334)
    at org.apache.jasper.compiler.Compiler.compile(Compiler.java:321)
    at org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:592)
    at org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:328)
    at org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    at org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.ApplicationDispatcher.invoke(ApplicationDispatcher.java:646)
    at org.apache.catalina.core.ApplicationDispatcher.doInclude(ApplicationDispatcher.java:551)
    at org.apache.catalina.core.ApplicationDispatcher.include(ApplicationDispatcher.java:488)
    at com.preva.controller.OverspeedDBProcess.service(OverspeedDBProcess.java:86)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:290)
    at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
    at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
    at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
    at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
    at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)
    at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
    at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
    at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:879)
    at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProtocol.java:617)
    at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1760)
    at java.lang.Thread.run(Thread.java:722)

这样的控制器

package com.preva.controller;

import java.io.IOException;
import java.io.PrintWriter;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.List;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;

import com.preva.dao.UserDAO;
import com.preva.vo.OverspeedDetails;


/**
 * Servlet implementation class OverspeedDBProcess
 */
public class OverspeedDBProcess extends HttpServlet {
    private static final long serialVersionUID = 1L;

    /**
     * @see HttpServlet#HttpServlet()
     */
    public OverspeedDBProcess() {
        super();
        // TODO Auto-generated constructor stub
    }

    /**
     * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)
     */
    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
    }

    /**
     * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)
     */
    protected void service(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // TODO Auto-generated method stub
        try{
            response.setContentType("text/html");
            PrintWriter out=response.getWriter();
            HttpSession session=request.getSession(true);
            String accountID=(String)session.getAttribute("sessionId");
            String deviceID=request.getParameter("vehicleId");
            String fromDate=request.getParameter("AnotherDate");
            String toDate=request.getParameter("ADate");

            String stringspeed=request.getParameter("speed").substring(1,3);
            double speed=Double.parseDouble(stringspeed);
               session.setAttribute("vid",deviceID);
            session.setAttribute("fromdate",fromDate);
            session.setAttribute("startdate",toDate);
            SimpleDateFormat sdf = new SimpleDateFormat("dd-MM-yyyy HH:mm:ss"); 
            Date startD = (Date) sdf.parse(fromDate);
            Date endD = (Date) sdf.parse(toDate);

            Calendar cal1 = Calendar.getInstance();
            Calendar cal2 = Calendar.getInstance();
            cal1.setTime(startD);
            cal2.setTime(endD);

             long timestamp1,timestamp2;
             timestamp1=cal1.getTimeInMillis()/1000;
             timestamp2=cal2.getTimeInMillis()/1000;
            System.out.println("::::"+timestamp1);
            System.out.println("::::"+timestamp2);
            String Timestamp1 = Long.toString(timestamp1);
            String Timestamp2 = Long.toString(timestamp2);



            UserDAO rdao=new UserDAO();
            List<OverspeedDetails> overspeeddetail=rdao.getosDetails(accountID, deviceID, Timestamp1, Timestamp2,speed);
                         if(!(overspeeddetail.isEmpty())){

                             session.setAttribute("overspeeddetails", overspeeddetail);
                                 RequestDispatcher rd=request.getRequestDispatcher("OverspeedDBReport.jsp");
                                    rd.include(request,response);
                            return;
                         }  
                         RequestDispatcher rd=request.getRequestDispatcher("DataNotFound.jsp");
                            rd.include(request,response);




        }catch (Exception e) {
            // TODO: handle exception
        }


    }
    }

像这样的Jsp页面

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@ page import = "com.preva.vo.StoppageDetails"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ taglib uri="http://displaytag.sf.net" prefix="display" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
 <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">

<link href="css/cal.css" rel="stylesheet" type="text/css" />
<link href="css/sty.css" rel="stylesheet" type="text/css" />
<link href="css/tabborder.css" rel="stylesheet" type="text/css" />
</head>
<body>
                 <jsp:include page="Header.jsp" />

            <table align=center border=0 cellspacing=0 cellpadding=0>
            <tr ><td colSpan=5 align=center><b>Overspeed Details</b></td></tr>
            <tr ><td colspan=5 align=center><b><%=request.getParameter("vehicleId") %></b></td></tr>
            <tr><td>From &nbsp;<%=session.getAttribute("fromdate") %>&nbsp;to&nbsp;<%=session.getAttribute("startdate") %></td></tr>

            </table><br></br>

             <table class='rptTbl_sortable' width='80%' align=center cellspacing='2' cellpadding='0' border='0'>

          <thead>
          <tr class="rptHdrRow">
         <th id="index" class="rptHdrCol_sort" nowrap>DeviceID</th>
         <th id="date" class="rptHdrCol_sort" nowrap>Date</th>
         <th id="time" class="rptHdrCol_sort" nowrap>Speed</th>
         <th id="statusdesc" class="rptHdrCol_sort" nowrap>Status</th>
                 <th id="address" class="rptHdrCol_sort" nowrap>Address</th>
</tr>
</thead>
<tbody>
<display:table id="deviceDetailsID" name="sessionScope.overspeeddetails" pagesize="10" style="width:99%;">
 <display:setProperty name="basic.empty.showtable" value="true" />
    <display:setProperty name="paging.banner.group_size" value="10" />
    <display:setProperty name="paging.banner.item_name" value="user" />
    <display:setProperty name="paging.banner.item_names" value="users" />

    <display:column property="deviceID" title="Device ID" sortable="true" headerClass="sortable" style="width: 1%"/>
    <display:column property="TIMESTAMP" title="TIMESTAMP" sortable="true" headerClass="sortable" format="{0,date,dd-MM-yyyy}"/>
    <display:column property="speed" title="Speed" sortable="true"/>
    <display:column property="statuscode" title="Status Code"/>
    <display:column property="address" title="Address" sortable="true" headerClass="sortable" />
</display:table> 


    </tbody>            


            </table> 


</body>

1 个答案:

答案 0 :(得分:2)

我在this post发布了答案。我建议你更新问题,但是你发布了一个新的问题,因为它很难在评论中阅读。

您需要在类路径中添加Commons Lang 2.6 jar以避免此异常。