简体   繁体   English

java.lang.ClassNotFoundException:org.springframework.ui.context.ThemeSource

[英]java.lang.ClassNotFoundException: org.springframework.ui.context.ThemeSource

I am getting this error when running my login jsp. 运行登录jsp时出现此错误。 I am kind of new at using spring and I'm at a lost. 我对使用spring有点陌生,但我很茫然。 I have all the dependencies for the servlets and beans. 我具有servlet和bean的所有依赖关系。 Here is my login.jsp code: 这是我的login.jsp代码:

<%@include file="include.jsp"%>
<%@ page language="java" contentType="text/html; charset=ISO-8859-1" pageEncoding="ISO-8859-1"%>
<!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=ISO-8859-1">
        <title>Login</title>
    </head>
    <body>
        <form:form id="loginForm" method="post" action="login" modelAttribute="userDAO">

            <form:label path="username">Enter your user-name</form:label>
            <form:input id="username" name="username" path="username" /><br>
            <form:label path="username">Please enter your password</form:label>
            <form:password id="password" name="password" path="password" /><br>
            <input type="submit" value="Submit" />
        </form:form>
    </body>
</html>

Also, the loginController: 另外,loginController:

package com.onlinemarket3.controllers;

import java.sql.SQLException;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ModelAttribute;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.servlet.ModelAndView;

import com.onlinemarket3.delegate.LoginDelegate;
import com.onlinemarket3.model.Buyer;
import com.onlinemarket3.model.User;
import com.onlinemarket3.model.UserDao1;
import com.onlinemarket3.model.UserDaoInterface;



@Controller
public class LoginController
{
    @Autowired
    private LoginDelegate loginDelegate;

    @RequestMapping(value="/login",method=RequestMethod.GET)
    public ModelAndView displayLogin(HttpServletRequest request, HttpServletResponse response)
    {
        ModelAndView model = new ModelAndView("login");
        User user = new User();

        model.addObject("userDAO", user);
        return model;
    }
    @RequestMapping(value="/login",method=RequestMethod.POST)
    public ModelAndView executeLogin(HttpServletRequest request, HttpServletResponse response, @ModelAttribute("userDAO")User user)
    {
        ModelAndView model= null;
        boolean loggedIn;
        try {
            loggedIn = loginDelegate.autentificate(user);
            if (loggedIn) {
                System.out.println("User Login Successful");
                request.setAttribute("loggedInUser", user.getUsername());
                model = new ModelAndView("welcome");

            }
            else
            {
                model = new ModelAndView("login");
                model.addObject("userDAO", user);
                request.setAttribute("message", "Invalid credentials!!");
            }
        } catch (SQLException e) {
            e.printStackTrace();
        }



        return model;
    }
}

This is the error: 这是错误:

javax.servlet.ServletException: java.lang.NoClassDefFoundError: org/springframework/ui/context/ThemeSource
    org.apache.jasper.runtime.PageContextImpl.doHandlePageException(PageContextImpl.java:865)
    org.apache.jasper.runtime.PageContextImpl.handlePageException(PageContextImpl.java:794)
    org.apache.jsp.jsps.login_jsp._jspService(login_jsp.java:93)
    org.apache.jasper.runtime.HttpJspBase.service(HttpJspBase.java:70)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)
    org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:388)
    org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:313)
    org.apache.jasper.servlet.JspServlet.service(JspServlet.java:260)
    javax.servlet.http.HttpServlet.service(HttpServlet.java:723)

It also says that I have an error at line 10 in login.jsp. 它还说我在login.jsp的第10行有一个错误。 I have not found a clue to this error on google. 我在Google上找不到此错误的线索。 Please help, thank you! 请帮忙,谢谢! :) :)

The ThemeSource class is located in the spring-context jar. ThemeSource类位于spring-context罐中。 Make sure that the required dependency is included in your pom.xml file eg 确保所需的依赖项包含在您的pom.xml文件中,例如

<dependency>
    <groupId>org.springframework</groupId>
    <artifactId>spring-context</artifactId>
    <version>X.X.X.RELEASE</version>
</dependency>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Spring java.lang.ClassNotFoundException:org.springframework.context.ApplicationContext - spring java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext org.springframework.web.context.ContextLoaderListener(java.lang.ClassNotFoundException) - org.springframework.web.context.ContextLoaderListener(java.lang.ClassNotFoundException) java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoadListener - java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoadListener java.lang.ClassNotFoundException:org.springframework.context.ApplicationContext - java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext java中的java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener - java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener in eclipse Maven + Spring + Hibernate:java.lang.ClassNotFoundException:org.springframework.context.support.ClassPathXmlApplicationContext - Maven+Spring+Hibernate: java.lang.ClassNotFoundException: org.springframework.context.support.ClassPathXmlApplicationContext java.lang.ClassNotFoundException:org.springframework.boot.context.properties.bind.Bindable - java.lang.ClassNotFoundException: org.springframework.boot.context.properties.bind.Bindable 引起原因:java.lang.ClassNotFoundException:org.springframework.web.context.request.RequestAttributes - Caused by: java.lang.ClassNotFoundException: org.springframework.web.context.request.RequestAttributes java.lang.ClassNotFoundException:org.springframework.web.context.ContextLoaderListener添加spring-security - java.lang.ClassNotFoundException: org.springframework.web.context.ContextLoaderListener adding spring-security 执行jar文件:原因:java.lang.ClassNotFoundException:org.springframework.context.ApplicationContext - executing jar file: Caused by: java.lang.ClassNotFoundException: org.springframework.context.ApplicationContext
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM