shiro--Strange Unable to login problem

Source: Internet
Author: User

Shiro for the permission frame, Deployed to Contos7 's tomcat77.0.54, before that Tomcat had had several projects, basically use a frame, all run normally well, but the new deployment of the project is not entered, see the log, permission certification has passed, but is not to jump the main page, verify success and then jump back to the landing page, and the landing page Face also does not show any login failed message, look at the console log, a bunch of things like:


Nov, 2017 9:54:44 PM org.apache.catalina.startup.ContextConfig Processannotationsjar
Severe:unable to process Jar entry [Javassist/classclasspath.class] from Jar [jar:file:/usr/share/tomcat/webapps/oes2/ web-inf/lib/javassist-3.20.0-ga.jar!/] for annotations
Java.io.EOFException
At Java.io.DataInputStream.readUnsignedShort (datainputstream.java:340)
At Org.apache.tomcat.util.bcel.classfile.Utility.swallowMethodParameters (utility.java:797)
At Org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute (attribute.java:171)
At Org.apache.tomcat.util.bcel.classfile.fieldormethod.<init> (fieldormethod.java:57)
At Org.apache.tomcat.util.bcel.classfile.method.<init> (method.java:71)
At Org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods (classparser.java:267)
At Org.apache.tomcat.util.bcel.classfile.ClassParser.parse (classparser.java:127)
At Org.apache.catalina.startup.ContextConfig.processAnnotationsStream (contextconfig.java:2058)
At Org.apache.catalina.startup.ContextConfig.processAnnotationsJar (contextconfig.java:1934)
At Org.apache.catalina.startup.ContextConfig.processAnnotationsUrl (contextconfig.java:1900)
At Org.apache.catalina.startup.ContextConfig.processAnnotations (contextconfig.java:1885)
At Org.apache.catalina.startup.ContextConfig.webConfig (contextconfig.java:1317)
At Org.apache.catalina.startup.ContextConfig.configureStart (contextconfig.java:876)
At Org.apache.catalina.startup.ContextConfig.lifecycleEvent (contextconfig.java:374)
At Org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (lifecyclesupport.java:117)
At Org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (lifecyclebase.java:90)
At Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5355)
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150)
At Org.apache.catalina.startup.HostConfig.reload (hostconfig.java:1487)
At Org.apache.catalina.startup.HostConfig.checkResources (hostconfig.java:1465)
At Org.apache.catalina.startup.HostConfig.check (hostconfig.java:1649)
At Org.apache.catalina.startup.HostConfig.lifecycleEvent (hostconfig.java:328)
At Org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (lifecyclesupport.java:117)
At Org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (lifecyclebase.java:90)
At Org.apache.catalina.core.ContainerBase.backgroundProcess (containerbase.java:1374)
At Org.apache.catalina.core.containerbase$containerbackgroundprocessor.processchildren (ContainerBase.java:1530)
At Org.apache.catalina.core.containerbase$containerbackgroundprocessor.processchildren (ContainerBase.java:1540)
At Org.apache.catalina.core.containerbase$containerbackgroundprocessor.run (containerbase.java:1519)
At Java.lang.Thread.run (thread.java:745)


and the following information:


