项目运行正常,我做了一些改变,无法弄清楚在哪里 现在我无法让它运作
我的spring安全上下文配置设置有什么问题吗?
中找不到任何适当的文档(初学者)错误
HTTP状态404 - / javaproj /
TOMCAT OUT:
Jan 6, 2012 1:14:40 PM org.apache.catalina.core.AprLifecycleListener init
INFO: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.6.0_22\bin;.;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Program Files\JetBrains\IntelliJ IDEA 10.5.1\bin\..\.\bin;C:\ColdFusion9\verity\k2\_nti40\bin;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\grails-1.3.7\bin;C:\Program Files\Subversion\bin;C:\Program Files\TortoiseSVN\bin;c:\program files\jetbrains\intellij idea 10.5.1\jre\jre\bin
Jan 6, 2012 1:14:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["http-bio-8080"]
Jan 6, 2012 1:14:40 PM org.apache.coyote.AbstractProtocol init
INFO: Initializing ProtocolHandler ["ajp-bio-8009"]
Jan 6, 2012 1:14:40 PM org.apache.catalina.startup.Catalina load
INFO: Initialization processed in 428 ms
Jan 6, 2012 1:14:40 PM org.apache.catalina.core.StandardService startInternal
INFO: Starting service Catalina
Jan 6, 2012 1:14:40 PM org.apache.catalina.core.StandardEngine startInternal
INFO: Starting Servlet Engine: Apache Tomcat/7.0.23
Jan 6, 2012 1:14:40 PM org.apache.catalina.startup.HostConfig deployDescriptor
INFO: Deploying configuration descriptor C:\Users\JebaPrince\.IntelliJIdea10\system\tomcat\Unnamed_javaproj_3\conf\Catalina\localhost\javaproj.xml
Jan 6, 2012 1:14:47 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization started
Jan 6, 2012 1:14:47 PM org.springframework.context.support.AbstractApplicationContext prepareRefresh
INFO: Refreshing Root WebApplicationContext: startup date [Fri Jan 06 13:14:47 IST 2012]; root of context hierarchy
Jan 6, 2012 1:14:47 PM org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
INFO: Loading XML bean definitions from ServletContext resource [/WEB-INF/javaproj-app-context.xml]
Jan 6, 2012 1:14:48 PM org.springframework.security.core.SpringSecurityCoreVersion <clinit>
INFO: You are running with Spring Security Core 3.1.0.RELEASE
Jan 6, 2012 1:14:48 PM org.springframework.security.config.SecurityNamespaceHandler <init>
INFO: Spring Security 'config' module version is 3.1.0.RELEASE
Jan 6, 2012 1:14:48 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'permitAll' for /**
Jan 6, 2012 1:14:48 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'IS_AUTHENTICATED_ANONYMOUSLY' for /j_spring_security_check
Jan 6, 2012 1:14:48 PM org.springframework.security.config.http.FilterInvocationSecurityMetadataSourceParser parseInterceptUrlsForFilterInvocationRequestMap
INFO: Creating access control expression attribute 'IS_AUTHENTICATED_ANONYMOUSLY' for /Login.jsp
Jan 6, 2012 1:14:48 PM org.springframework.security.config.http.HttpSecurityBeanDefinitionParser checkFilterChainOrder
INFO: Checking sorted filter chain: [Root bean: class [org.springframework.security.web.context.SecurityContextPersistenceFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 300, Root bean: class [org.springframework.security.web.authentication.logout.LogoutFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 400, <org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0>, order = 800, Root bean: class [org.springframework.security.web.authentication.www.BasicAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1200, Root bean: class [org.springframework.security.web.savedrequest.RequestCacheAwareFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1300, Root bean: class [org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1400, Root bean: class [org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1600, Root bean: class [org.springframework.security.web.authentication.AnonymousAuthenticationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1700, Root bean: class [org.springframework.security.web.session.SessionManagementFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1800, Root bean: class [org.springframework.security.web.access.ExceptionTranslationFilter]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null, order = 1900, <org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0>, order = 2000]
Jan 6, 2012 1:14:48 PM org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
INFO: Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1021e58: defining beans [org.springframework.security.filterChains,org.springframework.security.filterChainProxy,org.springframework.security.web.DefaultSecurityFilterChain#0,org.springframework.security.web.DefaultSecurityFilterChain#1,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0,org.springframework.security.authentication.RememberMeAuthenticationProvider#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.userDetailsServiceFactory,org.springframework.security.web.DefaultSecurityFilterChain#2,org.springframework.security.provisioning.InMemoryUserDetailsManager#0,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager]; root of factory hierarchy
Jan 6, 2012 1:14:48 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: Ant [pattern='/login.jsp*'], []
Jan 6, 2012 1:14:48 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: Ant [pattern='/manage**'], []
Jan 6, 2012 1:14:48 PM org.springframework.security.web.DefaultSecurityFilterChain <init>
INFO: Creating filter chain: org.springframework.security.web.util.AnyRequestMatcher@1, [org.springframework.security.web.context.SecurityContextPersistenceFilter@1ff3510, org.springframework.security.web.authentication.logout.LogoutFilter@1f4e0ba, org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter@1cdd76a, org.springframework.security.web.authentication.www.BasicAuthenticationFilter@f9a042, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@88890d, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@1ddcd5f, org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter@d642fd, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@c7f38c, org.springframework.security.web.session.SessionManagementFilter@1469bea, org.springframework.security.web.access.ExceptionTranslationFilter@a64642, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@4e9b7d]
Jan 6, 2012 1:14:48 PM org.springframework.security.config.http.DefaultFilterChainValidator checkLoginPageIsntProtected
INFO: Checking whether login URL '/Login.jsp' is accessible with your configuration
Jan 6, 2012 1:14:48 PM org.springframework.web.context.ContextLoader initWebApplicationContext
INFO: Root WebApplicationContext: initialization completed in 671 ms
Jan 6, 2012 1:14:48 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Error filterStart
Jan 6, 2012 1:14:48 PM org.apache.catalina.core.StandardContext startInternal
SEVERE: Context [/javaproj] startup failed due to previous errors
Jan 6, 2012 1:14:48 PM org.springframework.context.support.AbstractApplicationContext doClose
INFO: Closing Root WebApplicationContext: startup date [Fri Jan 06 13:14:47 IST 2012]; root of context hierarchy
Jan 6, 2012 1:14:48 PM org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
INFO: Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1021e58: defining beans [org.springframework.security.filterChains,org.springframework.security.filterChainProxy,org.springframework.security.web.DefaultSecurityFilterChain#0,org.springframework.security.web.DefaultSecurityFilterChain#1,org.springframework.security.web.PortMapperImpl#0,org.springframework.security.config.authentication.AuthenticationManagerFactoryBean#0,org.springframework.security.authentication.ProviderManager#0,org.springframework.security.web.context.HttpSessionSecurityContextRepository#0,org.springframework.security.web.authentication.session.SessionFixationProtectionStrategy#0,org.springframework.security.web.savedrequest.HttpSessionRequestCache#0,org.springframework.security.web.access.expression.DefaultWebSecurityExpressionHandler#0,org.springframework.security.access.vote.AffirmativeBased#0,org.springframework.security.web.access.intercept.FilterSecurityInterceptor#0,org.springframework.security.web.access.DefaultWebInvocationPrivilegeEvaluator#0,org.springframework.security.authentication.AnonymousAuthenticationProvider#0,org.springframework.security.web.authentication.rememberme.TokenBasedRememberMeServices#0,org.springframework.security.authentication.RememberMeAuthenticationProvider#0,org.springframework.security.web.authentication.www.BasicAuthenticationEntryPoint#0,org.springframework.security.web.authentication.UsernamePasswordAuthenticationFilter#0,org.springframework.security.userDetailsServiceFactory,org.springframework.security.web.DefaultSecurityFilterChain#2,org.springframework.security.provisioning.InMemoryUserDetailsManager#0,org.springframework.security.authentication.dao.DaoAuthenticationProvider#0,org.springframework.security.authentication.DefaultAuthenticationEventPublisher#0,org.springframework.security.authenticationManager]; root of factory hierarchy
Jan 6, 2012 1:14:48 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.23\webapps\docs
Jan 6, 2012 1:14:48 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.23\webapps\examples
Jan 6, 2012 1:14:48 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.23\webapps\host-manager
Jan 6, 2012 1:14:48 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.23\webapps\manager
Jan 6, 2012 1:14:48 PM org.apache.catalina.startup.HostConfig deployDirectory
INFO: Deploying web application directory C:\apache-tomcat-7.0.23\webapps\ROOT
Jan 6, 2012 1:14:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["http-bio-8080"]
Jan 6, 2012 1:14:48 PM org.apache.coyote.AbstractProtocol start
INFO: Starting ProtocolHandler ["ajp-bio-8009"]
Jan 6, 2012 1:14:48 PM org.apache.catalina.startup.Catalina start
INFO: Server startup in 8019 ms
Connected to server
Web.xml中
<filter>
<filter-class>org.springframework.web.filter.DelegatingFilterProxy</filter-class>
<filter-name>filterChainProxy</filter-name>
</filter>
<filter-mapping>
<filter-name>filterChainProxy</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
/WEB-INF/javaproj-app-context.xml
</param-value>
</context-param>
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<servlet>
<servlet-name>javaproj</servlet-name>
<servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>javaproj</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>Login.jsp</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>K2M</servlet-name>
<servlet-class>com.swiftant.jsp.K2MServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>K2M</servlet-name>
<url-pattern>/Servlets/K2MServlet</url-pattern>
</servlet-mapping>
<servlet-name>First</servlet-name>
<jsp-file>/Servlets/FirstJSP.jsp</jsp-file>
<servlet>
<servlet-name>AuthController</servlet-name>
<servlet-class>com.swiftant.jsp.AuthController</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AuthController</servlet-name>
<url-pattern>/Servlets/AuthController</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>UserService</servlet-name>
<servlet-class>com.swiftant.jsp.UserService</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>UserService</servlet-name>
<url-pattern>/Servlets/UserService</url-pattern>
</servlet-mapping>
<context-param>
<param-name>DRIVER_NAME</param-name>
<param-value>com.mysql.jdbc.Driver</param-value>
</context-param>
<context-param>
<param-name>DATABASE_URL</param-name>
<param-value>jdbc:mysql://localhost/javadb</param-value>
</context-param>
<context-param>
<param-name>login_page</param-name>
<param-value>/Servlets/Login.jsp</param-value>
</context-param>
<context-param>
<param-name>session_time</param-name>
<param-value>5</param-value>
</context-param>
javaproj-APP-context.xml中
<beans:beans xmlns="http://www.springframework.org/schema/security"
xmlns:beans="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://www.springframework.org/schema/security
http://www.springframework.org/schema/security/spring-security-3.1.xsd">
<http pattern="/Login.jsp*" security="none"/>
<http pattern="/manage**" security="none"/>
<http auto-config="true" use-expressions="true">
<intercept-url pattern="/**" access="permitAll"/>
<intercept-url pattern="/j_spring_security_check" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<intercept-url pattern="/Login.jsp" access="IS_AUTHENTICATED_ANONYMOUSLY"/>
<form-login login-page='/Login.jsp' default-target-url='/hello'
always-use-default-target='true'/>
<remember-me/>
<logout delete-cookies="true" logout-url="/manage"/>
</http>
<authentication-manager>
<authentication-provider>
<user-service>
<user name="prince" password="prince" authorities="ROLE_USER"/>
</user-service>
</authentication-provider>
</authentication-manager>
</beans:beans>
**javaproj-servlet.xml**
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:mvc="http://www.springframework.org/schema/mvc"
xmlns:s="http://www.springframework.org/schema/security"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd http://www.springframework.org/schema/mvc http://www.springframework.org/schema/mvc/spring-mvc-3.1.xsd http://www.springframework.org/schema/security http://www.springframework.org/schema/security/spring-security-2.0.4.xsd">
<mvc:resources location="/css/" mapping="/css/**"/>
<mvc:resources location="/image/" mapping="/image/**"/>
<mvc:resources location="/js/" mapping="/js/**"/>
<mvc:annotation-driven/>
<bean name="/hello" class="com.swiftant.jsp.HelloController"/>
<bean name="/manage" class="com.swiftant.jsp.ManageController"/>
<bean class="org.springframework.web.servlet.view.InternalResourceViewResolver">
<property name="prefix" value="/WEB-INF/views/"/>
<property name="suffix" value=".jsp"/>
</bean>
</beans>
答案 0 :(得分:0)
问题在于我的Spring安全配置..
如果你是 初学者并尝试在Eclipse中使Spring安全工作!
我的建议是使用Springsource Tool或Intellij构建您的文件