NutzCN Logo
问答 nutzboot shiro配置 访问503
发布于 2042天前 作者 Hamming 1443 次浏览 复制 上一个帖子 下一个帖子
标签:

nutzboot shiro配置 访问503
配置

##shiro
shiro.ini.urls:
shiro.url.login=/login
shiro.url.unauth=/login
/static = anon
/login = anon
/sys = authc
package io.nutz.nutzsite.module.sys.controllers;

import io.nutz.nutzsite.common.base.Result;
import io.nutz.nutzsite.common.exception.EmptyCaptchaException;
import io.nutz.nutzsite.common.exception.IncorrectCaptchaException;
import io.nutz.nutzsite.common.shiro.filter.AuthenticationFilter;
import io.nutz.nutzsite.module.sys.models.User;
import io.nutz.nutzsite.module.sys.services.UserService;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.AuthenticationException;
import org.apache.shiro.authc.AuthenticationToken;
import org.apache.shiro.authc.LockedAccountException;
import org.apache.shiro.authc.UnknownAccountException;
import org.apache.shiro.crypto.hash.Sha256Hash;
import org.apache.shiro.subject.Subject;
import org.apache.shiro.util.ThreadContext;
import org.nutz.dao.Chain;
import org.nutz.dao.Cnd;
import org.nutz.dao.Dao;
import org.nutz.integration.shiro.SimpleShiroToken;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Strings;
import org.nutz.mvc.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpSession;

@At("/login")
@IocBean
public class LoginController {

    @Inject
    private UserService userService;


    @GET
    @At({"","/login"})
    @Ok("th:/login.html")
    public void loginPage() {

    }


    @Ok("json")
    @Fail("http:500")
    @POST
    @At("/login")
    @Filters(@By(type = AuthenticationFilter.class))
    public Result login(@Attr("loginToken") AuthenticationToken token, HttpServletRequest req, HttpSession session) {
        int errCount = 0;
        try {
            //输错三次显示验证码窗口
            errCount = NumberUtils.toInt(Strings.sNull(SecurityUtils.getSubject().getSession(true).getAttribute("errCount")));
            Subject subject = SecurityUtils.getSubject();
            ThreadContext.bind(subject);
            subject.login(token);
            User user = (User) subject.getPrincipal();
//            int count = user.getLoginCount() == null ? 0 : user.getLoginCount();
            userService.update(Chain.make("login_ip", user.getLoginIp()));
            return Result.success("login.success");
        } catch (IncorrectCaptchaException e) {
            //自定义的验证码错误异常
            return Result.error(1, "login.error.captcha");
        } catch (EmptyCaptchaException e) {
            //验证码为空
            return Result.error(2, "login.error.captcha");
        } catch (LockedAccountException e) {
            return Result.error(3, "login.error.locked");
        } catch (UnknownAccountException e) {
            errCount++;
            SecurityUtils.getSubject().getSession(true).setAttribute("errCount", errCount);
            return Result.error(4, "login.error.user");
        } catch (AuthenticationException e) {
            errCount++;
            SecurityUtils.getSubject().getSession(true).setAttribute("errCount", errCount);
            return Result.error(5, "login.error.user");
        } catch (Exception e) {
            errCount++;
            SecurityUtils.getSubject().getSession(true).setAttribute("errCount", errCount);
            return Result.error(6, "login.error.system");
        }
    }

    @Ok("th:/index.html")
    @At
    public void logout() {
        Subject subject = SecurityUtils.getSubject();
        if (subject.isAuthenticated()) {
            subject.logout();
        }
    }

}

package io.nutz.nutzsite.common.shiro;

