NutzCN Logo
问答 module入口函数不执行
发布于 2860天前 作者 老司机 1706 次浏览 复制 上一个帖子 下一个帖子
标签:

RT,一个很普通的jsp,找到module后就没了,也不报错
jsp

<body>
<shiro:guest>
    <form id="login_form" method="post">
        <input id="user_name" name="user_name"><br>
        <input id="user_password" name="user_password"><br>
        <a href="#" id="submit_button"></a><a href="#" id="reset_button"></a>
    </form>
</shiro:guest>
<shiro:user>
    <shiro:principal/><a href="${base}/user/logout" id="logout_button"></a>
</shiro:user>
<script>
    $('#login_form').form({
        url: "${base}/user/login",
        dataType: "json",
        onSubmit: function () {
            return $('#login_form').form('validate');
        },
        success: function () {            
                location.reload()
        }
    });
    $('#user_name').textbox({
        width: 250,
        prompt: "请输入用户名",
        label: "${msg['user.user_name']}",
        validateOnCreate: false,
        validateOnBlur: true,
        required: true,
        validType: {length: [2, 10]}
    });
    $('#user_password').passwordbox({
        width: 250,
        prompt: "请输入密码",
        label: "${msg['user.user_password']}",
        validateOnCreate: false,
        validateOnBlur: true,
        required: true,
        validType: {length: [4, 10]}
    });
    $('#submit_button').linkbutton({
        text: "登录",
        onClick: function () {
            $('#login_form').form('submit')
        }
    });
    $('#reset_button').linkbutton({
        text: "重置",
        onClick: function () {
            $('#login_form').form('reset')
        }
    });
    $('#logout_button').linkbutton({
        text: "登出"
    })
</script>

model

 @At
    @POST
    @Ok("json")
    public JsonResp<Void> login(@Param("user_name") String name, @Param("user_password") String password, HttpSession session) {
        String userName = userService.login(name, password);

日志

2017-02-22 21:04:48,397 org.nutz.mvc.impl.UrlMappingImpl.get(UrlMappingImpl.java:101) DEBUG - Found mapping for [POST] path=/user/login : UserModule.login(UserModule.java:35)
2017-02-22 21:04:48,398 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userModule'<class petMall.module.UserModule>
2017-02-22 21:04:48,400 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=userModule
2017-02-22 21:04:48,400 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(userModule) in AnnotationIocLoader(packages=[petMall])
2017-02-22 21:04:48,400 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'userModule'<class petMall.module.UserModule>
2017-02-22 21:04:48,401 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class petMall.module.UserModule without AOP
2017-02-22 21:04:48,401 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'userModule' to [app] 
2017-02-22 21:04:48,405 org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:64) DEBUG - name=userService not found, search for type=petMall.service.UserService
2017-02-22 21:04:48,405 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=conf
2017-02-22 21:04:48,405 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(conf) in JsonLoader(paths=[ioc/])
2017-02-22 21:04:48,405 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dao
2017-02-22 21:04:48,406 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(dao) in JsonLoader(paths=[ioc/])
2017-02-22 21:04:48,406 org.nutz.ioc.loader.map.MapLoader.load(MapLoader.java:67) DEBUG - Loading define for name=dataSource
2017-02-22 21:04:48,406 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(dataSource) in JsonLoader(paths=[ioc/])
2017-02-22 21:04:48,406 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(userServiceImpl) in AnnotationIocLoader(packages=[petMall])
2017-02-22 21:04:48,406 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'userServiceImpl'<interface petMall.service.UserService>
2017-02-22 21:04:48,406 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:177) DEBUG - 	 >> Load definition name=userServiceImpl
2017-02-22 21:04:48,406 org.nutz.ioc.loader.combo.ComboIocLoader.load(ComboIocLoader.java:169) DEBUG - Found IocObject(userServiceImpl) in AnnotationIocLoader(packages=[petMall])
2017-02-22 21:04:48,407 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:209) DEBUG - 	 >> Make...'userServiceImpl'<interface petMall.service.UserService>
2017-02-22 21:04:48,407 org.nutz.ioc.aop.impl.DefaultMirrorFactory.getMirror(DefaultMirrorFactory.java:70) DEBUG - Load class petMall.service.impl.UserServiceImpl without AOP
2017-02-22 21:04:48,407 org.nutz.ioc.impl.ScopeContext.save(ScopeContext.java:64) DEBUG - Save object 'userServiceImpl' to [app] 
2017-02-22 21:04:48,408 org.nutz.service.EntityService.<init>(EntityService.java:41) DEBUG - Get TypeParams for self : petMall.bean.User
2017-02-22 21:04:48,408 org.nutz.ioc.impl.NutIoc.get(NutIoc.java:151) DEBUG - Get 'dao'<>

