15:46:17.929 WARN (FailProcessor.java:28) process - Error@/admin/login :
java.lang.IllegalArgumentException: name MUST NOT NULL!
at org.nutz.dao.impl.NutDao.fetch(NutDao.java:536) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at net.wendal.nutzbook.module.admin.AuthenticationFilter.createToken(AuthenticationFilter.java:35) ~[classes/:?]
at net.wendal.nutzbook.module.admin.AuthenticationFilter.match(AuthenticationFilter.java:47) ~[classes/:?]
at org.nutz.mvc.impl.processor.ActionFiltersProcessor.process(ActionFiltersProcessor.java:50) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.integration.shiro.NutShiroProcessor.process(NutShiroProcessor.java:126) ~[nutz-integration-shiro-1.r.58.jar:?]
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.processor.ModuleProcessor.process(ModuleProcessor.java:123) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.processor.EncodingProcessor.process(EncodingProcessor.java:27) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor.process(UpdateRequestAttributesProcessor.java:15) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at net.wendal.nutzbook.mvc.DailyUniqueUsersProcessor.process(DailyUniqueUsersProcessor.java:48) ~[classes/:?]
at org.nutz.mvc.impl.processor.AbstractProcessor.doNext(AbstractProcessor.java:44) ~[nutz-1.r.59-SNAPSHOT.jar:?]
at net.wendal.nutzbook.mvc.LogTimeProcessor.process(LogTimeProcessor.java:19) ~[classes/:?]
at org.nutz.mvc.impl.NutActionChain.doChain(NutActionChain.java:44) [nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.impl.ActionInvoker.invoke(ActionInvoker.java:68) [nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.ActionHandler.handle(ActionHandler.java:31) [nutz-1.r.59-SNAPSHOT.jar:?]
at org.nutz.mvc.NutFilter.doFilter(NutFilter.java:198) [nutz-1.r.59-SNAPSHOT.jar:?]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:9.0.0.M17]
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:168) [cors-filter-1.7.jar:1.7]
at com.thetransactioncompany.cors.CORSFilter.doFilter(CORSFilter.java:233) [cors-filter-1.7.jar:1.7]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:9.0.0.M17]
at com.alibaba.druid.support.http.WebStatFilter.doFilter(WebStatFilter.java:123) [druid-1.0.25.jar:1.0.25]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:9.0.0.M17]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:61) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.executeChain(AdviceFilter.java:108) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.AdviceFilter.doFilterInternal(AdviceFilter.java:137) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.ProxiedFilterChain.doFilter(ProxiedFilterChain.java:66) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.AbstractShiroFilter.executeChain(AbstractShiroFilter.java:449) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.AbstractShiroFilter$1.call(AbstractShiroFilter.java:365) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.subject.support.SubjectCallable.doCall(SubjectCallable.java:90) [shiro-core-1.3.2.jar:1.3.2]
at org.apache.shiro.subject.support.SubjectCallable.call(SubjectCallable.java:83) [shiro-core-1.3.2.jar:1.3.2]
at org.apache.shiro.subject.support.DelegatingSubject.execute(DelegatingSubject.java:383) [shiro-core-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.AbstractShiroFilter.doFilterInternal(AbstractShiroFilter.java:362) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.shiro.web.servlet.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:125) [shiro-web-1.3.2.jar:1.3.2]
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:199) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:96) [catalina.jar:9.0.0.M17]
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:474) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140) [catalina.jar:9.0.0.M17]
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79) [catalina.jar:9.0.0.M17]
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:624) [catalina.jar:9.0.0.M17]
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87) [catalina.jar:9.0.0.M17]
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349) [catalina.jar:9.0.0.M17]
at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:495) [tomcat-coyote.jar:9.0.0.M17]
at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66) [tomcat-coyote.jar:9.0.0.M17]
at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:767) [tomcat-coyote.jar:9.0.0.M17]
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1347) [tomcat-coyote.jar:9.0.0.M17]
at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49) [tomcat-coyote.jar:9.0.0.M17]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:1.8.0_102]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:1.8.0_102]
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61) [tomcat-util.jar:9.0.0.M17]
at java.lang.Thread.run(Thread.java:745) [?:1.8.0_102]
11 回复
public class AuthenticationFilter extends FormAuthenticationFilter implements ActionFilter {
protected AuthenticationToken createToken(HttpServletRequest request) {
String username = getUsername(request);
String password = getPassword(request);
boolean rememberMe = isRememberMe(request);
String host = getHost(request);
Ioc ioc = Mvcs.getIoc();
Dao dao = ioc.get(Dao.class);
User user = dao.fetch(User.class, username);
Role admin = dao.fetch(Role.class, "admin");
int count = dao.count("t_user_role", Cnd.where("u_id", "=", user.getId()).and("role_id", "=", admin.getId()));
if(count <= 0){
return new UsernamePasswordToken("", "", rememberMe, host);
}
return new UsernamePasswordToken(username, password, rememberMe, host);
}
@Override
public View match(ActionContext actionContext) {
HttpServletRequest request = actionContext.getRequest();
AuthenticationToken authenticationToken = createToken(request);
request.setAttribute("loginToken", authenticationToken);
return null;
}
}
登陆页面freemarker,没改过
<table width="100%" border="0" align="center" cellpadding="0" cellspacing="5">
<tr>
<td width="91" height="40" align="right"><strong> <@s.m "login.username"/>:</strong></td>
<td width="211"><input type="input" id="username" name="username" value="admin" vld="{required:true}" maxlength="100" class="input" onblur="check_name()"/><div id="name_msg" style="display:block;"></div></td>
</tr>
<#if errorRemaining?? && errorRemaining<=0>
<tr>
<td colspan="2" align="center"><img src="${base}/captcha.svl" onclick="this.src='${base}/captcha.svl?d='+new Date()*1"/></td>
</tr>
<tr>
<td height="40" align="right"><strong></strong></td>
<td><input name="captcha" type="text" id="captcha" vld="{required:true}" class="input"/></td>
</tr>
</#if>
<tr>
<td height="40" colspan="2" align="center">
<input type="image" src="${base}/res/cms/img/login/login.jpg" name="submit" />
<img name="reg" style="cursor: pointer" src="${base}/res/cms/img/login/reset.jpg" onclick="document.forms[0].reset()" /> </td>
</tr>
</table></td>
添加回复
请先登陆