import io.nutz.nutzsite.common.exception.EmptyCaptchaException;
import io.nutz.nutzsite.common.exception.IncorrectCaptchaException;
import io.nutz.nutzsite.module.sys.models.User;
import io.nutz.nutzsite.module.sys.services.UserService;
import org.apache.commons.lang3.math.NumberUtils;
import org.apache.shiro.SecurityUtils;
import org.apache.shiro.authc.*;
import org.apache.shiro.authc.credential.CredentialsMatcher;
import org.apache.shiro.authz.AuthorizationException;
import org.apache.shiro.authz.AuthorizationInfo;
import org.apache.shiro.authz.SimpleAuthorizationInfo;
import org.apache.shiro.cache.CacheManager;
import org.apache.shiro.subject.PrincipalCollection;
import org.apache.shiro.util.ByteSource;
import org.nutz.integration.shiro.AbstractSimpleAuthorizingRealm;
import org.nutz.integration.shiro.SimpleShiroToken;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.lang.Lang;
import org.nutz.lang.Strings;

import java.util.Set;

/**
 * 自定义Realm 处理登录 权限
 */
@IocBean(name = "shiroRealm", fields = "dao")
public class UserRealm extends AbstractSimpleAuthorizingRealm {
    @Inject
    private UserService userService;

    /**
     * 授权
     * @param principals
     * @return
     */
    @Override
    protected AuthorizationInfo doGetAuthorizationInfo(PrincipalCollection principals) {
        // null usernames are invalid
        if (principals == null) {
            throw new AuthorizationException("PrincipalCollection method argument cannot be null.");
        }
        String userId = String.valueOf(principals.getPrimaryPrincipal());
        User user = dao().fetch(User.class, userId);
        if (user == null) {
            return null;
        }
        // 角色列表
        Set<String> roles =userService.getRoleCodeList(user);
        // 功能列表
        Set<String> menus = userService.getMenuPermsList(user);

        SimpleAuthorizationInfo auth = new SimpleAuthorizationInfo();
		auth.setRoles(roles);
		auth.setStringPermissions(menus);
        return auth;
    }

    /**
     * 登录验证
     * @param token
     * @return
     * @throws AuthenticationException
     */
    @Override
    protected AuthenticationInfo doGetAuthenticationInfo(AuthenticationToken token) throws AuthenticationException {
        CaptchaToken authcToken = (CaptchaToken) token;
        String loginname = authcToken.getUsername();
        String captcha = authcToken.getCaptcha();
        if (Strings.isBlank(loginname)) {
            throw Lang.makeThrow(AuthenticationException.class, "Account name is empty");
        }
        User user = dao().fetch(User.class,loginname);
        if (Lang.isEmpty(user)) {
            throw Lang.makeThrow(UnknownAccountException.class, "Account [ %s ] not found", loginname);
        }
        int errCount = NumberUtils.toInt(Strings.sNull(SecurityUtils.getSubject().getSession(true).getAttribute("errCount")));
        if (errCount > 2) {
            //输错三次显示验证码窗口
            if (Strings.isBlank(captcha)) {
                throw Lang.makeThrow(EmptyCaptchaException.class, "Captcha is empty");
            }
            String _captcha = Strings.sBlank(SecurityUtils.getSubject().getSession(true).getAttribute("captcha"));
            if (!authcToken.getCaptcha().equalsIgnoreCase(_captcha)) {
                throw Lang.makeThrow(IncorrectCaptchaException.class, "Captcha is error");
            }
        }
        if (user.isStatus()) {
            throw Lang.makeThrow(LockedAccountException.class, "Account [ %s ] is locked.", loginname);
        }
        //设置验证码次数为零
        SecurityUtils.getSubject().getSession(true).setAttribute("errCount", 0);
        SimpleAuthenticationInfo info = new SimpleAuthenticationInfo(user, user.getPassword(), getName());
        info.setCredentialsSalt(ByteSource.Util.bytes(user.getSalt()));
        return info;
    }

    public UserRealm() {
        this(null, null);
    }

    public UserRealm(CacheManager cacheManager, CredentialsMatcher matcher) {
        super(cacheManager, matcher);
        setAuthenticationTokenClass(SimpleShiroToken.class);
    }

    public UserRealm(CacheManager cacheManager) {
        this(cacheManager, null);
    }