Nov, 2017 9:54:44 PM org.apache.catalina.startup.ContextConfig Processannotationsjar
Severe:unable to process Jar entry [Javassist/classpool.class] from Jar [jar:file:/usr/share/tomcat/webappszhengzhou/ oes2/web-inf/lib/javassist-3.20.0-ga.jar!/] for annotations
ORG.APACHE.TOMCAT.UTIL.BCEL.CLASSFILE.CLASSFORMATEXCEPTION:INVALID constant Pool reference:2817. Constant Pool Size is:528
At Org.apache.tomcat.util.bcel.classfile.ConstantPool.getConstant (constantpool.java:183)
At Org.apache.tomcat.util.bcel.classfile.ConstantPool.getConstant (constantpool.java:202)
At Org.apache.tomcat.util.bcel.classfile.Attribute.readAttribute (attribute.java:94)
At Org.apache.tomcat.util.bcel.classfile.fieldormethod.<init> (fieldormethod.java:57)
At Org.apache.tomcat.util.bcel.classfile.method.<init> (method.java:71)
At Org.apache.tomcat.util.bcel.classfile.ClassParser.readMethods (classparser.java:267)
At Org.apache.tomcat.util.bcel.classfile.ClassParser.parse (classparser.java:127)
At Org.apache.catalina.startup.ContextConfig.processAnnotationsStream (contextconfig.java:2058)
At Org.apache.catalina.startup.ContextConfig.processAnnotationsJar (contextconfig.java:1934)
At Org.apache.catalina.startup.ContextConfig.processAnnotationsUrl (contextconfig.java:1900)
At Org.apache.catalina.startup.ContextConfig.processAnnotations (contextconfig.java:1885)
At Org.apache.catalina.startup.ContextConfig.webConfig (contextconfig.java:1317)
At Org.apache.catalina.startup.ContextConfig.configureStart (contextconfig.java:876)
At Org.apache.catalina.startup.ContextConfig.lifecycleEvent (contextconfig.java:374)
At Org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (lifecyclesupport.java:117)
At Org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (lifecyclebase.java:90)
At Org.apache.catalina.core.StandardContext.startInternal (standardcontext.java:5355)
At Org.apache.catalina.util.LifecycleBase.start (lifecyclebase.java:150)
At Org.apache.catalina.startup.HostConfig.reload (hostconfig.java:1487)
At Org.apache.catalina.startup.HostConfig.checkResources (hostconfig.java:1465)
At Org.apache.catalina.startup.HostConfig.check (hostconfig.java:1649)
At Org.apache.catalina.startup.HostConfig.lifecycleEvent (hostconfig.java:328)
At Org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent (lifecyclesupport.java:117)
At Org.apache.catalina.util.LifecycleBase.fireLifecycleEvent (lifecyclebase.java:90)
At Org.apache.catalina.core.ContainerBase.backgroundProcess (containerbase.java:1374)
At Org.apache.catalina.core.containerbase$containerbackgroundprocessor.processchildren (ContainerBase.java:1530)
At Org.apache.catalina.core.containerbase$containerbackgroundprocessor.processchildren (ContainerBase.java:1540)
At Org.apache.catalina.core.containerbase$containerbackgroundprocessor.run (containerbase.java:1519)
At Java.lang.Thread.run (thread.java:745)


A project that was previously deployed on the server appears to have occurred. is also the console out of this error, and then forget how to operate well, you can log in, but will appear for a while can not log in, restart a control on it, the system in the log still have such a mistake, think of a variety of methods can not be resolved, Also forget what to do, download the package Ah, clear cache Ah, clear working directory Ah, conflict resolution AH, all these, and then suddenly good, the specific reason is not clear, because too busy, also let go.
This time again encountered this problem, the initial see this error is not much of a relationship with it, not to consider this side, but the problem is that the system without any errors, even the login page login failure hint. Later Baidu to Baidu to go, someone mentioned the JDK version of the problem, so consider the server on the JDK 1.7, this machine is 1.8+1.7, is not the problem of compiling. So will all files to compile again with 1.7, and then put the server or not, but do not know is good is bad, originally this machine in eclipse run without any problems, so can not debug, after a toss, this machine finally also appeared the same problem.
Then according to the server log output of the last piece of information, find the corresponding statement, is a custom Shiro realm file, the last sentence:


Simpleauthenticationinfo Saci = new Simpleauthenticationinfo (user, User.getpassword (), GetName ());			
Logger.info ("" "+ user.getname () +" ("+ user.getloginname () +") "+" "Login System");
return Saci;

In fact, the previous verification has passed, that is, the return Saci when there is a problem, but did not throw an exception.
So breakpoint set here, step-by-step tracking into the Shiro source code, finally found that the following exception:

Org.apache.shiro.authc.authenticationexception:a Credentialsmatcher must is configured in order to verify credentials du  Ring authentication. If you don't wish for credentials to is examined, you can configure a Org.apache.shiro.authc.credential.AllowAllCredenti Alsmatcher instance.
At Org.apache.shiro.realm.AuthenticatingRealm.assertCredentialsMatch (authenticatingrealm.java:608)
At Org.apache.shiro.realm.AuthenticatingRealm.getAuthenticationInfo (authenticatingrealm.java:581)
At Org.apache.shiro.authc.pam.ModularRealmAuthenticator.doSingleRealmAuthentication ( modularrealmauthenticator.java:180)
At Org.apache.shiro.authc.pam.ModularRealmAuthenticator.doAuthenticate (modularrealmauthenticator.java:267)
At Org.apache.shiro.authc.AbstractAuthenticator.authenticate (abstractauthenticator.java:198)
At Org.apache.shiro.mgt.AuthenticatingSecurityManager.authenticate (authenticatingsecuritymanager.java:106)
At Org.apache.shiro.mgt.DefaultSecurityManager.login (defaultsecuritymanager.java:274)
At Org.apache.shiro.subject.support.DelegatingSubject.login (delegatingsubject.java:260)
At Org.apache.shiro.web.filter.authc.AuthenticatingFilter.executeLogin (authenticatingfilter.java:53)
At Org.apache.shiro.web.filter.authc.FormAuthenticationFilter.onAccessDenied (formauthenticationfilter.java:154)
At Org.apache.shiro.web.filter.AccessControlFilter.onAccessDenied (accesscontrolfilter.java:133)
At Org.apache.shiro.web.filter.AccessControlFilter.onPreHandle (accesscontrolfilter.java:162)
At org.apache.shiro.web.filter.PathMatchingFilter.isFilterChainContinued (pathmatchingfilter.java:203)
At Org.apache.shiro.web.filter.PathMatchingFilter.preHandle (pathmatchingfilter.java:178)
At Org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal (advicefilter.java:131)
At Org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter (onceperrequestfilter.java:125)
At Org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter (proxiedfilterchain.java:66)
At Org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain (abstractshirofilter.java:449)
At Org.apache.shiro.web.servlet.abstractshirofilter$1.call (abstractshirofilter.java:365)
At Org.apache.shiro.subject.support.SubjectCallable.doCall (subjectcallable.java:90)
At Org.apache.shiro.subject.support.SubjectCallable.call (subjectcallable.java:83)
At Org.apache.shiro.subject.support.DelegatingSubject.execute (delegatingsubject.java:387)
At Org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal (abstractshirofilter.java:362)
At Org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter (onceperrequestfilter.java:125)
At Org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate (delegatingfilterproxy.java:346)
At Org.springframework.web.filter.DelegatingFilterProxy.doFilter (delegatingfilterproxy.java:262)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal (characterencodingfilter.java:121)
At Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Org.springframework.orm.jpa.support.OpenEntityManagerInViewFilter.doFilterInternal ( openentitymanagerinviewfilter.java:178)
At Org.springframework.web.filter.OncePerRequestFilter.doFilter (onceperrequestfilter.java:107)
At Org.apache.catalina.core.ApplicationFilterChain.internalDoFilter (applicationfilterchain.java:241)
At Org.apache.catalina.core.ApplicationFilterChain.doFilter (applicationfilterchain.java:208)
At Org.apache.catalina.core.StandardWrapperValve.invoke (standardwrappervalve.java:220)
At Org.apache.catalina.core.StandardContextValve.invoke (standardcontextvalve.java:122)
At Org.apache.catalina.authenticator.AuthenticatorBase.invoke (authenticatorbase.java:501)
At Org.apache.catalina.core.StandardHostValve.invoke (standardhostvalve.java:171)
At Org.apache.catalina.valves.ErrorReportValve.invoke (errorreportvalve.java:102)
At Org.apache.catalina.core.StandardEngineValve.invoke (standardenginevalve.java:116)
At Org.apache.catalina.connector.CoyoteAdapter.service (coyoteadapter.java:408)
At Org.apache.coyote.http11.AbstractHttp11Processor.process (abstracthttp11processor.java:1040)
At Org.apache.coyote.abstractprotocol$abstractconnectionhandler.process (abstractprotocol.java:607)
At Org.apache.tomcat.util.net.jioendpoint$socketprocessor.run (jioendpoint.java:316)
At Java.util.concurrent.ThreadPoolExecutor.runWorker (threadpoolexecutor.java:1145)
At Java.util.concurrent.threadpoolexecutor$worker.run (threadpoolexecutor.java:615)
At Org.apache.tomcat.util.threads.taskthread$wrappingrunnable.run (taskthread.java:61)
At Java.lang.Thread.run (thread.java:745)

Literally, that means I didn't configure credentialsmatcher, but my profile is clearly configured with

