在jboss服务器中部署war文件时出现NoClassDefFoundError / classnotfound异常?

时间:2012-11-02 10:10:42

标签: eclipse

在此示例中,使用查询从MySql获取数据,并将值设置为SubjectScoreWithSubjectName并存储在数组列表中。但是这个例子在localhost中的tomcat服务器的帮助下运行在异常的eclipse juno中。

完成本机后我想上传到在线JBOSS服务器但是它显示以下错误。

        type Exception report

        message

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

        exception

        org.apache.jasper.JasperException: An exception occurred processing JSP page /login.jsp at line 33

        30: //      out.println("welcome");
        31:         String message = "OOps!!! Invalid Username/Password";
        32:         request.setAttribute("message", message);
        33:         request.getRequestDispatcher("/angular-gauge.jsp").forward(request, response);
        34:     }
        35:     else
        36:     {


        Stacktrace:
            org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:498)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        root cause

        org.apache.jasper.JasperException: An exception occurred processing JSP page /angular-gauge.jsp at line 56

        53: 
        54: 
        55:     while (rs.next()) {
        56:         SubjectScoreWithSubjectName score = new SubjectScoreWithSubjectName();
        57: 
        58:         score.setSUBJECT_ID(rs.getInt("SUBJECT_ID"));
        59: 


        Stacktrace:
            org.apache.jasper.servlet.JspServletWrapper.handleJspException(JspServletWrapper.java:498)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:393)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jsp.login_jsp._jspService(login_jsp.java:88)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        root cause

        javax.servlet.ServletException: java.lang.NoClassDefFoundError: com/table/values/SubjectScoreWithSubjectName
            org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:852)
            org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:781)
            org.apache.jsp.angular_002dgauge_jsp._jspService(angular_002dgauge_jsp.java:1087)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jsp.login_jsp._jspService(login_jsp.java:88)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        root cause

        java.lang.NoClassDefFoundError: com/table/values/SubjectScoreWithSubjectName
            org.apache.jsp.angular_002dgauge_jsp._jspService(angular_002dgauge_jsp.java:112)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jsp.login_jsp._jspService(login_jsp.java:88)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)
        root cause

        java.lang.ClassNotFoundException: com.table.values.SubjectScoreWithSubjectName
            java.net.URLClassLoader$1.run(URLClassLoader.java:200)
            java.security.AccessController.doPrivileged(Native Method)
            java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            java.lang.ClassLoader.loadClass(ClassLoader.java:306)
            java.lang.ClassLoader.loadClass(ClassLoader.java:251)
            org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:128)
            org.apache.jasper.servlet.JasperLoader.loadClass(JasperLoader.java:66)
            java.lang.ClassLoader.loadClassInternal(ClassLoader.java:319)
            org.apache.jsp.angular_002dgauge_jsp._jspService(angular_002dgauge_jsp.java:112)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jsp.login_jsp._jspService(login_jsp.java:88)
            org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:369)
            org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:322)
            org.apache.jasper.servlet.JspServlet.service(JspServlet.java:249)
            javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            org.jboss.web.tomcat.filters.ReplyHeaderFilter.doFilter(ReplyHeaderFilter.java:96)


**This is my java class (setter / getter method class)...

        my com.table.values.SubjectScoreWithSubjectName this class available in Project -> java resources -> src ->com.table.values.SubjectScoreWithSubjectName**



        package com.table.values;

        public class SubjectScoreWithSubjectName {
            private int USER_ID;
            private int SUBJECT_ID;
            private int CUMULATIVE_SCORES;
            private String SUBJECT_NAME;

            public int getUSER_ID() {
                return USER_ID;
            }

            public void setUSER_ID(int uSER_ID) {
                USER_ID = uSER_ID;
            }

            public int getSUBJECT_ID() {
                return SUBJECT_ID;
            }

            public void setSUBJECT_ID(int sUBJECT_ID) {
                SUBJECT_ID = sUBJECT_ID;
            }

            public int getCUMULATIVE_SCORES() {
                return CUMULATIVE_SCORES;
            }

            public void setCUMULATIVE_SCORES(int cUMULATIVE_SCORES) {
                CUMULATIVE_SCORES = cUMULATIVE_SCORES;
            }

            public String getSUBJECT_NAME() {
                return SUBJECT_NAME;
            }

            public void setSUBJECT_NAME(String sUBJECT_NAME) {
                SUBJECT_NAME = sUBJECT_NAME;
            }


        }


**so if i have doing anything wrong then tell me .
thanks in advance.**

1 个答案:

答案 0 :(得分:2)

您的应用无法访问课程com/table/values/SubjectScoreWithSubjectName.class

尝试将其包含在WEB-INF\lib文件夹中,或将其包含在服务器的CLASSPATH

<强>更新

有关Java EE应用程序的基本结构,请参阅http://www.servletworld.com/servlet-tutorials/web-application-directory-structure.html

通常,您的库(jars)应位于web-inf/lib,而您的类应位于web-inf/classes文件夹中。

如果com/table/values/SubjectScoreWithSubjectName是一个单独的类,它应该进入classes文件夹,但是如果它位于你在应用程序中导入的库中,它应该转到lib文件夹。