    public UserRealm(CredentialsMatcher matcher) {
        this(null, matcher);
    }

}

是我哪里配置不对吗
项目地址
https://github.com/HaimmingYu/ns

5 回复

没有日志?

错误信息

thymeleaf.dialects=nz.net.ultraq.thymeleaf.LayoutDialect
[DEBUG] 10:10:32.125 org.apache.shiro.config.Ini.load(Ini.java:351) - Parsing [urls]
[DEBUG] 10:10:32.129 org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:122) - Creating instance from Ini [sections=urls]
[DEBUG] 10:10:32.131 org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:127) - Creating chain [shiro.url.login] from String definition [/login/]
[ERROR] 10:10:32.132 org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:146) - Shiro environment initialization failed
java.lang.IllegalArgumentException: There is no filter with name '/login/' to apply to chain [shiro.url.login] in the pool of available Filters.  Ensure a filter with that name/path has first been registered with the addFilter method(s).
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.addToChain(DefaultFilterChainManager.java:265)
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:148)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createChains(IniFilterChainResolverFactory.java:192)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.buildChains(IniFilterChainResolverFactory.java:127)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:80)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:43)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.createFilterChainResolver(NbResourceBasedWebEnvironment.java:86)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.configure(NbResourceBasedWebEnvironment.java:67)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.init(NbResourceBasedWebEnvironment.java:39)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
	at org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
	at org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
	at org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
	at org.nutz.boot.starter.shiro.NbShiroEnvironmentLoaderListener.contextInitialized(NbShiroEnvironmentLoaderListener.java:40)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.lambda$contextInitialized$1(NbServletContextListener.java:109)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.contextInitialized(NbServletContextListener.java:104)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:957)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:922)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365)
	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
	at org.eclipse.jetty.server.Server.start(Server.java:415)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
	at org.eclipse.jetty.server.Server.doStart(Server.java:382)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.nutz.boot.starter.jetty.JettyStarter.start(JettyStarter.java:137)
	at org.nutz.boot.AppContext.startServers(AppContext.java:310)
	at org.nutz.boot.NbApp.execute(NbApp.java:206)
	at org.nutz.boot.NbApp.run(NbApp.java:178)
	at io.nutz.nutzsite.MainLauncher.main(MainLauncher.java:56)
[WARN ] 10:10:32.135 org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:554) - Failed startup of context o.e.j.w.WebAppContext@34f392be{/,[file:///Users/apple/IdeaProjects/ns/src/main/resources/static/, file:///Users/apple/IdeaProjects/ns/target/classes/static/, jar:file:/Users/apple/.m2/repository/org/nutz/nutzboot-starter-swagger/2.3.3.v20190329/nutzboot-starter-swagger-2.3.3.v20190329.jar!/static/],UNAVAILABLE}
java.lang.IllegalArgumentException: There is no filter with name '/login/' to apply to chain [shiro.url.login] in the pool of available Filters.  Ensure a filter with that name/path has first been registered with the addFilter method(s).
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.addToChain(DefaultFilterChainManager.java:265)
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:148)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createChains(IniFilterChainResolverFactory.java:192)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.buildChains(IniFilterChainResolverFactory.java:127)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:80)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:43)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.createFilterChainResolver(NbResourceBasedWebEnvironment.java:86)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.configure(NbResourceBasedWebEnvironment.java:67)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.init(NbResourceBasedWebEnvironment.java:39)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
	at org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
	at org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
	at org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
	at org.nutz.boot.starter.shiro.NbShiroEnvironmentLoaderListener.contextInitialized(NbShiroEnvironmentLoaderListener.java:40)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.lambda$contextInitialized$1(NbServletContextListener.java:109)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.contextInitialized(NbServletContextListener.java:104)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:957)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:922)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365)
	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
	at org.eclipse.jetty.server.Server.start(Server.java:415)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
	at org.eclipse.jetty.server.Server.doStart(Server.java:382)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.nutz.boot.starter.jetty.JettyStarter.start(JettyStarter.java:137)
	at org.nutz.boot.AppContext.startServers(AppContext.java:310)
	at org.nutz.boot.NbApp.execute(NbApp.java:206)
	at org.nutz.boot.NbApp.run(NbApp.java:178)
	at io.nutz.nutzsite.MainLauncher.main(MainLauncher.java:56)