<?xml version= "1.0" encoding= "UTF-8"?> <beans "xmlns=" 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.xsd "default-lazy-init= true" > <description> Shiro configuration</description> <!--Shiro Filter--> <bean id= "Shirofilter" class=. Spring.web.ShiroFilterFactoryBean "> <property name=" SecurityManager "ref=" SecurityManager "/> <property Name= "loginurl" value= "/login.action"/> <property name= "Successurl" value= "/main.action"/> <property nam E= "Unauthorizedurl" value= "/login?unauthorized=true"/> <property name= "filterchaindefinitions" > <value
				>/login.action = authc/logout.action = logout/static/** = Anon/login!getverifycode.action = Anon /login!regetverifycode.action = Anon/login!checkVerifycode.action = Anon/login!getimagecode.action = Anon/login!checkimagecode.action = Anon/https Ervice/**=anon/app/**=anon/web/**=anon/errorpage/**=anon/** = authc </value> </property&
	Gt </bean> <!--Shiro ' s main business-tier object for web-enabled applications--> <bean id= "Securitymanage R "class=" Org.apache.shiro.web.mgt.DefaultWebSecurityManager "> <property name=" Realm "ref=" Shirodbrealm " > <property name= "CacheManager" ref= "CacheManager"/> <property name= "SessionManager" ref= "SessionManager" "/> </bean> <!--project Customization Realm--> <bean id=" Shirodbrealm "the" class= "Top.mgsoft.mvc.system.service.ShiroD Brealm "> <property name=" credentialsmatcher "ref=" Credentialsmatcher "/> </bean> <bean id=" credent Ialsmatcher "class=" MyPackage. Customcredentialsmatcher "> <constructor-arg ref=" CacheManager "/> <property name=" PasswordRetryTimeS "value=" 5 "/> </bean> <bean id=" CacheManager "class=" Org.apache.shiro.cache.ehcache.EhCacheManager "&G  
        T <property name= "Cachemanagerconfigfile" value= "Classpath:ehcache-shiro.xml"/> </bean> <!--<b Ean id= "CacheManager" class= "Org.apache.shiro.cache.MemoryConstrainedCacheManager"/>--> <bean id= " SessionManager "class=" Org.apache.shiro.web.session.mgt.DefaultWebSessionManager "> <property name=" session
        Idurlrewritingenabled "value=" false "/> <property name=" Sessionvalidationinterval "value=" 1800000 "/> <property name= "Globalsessiontimeout" value= "1800000"/> <property name= "Sessiondao" ref= "SessionDAO"/&gt
	; </bean> <bean id= "Sessiondao" class= "Org.apache.shiro.session.mgt.eis.MemorySessionDAO"/> <bean clas s= "Org.springframework.aop.framework.autoproxy.DefaultAdvisorAutoProxyCreator" depends-on= " Lifecyclebeanpostprocessor "> <property naMe= "Proxytargetclass" value= "true"/> </bean> <bean class= " Org.apache.shiro.spring.security.interceptor.AuthorizationAttributeSourceAdvisor "> <property name=" SecurityManager "ref=" SecurityManager "/> </bean> <bean id=" Lifecyclebeanpostprocessor "class=" Org.apache.shiro.spring.LifecycleBeanPostProcessor "/> </beans>



It's not scientific.

Considering that it was normal in eclipse and that all the actions were recompiled, the package that you defined, the project package, was compiled again with 1.8, and then the machine was good. And then back to 1.7, incredibly good. Speaking of which, I have to suspect that Eclipse is a bug, and I suspect that it's doing some compiling and not compiling all the files, even if our project executes Clean,maven clean and even changes the JDK version, anyway, the compilation environment I used when the project turned out to be normal, Later login not into the compile environment, and then normal after the compiler environment, in fact, is a kind of environment, is jdk7. Of course, the reason is not normal, I also suspect that with my computer installed two versions of the JDK, and the system points to the Java_home is 1.8 has a certain relationship.

But the machine is good, the server is still not, the specific reason is still unknown.

New small colleagues to help test, simply on the server and installed on the TOMCAT8 (originally is TOMCAT7), is not good, and then simply, in the server mounted on the JDK8 (the original is openjdk1.7), Tomcat8 point to Jdk8, and then on it ...

Considering the project with Jdk8 mostly, and then backward-compatible, simply let the younger colleagues will be the original Tomcat also pointed to 1.8, and then, everything is resolved.

The Final solution is to change the JDK on the server.

The final conclusion is: The problem of compiling the environment.

For your reference.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.