也不报错,断点在第一行,但根本没经来

11 回复

我猜是数据库没连上

是不是把某些日志给屏蔽了??

@wendal 数据库连上了,下面粘下shiro的部分日志,没看懂

2017-02-22 22:14:29,429 org.apache.shiro.web.env.EnvironmentLoader.initEnvironment(EnvironmentLoader.java:128) INFO  - Starting Shiro environment initialization.
2017-02-22 22:14:29,445 org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:76) DEBUG - Checking any specified config locations.
2017-02-22 22:14:29,445 org.apache.shiro.web.env.IniWebEnvironment.init(IniWebEnvironment.java:81) DEBUG - No INI instance or config locations specified.  Trying default config locations.
2017-02-22 22:14:29,451 org.apache.shiro.io.ResourceUtils.loadFromClassPath(ResourceUtils.java:159) DEBUG - Opening resource from class path [shiro.ini]
2017-02-22 22:14:29,458 org.apache.shiro.config.Ini.load(Ini.java:351) DEBUG - Parsing [main]
2017-02-22 22:14:29,460 org.apache.shiro.config.Ini.load(Ini.java:351) DEBUG - Parsing [urls]
2017-02-22 22:14:29,461 org.apache.shiro.web.env.IniWebEnvironment.getDefaultIni(IniWebEnvironment.java:136) DEBUG - Discovered non-empty INI configuration at location 'classpath:shiro.ini'.  Using for configuration.
2017-02-22 22:14:29,467 org.apache.shiro.config.IniFactorySupport.createInstance(IniFactorySupport.java:122) DEBUG - Creating instance from Ini [sections=main,urls]
2017-02-22 22:14:29,650 org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:234) DEBUG - No authorizationCache instance set.  Checking for a cacheManager...
2017-02-22 22:14:29,651 org.apache.shiro.realm.AuthorizingRealm.getAuthorizationCacheLazy(AuthorizingRealm.java:248) DEBUG - No cache or cacheManager properties have been set.  Authorization cache cannot be obtained.
2017-02-22 22:14:29,652 org.apache.shiro.config.ReflectionBuilder.createNewInstance(ReflectionBuilder.java:296) INFO  - An instance with name 'authc' already exists.  Redefining this object as a new instance of type org.nutz.integration.shiro.SimpleAuthenticationFilter
2017-02-22 22:14:29,681 org.apache.commons.beanutils.converters.AbstractConverter.setDefaultValue(AbstractConverter.java:336) DEBUG - Setting default value: false
2017-02-22 22:14:29,682 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:127) DEBUG - Converting 'Boolean' value 'false' to type 'Boolean'
2017-02-22 22:14:29,682 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:149) DEBUG -     No conversion required, value is already a Boolean
2017-02-22 22:14:29,684 org.apache.commons.beanutils.converters.AbstractConverter.setDefaultValue(AbstractConverter.java:336) DEBUG - Setting default value: 0
2017-02-22 22:14:29,684 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:127) DEBUG - Converting 'Integer' value '0' to type 'Byte'
2017-02-22 22:14:29,685 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:158) DEBUG -     Converted to Byte value '0'
2017-02-22 22:14:29,686 org.apache.commons.beanutils.converters.AbstractConverter.setDefaultValue(AbstractConverter.java:336) DEBUG - Setting default value:  
2017-02-22 22:14:29,687 org.apache.commons.beanutils.converters.AbstractConverter.convert(AbstractConverter.java:127) DEBUG - Converting 'Character' value ' ' to type 'Character'