[INFO ] 10:10:32.178 org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:292) - Started ServerConnector@65ed8cc8{HTTP/1.1,[http/1.1]}{127.0.0.1:8090}
[INFO ] 10:10:32.178 org.eclipse.jetty.server.Server.doStart(Server.java:407) - Started @3133ms

原来启动就报错了嘛

顺序写错了,demo应该没错的呀,抄错了?

shiro.url.login=/login
shiro.url.unauth=/login
shiro.ini.urls:
/static = anon
/login = anon
/sys = authc

调整了 还是错误

[DEBUG] 10:29:19.432 org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:127) - Creating chain [thymeleaf.dialects] from String definition [nz.net.ultraq.thymeleaf.LayoutDialect]
[ERROR] 10:29:19.433 org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:146) - Shiro environment initialization failed
java.lang.IllegalArgumentException: There is no filter with name 'nz.net.ultraq.thymeleaf.LayoutDialect' to apply to chain [thymeleaf.dialects] in the pool of available Filters.  Ensure a filter with that name/path has first been registered with the addFilter method(s).
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.addToChain(DefaultFilterChainManager.java:265)
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:148)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createChains(IniFilterChainResolverFactory.java:192)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.buildChains(IniFilterChainResolverFactory.java:127)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:80)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:43)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.createFilterChainResolver(NbResourceBasedWebEnvironment.java:86)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.configure(NbResourceBasedWebEnvironment.java:67)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.init(NbResourceBasedWebEnvironment.java:39)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
	at org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
	at org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
	at org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
	at org.nutz.boot.starter.shiro.NbShiroEnvironmentLoaderListener.contextInitialized(NbShiroEnvironmentLoaderListener.java:40)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.lambda$contextInitialized$1(NbServletContextListener.java:109)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.contextInitialized(NbServletContextListener.java:104)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:957)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:922)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365)
	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
	at org.eclipse.jetty.server.Server.start(Server.java:415)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
	at org.eclipse.jetty.server.Server.doStart(Server.java:382)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.nutz.boot.starter.jetty.JettyStarter.start(JettyStarter.java:137)
	at org.nutz.boot.AppContext.startServers(AppContext.java:310)
	at org.nutz.boot.NbApp.execute(NbApp.java:206)
	at org.nutz.boot.NbApp.run(NbApp.java:178)
	at io.nutz.nutzsite.MainLauncher.main(MainLauncher.java:56)
