NutzCN Logo
问答 nutzboot的demo启动后index页面正常,但是页面里所有的数据请求接口都是404
发布于 2069天前 作者 suyun 1816 次浏览 复制 上一个帖子 下一个帖子
标签:

刷新index页面后,控制台日志

[DEBUG] 17:22:04.299 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:712) - Processing socket [org.apache.tomcat.util.net.NioChannel@80f00ef:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:55312]] with status [OPEN_READ]
[DEBUG] 17:22:04.300 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:724) - Found processor [null] for socket [org.apache.tomcat.util.net.NioChannel@80f00ef:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:55312]]
[DEBUG] 17:22:04.300 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789) - Popped processor [org.apache.coyote.http11.Http11Processor@1442600b] from cache
[DEBUG] 17:22:04.301 org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:402) - Received [GET / HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Cache-Control: max-age=0
Upgrade-Insecure-Requests: 1
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,image/apng,*/*;q=0.8
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,zh-TW;q=0.8
Cookie: lastbreadTag=%E4%BF%AE%E6%94%B9; sid=6872ea45-dcd9-4eda-8ef1-bb261c7fdcbb; tagBread=%2Fplatform%2Fhome
If-None-Match: W/"4167-1555989296000"
If-Modified-Since: Tue, 23 Apr 2019 03:14:56 GMT

]
[DEBUG] 17:22:04.302 org.nutz.boot.starter.tomcat.TomcatStarter$ClasspathResourceSet.getResource(TomcatStarter.java:374) - Resource file:/F:/Programs_test/auth-1.0/target/classes/static/index.html
[DEBUG] 17:22:04.306 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:74) - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2b0be1b9:org.apache.tomcat.util.net.NioChannel@80f00ef:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:55312]], Status in: [OPEN_READ], State out: [OPEN]
[DEBUG] 17:22:04.306 org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:996) - Pushed Processor [org.apache.coyote.http11.Http11Processor@1442600b]
[DEBUG] 17:22:04.818 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:712) - Processing socket [org.apache.tomcat.util.net.NioChannel@80f00ef:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:55312]] with status [OPEN_READ]
[DEBUG] 17:22:04.819 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:724) - Found processor [null] for socket [org.apache.tomcat.util.net.NioChannel@80f00ef:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:55312]]
[DEBUG] 17:22:04.819 org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:789) - Popped processor [org.apache.coyote.http11.Http11Processor@1442600b] from cache
[DEBUG] 17:22:04.819 org.apache.coyote.http11.Http11InputBuffer.parseRequestLine(Http11InputBuffer.java:402) - Received [GET /user/query?pageSize=3&pageNumber=1 HTTP/1.1
Host: localhost:8080
Connection: keep-alive
Accept: */*
X-Requested-With: XMLHttpRequest
User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/63.0.3239.132 Safari/537.36
Referer: http://localhost:8080/
Accept-Encoding: gzip, deflate, br
Accept-Language: zh-CN,zh;q=0.9,zh-TW;q=0.8
Cookie: lastbreadTag=%E4%BF%AE%E6%94%B9; sid=6872ea45-dcd9-4eda-8ef1-bb261c7fdcbb; tagBread=%2Fplatform%2Fhome

]
[DEBUG] 17:22:04.828 org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:74) - Socket: [org.apache.tomcat.util.net.NioEndpoint$NioSocketWrapper@2b0be1b9:org.apache.tomcat.util.net.NioChannel@80f00ef:java.nio.channels.SocketChannel[connected local=/0:0:0:0:0:0:0:1:8080 remote=/0:0:0:0:0:0:0:1:55312]], Status in: [OPEN_READ], State out: [OPEN]
[DEBUG] 17:22:04.829 org.apache.coyote.AbstractProtocol$ConnectionHandler.release(AbstractProtocol.java:996) - Pushed Processor [org.apache.coyote.http11.Http11Processor@1442600b]

9 回复

没选上nutz mvc? starter-nutz-mvc

@wendal 没选MVC会生成index.html?我有点记不清有没有选择mvc了

加上依赖就好了 nutzboot-starter-nutz-mvc

还有自动搭建的MVC的项目好像不会生成ioc配置文件以及里面配置的数据源,导致MainLuncher启动的时候,在注入Dao时出错,然后程序终止了;
报错信息:

[DEBUG] 17:41:28.713 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'dao' from [app] 
[DEBUG] 17:41:28.713 org.nutz.ioc.impl.ScopeContext.remove(ScopeContext.java:85) - Remove object 'mainLauncher' from [app] 
[ERROR] 17:41:28.714 org.nutz.boot.NbApp.execute(NbApp.java:219) - something happen!!
org.nutz.ioc.IocException: IocBean[mainLauncher] throw Exception when creating
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:152)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:271)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:161)
	at org.nutz.boot.NbApp.execute(NbApp.java:209)
	at org.nutz.boot.NbApp.run(NbApp.java:178)
	at nutz.remote.auth.MainLauncher.main(MainLauncher.java:35)
Caused by: java.lang.RuntimeException: IocBean[mainLauncher] fail at field=[dao]
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:40)
	at org.nutz.ioc.weaver.DefaultWeaver.fill(DefaultWeaver.java:67)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:138)
	... 6 more
Caused by: org.nutz.ioc.IocException: IocBean[dao -> class:javax.sql.DataSource] none ioc bean match class=javax.sql.DataSource
	at org.nutz.ioc.impl.NutIoc.getByType(NutIoc.java:461)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:66)
	at org.nutz.ioc.impl.ObjectMakerImpl.make(ObjectMakerImpl.java:64)
	at org.nutz.ioc.impl.NutIoc.get(NutIoc.java:241)
	at org.nutz.ioc.val.ReferTypeValue.get(ReferTypeValue.java:60)
	at org.nutz.ioc.weaver.FieldInjector.inject(FieldInjector.java:32)
	... 8 more
[INFO ] 17:41:28.728 org.eclipse.jetty.server.AbstractConnector.doStop(AbstractConnector.java:341) - Stopped ServerConnector@26399bfd{HTTP/1.1,[http/1.1]}{127.0.0.1:8080}
[INFO ] 17:41:28.728 org.eclipse.jetty.server.session.HouseKeeper.stopScavenging(HouseKeeper.java:167) - node0 Stopped scavenging
[INFO ] 17:41:28.730 org.nutz.boot.starter.nutz.mvc.NbMvcLoading.depose(NbMvcLoading.java:54) - Nutz.Mvc[nutz] is deposing ...
[INFO ] 17:41:28.730 org.nutz.boot.starter.nutz.mvc.NbMvcLoading.depose(NbMvcLoading.java:70) - Nutz.Mvc[nutz] is down in 0ms

@wendal 恩,我看了一下,确实没选MVC

nutz dao也没选

我建议你重新生成一份吧

手动捂脸,,,nutz-dao肯定是选了,不过jdbc是没选

可以了,感谢!看来有些组件之间还有依赖的

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