@wendal 没有屏蔽就是DEBUG - Get 'dao'<>突然就停了,什么都没发生,关键是前面ajax竟然是走的success的方法(data是)

不用管shiro的日志.

哪里看出来数据库连上呢? 你贴的日志里面并没有反应出来

是不是log4j配了什么异步日志??

@wendal

2017-02-22 22:14:30,727 org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:188) DEBUG - select expert : org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert
2017-02-22 22:14:30,732 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:199) DEBUG - JDBC Driver --> mysql-connector-java-5.1.40 ( Revision: 402933ef52cad9aa82624e80acbea46e3a701ce6 )
2017-02-22 22:14:30,732 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:200) DEBUG - JDBC Name   --> MySQL Connector Java
2017-02-22 22:14:30,733 org.nutz.dao.impl.DaoSupport$1.invoke(DaoSupport.java:202) DEBUG - JDBC URL    --> jdbc:mysql://localhost:3306/pet_mall?characterEncoding=utf8&useSSL=true
2017-02-22 22:14:30,824 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_client=utf8
2017-02-22 22:14:30,824 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_connection=utf8
2017-02-22 22:14:30,824 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_database=utf8
2017-02-22 22:14:30,825 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_filesystem=binary
2017-02-22 22:14:30,825 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_results=
2017-02-22 22:14:30,825 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_server=utf8
2017-02-22 22:14:30,825 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_set_system=utf8
2017-02-22 22:14:30,825 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:212) DEBUG - Mysql : character_sets_dir=D:\Program Files\MySQL\MySQL Server 5.7\share\charsets\
2017-02-22 22:14:30,827 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:219) DEBUG - Mysql : binlog_format=ROW
2017-02-22 22:14:30,828 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:226) DEBUG - Mysql : database=pet_mall
2017-02-22 22:14:30,829 org.nutz.dao.impl.jdbc.mysql.MysqlJdbcExpert.checkDataSource(MysqlJdbcExpert.java:232) DEBUG - Mysql : user=root@localhost
2017-02-22 22:14:30,857 org.nutz.dao.impl.DaoSupport.setDataSource(DaoSupport.java:221) DEBUG - Database info --> MYSQL:[MySQL - 5.7.17-log]
2017-02-22 22:14:35,391 org.nutz.resource.Scans.scan(Scans.java:274) DEBUG - Found 2 resource by src( petMall/bean/ ) , regex( ^.+[.]class$ )
2017-02-22 22:14:35,458 org.nutz.dao.impl.sql.run.NutDaoExecutor.printSQL(NutDaoExecutor.java:388) DEBUG - SELECT COUNT(*) FROM t_user 
2017-02-22 22:14:35,460 org.nutz.mvc.impl.NutLoading.load(NutLoading.java:141) INFO  - Nutz.Mvc[nutz] is up in 5324ms
[2017-02-22 10:14:35,486] Artifact petMall:war exploded: Artifact is deployed successfully
[2017-02-22 10:14:35,486] Artifact petMall:war exploded: Deploy took 7,359 milliseconds

mainsetup里面有migration,所以每次启动都会连

之所以没有sql出来,是因为走缓存了吧?

@wendal 上面那条回复里面有SELECT COUNT(*) FROM t_user ,而且我没配缓存

是不是配了@Filters, 在类上,或者MainModule上

@wendal 果然是改shiro注解的时候老fiters没删干净……

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