[WARN ] 10:29:19.435 org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:554) - Failed startup of context o.e.j.w.WebAppContext@fabb651{/,[file:///Users/apple/IdeaProjects/ns/src/main/resources/static/, file:///Users/apple/IdeaProjects/ns/target/classes/static/, jar:file:/Users/apple/.m2/repository/org/nutz/nutzboot-starter-swagger/2.3.3.v20190329/nutzboot-starter-swagger-2.3.3.v20190329.jar!/static/],UNAVAILABLE}
java.lang.IllegalArgumentException: There is no filter with name 'nz.net.ultraq.thymeleaf.LayoutDialect' to apply to chain [thymeleaf.dialects] in the pool of available Filters.  Ensure a filter with that name/path has first been registered with the addFilter method(s).
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.addToChain(DefaultFilterChainManager.java:265)
	at org.apache.shiro.web.filter.mgt.DefaultFilterChainManager.createChain(DefaultFilterChainManager.java:148)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createChains(IniFilterChainResolverFactory.java:192)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.buildChains(IniFilterChainResolverFactory.java:127)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:80)
	at org.apache.shiro.web.config.IniFilterChainResolverFactory.createInstance(IniFilterChainResolverFactory.java:43)
	at org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:123)
	at org.apache.shiro.util.AbstractFactory.getInstance(AbstractFactory.java:47)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.createFilterChainResolver(NbResourceBasedWebEnvironment.java:86)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.configure(NbResourceBasedWebEnvironment.java:67)
	at org.nutz.boot.starter.shiro.NbResourceBasedWebEnvironment.init(NbResourceBasedWebEnvironment.java:39)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:45)
	at org.apache.shiro.util.LifecycleUtils.init(LifecycleUtils.java:40)
	at org.apache.shiro.web.env.EnvironmentLoader.createEnvironment(EnvironmentLoader.java:221)
	at org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:133)
	at org.apache.shiro.web.env.EnvironmentLoaderListener.contextInitialized(EnvironmentLoaderListener.java:58)
	at org.nutz.boot.starter.shiro.NbShiroEnvironmentLoaderListener.contextInitialized(NbShiroEnvironmentLoaderListener.java:40)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.lambda$contextInitialized$1(NbServletContextListener.java:109)
	at java.util.ArrayList.forEach(ArrayList.java:1257)
	at org.nutz.boot.starter.servlet3.NbServletContextListener.contextInitialized(NbServletContextListener.java:104)
	at org.eclipse.jetty.server.handler.ContextHandler.callContextInitialized(ContextHandler.java:957)
	at org.eclipse.jetty.servlet.ServletContextHandler.callContextInitialized(ServletContextHandler.java:553)
	at org.eclipse.jetty.server.handler.ContextHandler.startContext(ContextHandler.java:922)
	at org.eclipse.jetty.servlet.ServletContextHandler.startContext(ServletContextHandler.java:365)
	at org.eclipse.jetty.webapp.WebAppContext.startWebapp(WebAppContext.java:1497)
	at org.eclipse.jetty.webapp.WebAppContext.startContext(WebAppContext.java:1459)
	at org.eclipse.jetty.server.handler.ContextHandler.doStart(ContextHandler.java:852)
	at org.eclipse.jetty.servlet.ServletContextHandler.doStart(ServletContextHandler.java:278)
	at org.eclipse.jetty.webapp.WebAppContext.doStart(WebAppContext.java:545)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.start(ContainerLifeCycle.java:138)
	at org.eclipse.jetty.server.Server.start(Server.java:415)
	at org.eclipse.jetty.util.component.ContainerLifeCycle.doStart(ContainerLifeCycle.java:108)
	at org.eclipse.jetty.server.handler.AbstractHandler.doStart(AbstractHandler.java:113)
	at org.eclipse.jetty.server.Server.doStart(Server.java:382)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.nutz.boot.starter.jetty.JettyStarter.start(JettyStarter.java:137)
	at org.nutz.boot.AppContext.startServers(AppContext.java:310)
	at org.nutz.boot.NbApp.execute(NbApp.java:206)
	at org.nutz.boot.NbApp.run(NbApp.java:178)
	at io.nutz.nutzsite.MainLauncher.main(MainLauncher.java:56)
[INFO ] 10:29:19.477 org.eclipse.jetty.server.AbstractConnector.doStart(AbstractConnector.java:292) - Started ServerConnector@67cb6b65{HTTP/1.1,[http/1.1]}{127.0.0.1:8090}
[INFO ] 10:29:19.478 org.eclipse.jetty.server.Server.doStart(Server.java:407) - Started @3243ms
[DEBUG] 10:29:19.478 org.nutz.boot.starter.jetty.JettyStarter.start(JettyStarter.java:139) - Jetty monitor props:
----------------------------------------------
http.port                                : 8090
http.host                                : 127.0.0.1
http.idleTimeout                         : 300000
https.enable                             : false
welcome_files                            : index.html,index.htm,index.do
maxFormContentSize                       : 1073741824
----------------------------------------------

添加回复
请先登陆
回到顶部