NutzCN Logo
问答 《入门手册》 3.11UserModule 映射路径错误
发布于 3179天前 作者 dahaoqiu 1634 次浏览 复制 上一个帖子 下一个帖子
标签:

UserModule是按照手册上面复制的,
package net.wendal.nutzbook.module;
import net.wendal.nutzbook.bean.User;
import org.nutz.dao.Dao;
import org.nutz.ioc.loader.annotation.Inject;
import org.nutz.ioc.loader.annotation.IocBean;
import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Ok;
@IocBean
@At("/user")
@Ok("json")
@Fail("http:500")
public class UserModule {
@Inject
protected Dao dao;
@At
public int count() {
return dao.count(User.class);
}

}

路径是这样,Search mapping for path=/ : NOT Action match

8 回复

这入口方法的路径是 /user/count 呢, 访问/当然不存在

我说错了,是报错是这个16-3-3 11:52:9.137 DEBUG [http-8080-2] Search mapping for path=/ : NOT Action match

@wendal 说找不到这个路径,在console里面是这样
16-3-3 11:52:9.137 DEBUG [http-8080-2] Search mapping for path=/ : NOT Action match

如果只写到这, /的确没有入口方法对应呢

@wendal 遇到过么大神,这咋办?

我晕, 就是没有啊, 很正常啊, 因为的确没有啊, 到这一步的时候才写了一个入口方法, 映射的路径是 /user/count

@wendal http://127.0.0.1:8080/nutzbook/user/count 访问报404是正常的?
6-3-3 11:52:7.600 DEBUG [main] Get 'dataSource'<>
16-3-3 11:52:7.608 DEBUG [main] NutDao[_selfId=0] init ...
16-3-3 11:52:7.636 INFO [main] Init file-pool by: C:\Users\lutao/.nutz/tmp/dao/ [200000]
16-3-3 11:52:7.637 DEBUG [main] file-pool.home: 'C:\Users\lutao.nutz\tmp\dao'
16-3-3 11:52:7.638 INFO [main] file-pool.cursor: 0
16-3-3 11:52:7.648 DEBUG [main] Jdbcs init complete
16-3-3 11:52:7.648 INFO [main] Get Connection from DataSource for JdbcExpert, if I lock at here, check your database server and configure
16-3-3 11:52:7.895 DEBUG [main] JDBC Driver --> mysql-connector-java-5.1.38 ( Revision: fe541c166cec739c74cc727c5da96c1028b4834a )
16-3-3 11:52:7.895 DEBUG [main] JDBC Name --> MySQL Connector Java
16-3-3 11:52:7.896 DEBUG [main] JDBC URL --> jdbc:mysql://127.0.0.1:3306/nutzbook
16-3-3 11:52:7.905 DEBUG [main] Mysql : character_set_client=latin1
16-3-3 11:52:7.905 DEBUG [main] Mysql : character_set_connection=latin1
16-3-3 11:52:7.906 DEBUG [main] Mysql : character_set_database=utf8
16-3-3 11:52:7.906 DEBUG [main] Mysql : character_set_filesystem=binary
16-3-3 11:52:7.907 DEBUG [main] Mysql : character_set_results=
16-3-3 11:52:7.907 DEBUG [main] Mysql : character_set_server=latin1
16-3-3 11:52:7.908 DEBUG [main] Mysql : character_set_system=utf8
16-3-3 11:52:7.908 DEBUG [main] Mysql : character_sets_dir=E:\tools\MySQL Server 5.5\share\charsets\
16-3-3 11:52:7.909 DEBUG [main] Mysql : database=nutzbook
16-3-3 11:52:7.909 DEBUG [main] Mysql : user=root@localhost
16-3-3 11:52:7.928 DEBUG [main] Database info --> MYSQL:[MySQL - 5.5.28]
16-3-3 11:52:7.940 DEBUG [main] Found 4 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
16-3-3 11:52:8.20 DEBUG [main] SELECT COUNT(*) FROM t_user
16-3-3 11:52:8.21 INFO [main] Nutz.Mvc[nutz] is up in 814ms
2016-3-3 11:52:08 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor host-manager.xml
2016-3-3 11:52:08 org.apache.catalina.startup.HostConfig deployDescriptor
信息: Deploying configuration descriptor manager.xml
2016-3-3 11:52:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory docs
2016-3-3 11:52:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory examples
2016-3-3 11:52:08 org.apache.catalina.core.ApplicationContext log
信息: ContextListener: contextInitialized()
2016-3-3 11:52:08 org.apache.catalina.core.ApplicationContext log
信息: SessionListener: contextInitialized()
2016-3-3 11:52:08 org.apache.catalina.startup.HostConfig deployDirectory
信息: Deploying web application directory ROOT
2016-3-3 11:52:08 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2016-3-3 11:52:08 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2016-3-3 11:52:08 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/26 config=null
2016-3-3 11:52:08 org.apache.catalina.startup.Catalina start
信息: Server startup in 2825 ms
16-3-3 11:52:9.137 DEBUG [http-8080-2] Search mapping for path=/ : NOT Action match

@wendal 哈哈,多谢了,我解决了

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