Unable to execute 'doFinal' with cipher instance [javax.crypto.Cipher@3d52dc...
报错内容:org.apache.shiro.crypto.CryptoException: Unable to execute 'doFinal' with cipher instance [javax.crypto.Cipher@58c5686a].
前提: http://localhost:8080/emp/list 需要认证;
复现方法:当http://localhost:8080/emp/list没有认证的时候,访问该地址,跳转到登入页面,且报错:
org.apache.shiro.crypto.CryptoException: Unable to execute 'doFinal' with cipher instance [javax.crypto.Cipher@58c5686a].;
解决办法:在realm配置中加入
1 <bean id="jdbcRealm" class="ssm.shiro.ShiroRealm"> 2 <property name="credentialsMatcher"> 3 <bean 4 class="org.apache.shiro.authc.credential.HashedCredentialsMatcher"> 5 6 <property name="hashAlgorithmName" value="MD5">property> 7 8 <property name="hashIterations" value="1024">property> 9 <property name="storedCredentialsHexEncoded" value="true"/> 10 bean> 11 property> 12 bean> 13 <bean id="secondShiroRealm" class="ssm.shiro.SecondShiroRealm"> 14 <property name="credentialsMatcher"> 15 <bean 16 class="org.apache.shiro.authc.credential.HashedCredentialsMatcher"> 17 18 <property name="hashAlgorithmName" value="SHA1">property> 19 20 <property name="hashIterations" value="1024">property> 21 <property name="storedCredentialsHexEncoded" value="true"/> 22 bean> 23 property> 24 bean>