shrio学习Unable to instantiate class ["org.apache.shiro.authc.credential.HashedCredentialsMatcher"]

今天在学习到自定义realm中,使用的加盐的方式,配置ini文件中遇到如下的问题。开始很是不了解。

来看一下报错的代码。将断点到ReflectionBuilder中。

    at org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:151)
    at org.apache.shiro.config.ReflectionBuilder.buildObjects(ReflectionBuilder.java:119)

进入到创建实例的方法。

protected void createNewInstance(Map objects, String name, String value) {
        Object currentInstance = objects.get(name);
        if (currentInstance != null) {
            log.info("An instance with name '{}' already exists.  Redefining this object as a new instance of type {}", name, value);
        }

        Object instance;
        try {
            instance = ClassUtils.newInstance(value);
            if (instance instanceof Nameable) {
                ((Nameable)instance).setName(name);
            }
        } catch (Exception var8) {
            String msg = "Unable to instantiate class [" + value + "] for object named '" + name + "'.  " + "Please ensure you've specified the fully qualified class name correctly.";
            throw new ConfigurationException(msg, var8);
        }

        objects.put(name, instance);
    }

看到这样的问题。

shrio学习Unable to instantiate class [

原来是多配置了引号。

#定义认证匹配器
credentialsMatcher="org.apache.shiro.authc.credential.HashedCredentialsMatcher"

 

你可能感兴趣的:(JAVA)