NutzCN Logo
问答 我按照Wendal的Nutz烹调向导编写代码,运行失败,请帮忙看下,谢谢.
发布于 3268天前 作者 拨开云雾豁然开朗 1860 次浏览 复制 上一个帖子 下一个帖子
标签:

我阅读到"初始化数据"这章. 报错的. URL如下:
http://nutzbook.wendal.net/setup30mins/init_datas.html
WIN7
JDK1.7
nutz-1.b.53.jar
mysql-connector-java-5.1.37.jar
druid-1.0.16.jar
apache-tomcat-6.0.37

mysql 用户名密码都是root

不知道为何报错: java.lang.ClassNotFoundException: /js

以下tomcat运行的日志文件.

2016-1-14 19:20:10.907 WARN [main] !!You are using default SystemLog! Don't use it in Production environment!!
2016-1-14 19:20:10.909 INFO [main] Nutz is licensed under the Apache License, Version 2.0 .
Report bugs : https://github.com/nutzam/nutz/issues
2016-1-14 19:20:10.912 INFO [main] NutFilter[nutz] starting ...
2016-1-14 19:20:11.13 DEBUG [main] Locations for Scans:
[JarResourceLocation [jarPath=E:\test\server\tomcat6.his\bin\bootstrap.jar], JarResourceLocation [jarPath=D:\Program Files (x86)\Java\jdk1.7.0_45\lib\tools.jar], FileSystemResourceLocation [root=E:\tools\eclipse\eclipse4.4], JarResourceLocation [jarPath=E:\test\server\tomcat6.his\webapps\nutzbook\WEB-INF\lib\nutz-1.b.53.jar]]
2016-1-14 19:20:11.134 DEBUG [main] Locations for Scans:
[FileSystemResourceLocation [root=E:\test\server\tomcat6.his\webapps\nutzbook\WEB-INF\classes], JarResourceLocation [jarPath=E:\test\server\tomcat6.his\bin\bootstrap.jar], JarResourceLocation [jarPath=D:\Program Files (x86)\Java\jdk1.7.0_45\lib\tools.jar], FileSystemResourceLocation [root=E:\tools\eclipse\eclipse4.4], JarResourceLocation [jarPath=E:\test\server\tomcat6.his\webapps\nutzbook\WEB-INF\lib\druid-1.0.16.jar], JarResourceLocation [jarPath=E:\test\server\tomcat6.his\webapps\nutzbook\WEB-INF\lib\mysql-connector-java-5.1.37.jar], JarResourceLocation [jarPath=E:\test\server\tomcat6.his\webapps\nutzbook\WEB-INF\lib\nutz-1.b.53.jar]]
2016-1-14 19:20:11.137 DEBUG [main] MainModule: <com.wxg.nutzbook.MainModule>
2016-1-14 19:20:11.143 DEBUG [main] Loading by class org.nutz.mvc.impl.NutLoading
2016-1-14 19:20:11.145 INFO [main] Nutz Version : 1.b.53 
2016-1-14 19:20:11.145 INFO [main] Nutz.Mvc[nutz] is initializing ...
2016-1-14 19:20:11.145 DEBUG [main] Web Container Information:
2016-1-14 19:20:11.146 DEBUG [main]  - Default Charset : UTF-8
2016-1-14 19:20:11.146 DEBUG [main]  - Current . path  : E:\tools\eclipse\eclipse4.4\.
2016-1-14 19:20:11.146 DEBUG [main]  - Java Version    : 1.7.0_45
2016-1-14 19:20:11.146 DEBUG [main]  - File separator  : \
2016-1-14 19:20:11.146 DEBUG [main]  - Timezone        : Asia/Shanghai
2016-1-14 19:20:11.146 DEBUG [main]  - OS              : Windows 7 x86
2016-1-14 19:20:11.146 DEBUG [main]  - ServerInfo      : Apache Tomcat/6.0.37
2016-1-14 19:20:11.146 DEBUG [main]  - Servlet API     : 2.5
2016-1-14 19:20:11.147 DEBUG [main]  - ContextPath     : /nutzbook
2016-1-14 19:20:11.147 DEBUG [main] MainModule: <com.wxg.nutzbook.MainModule>
2016-1-14 19:20:11.147 DEBUG [main] >> app.root = E:/test/server/tomcat6.his/webapps/nutzbook
2016-1-14 19:20:11.207 DEBUG [main] Using 91 castor for Castors
2016-1-14 19:20:11.209 DEBUG [main] @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*.js", "ioc/", "*anno", "com.wxg.nutzbook", "*tx"],init=[])
2016-1-14 19:20:11.214 ERROR [main] Error happend during start serivce!
java.lang.RuntimeException: java.lang.ClassNotFoundException: /js
	at org.nutz.lang.Lang.wrapThrow(Lang.java:148)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:18)
	at org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:373)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:101)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.ClassNotFoundException: /js
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:190)
	at org.nutz.lang.Lang.loadClass(Lang.java:1808)
	at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:112)
	at org.nutz.ioc.loader.combo.ComboIocLoader.<init>(ComboIocLoader.java:85)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:15)
	... 22 more
一月 14, 2016 7:20:11 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: java.lang.RuntimeException: java.lang.ClassNotFoundException: /js
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.lang.reflect.Constructor.newInstance(Constructor.java:526)
	at org.nutz.lang.born.ConstructorBorning.born(ConstructorBorning.java:17)
	at org.nutz.lang.born.BornContext.doBorn(BornContext.java:60)
	at org.nutz.lang.Mirror.born(Mirror.java:967)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:164)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:133)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:77)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:295)
	at org.apache.catalina.core.ApplicationFilterConfig.setFilterDef(ApplicationFilterConfig.java:424)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:115)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4072)
	at org.apache.catalina.core.StandardContext.start(StandardContext.java:4726)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardHost.start(StandardHost.java:840)
	at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1057)
	at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:463)
	at org.apache.catalina.core.StandardService.start(StandardService.java:525)
	at org.apache.catalina.core.StandardServer.start(StandardServer.java:754)
	at org.apache.catalina.startup.Catalina.start(Catalina.java:595)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:606)
	at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:289)
	at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:414)
Caused by: java.lang.RuntimeException: java.lang.ClassNotFoundException: /js
	at org.nutz.lang.Lang.wrapThrow(Lang.java:148)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:18)
	at org.nutz.mvc.impl.NutLoading.createIoc(NutLoading.java:373)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:101)
	... 20 more
Caused by: java.lang.ClassNotFoundException: /js
	at java.lang.Class.forName0(Native Method)
	at java.lang.Class.forName(Class.java:190)
	at org.nutz.lang.Lang.loadClass(Lang.java:1808)
	at org.nutz.ioc.loader.combo.ComboIocLoader.createIocLoader(ComboIocLoader.java:112)
	at org.nutz.ioc.loader.combo.ComboIocLoader.<init>(ComboIocLoader.java:85)
	at org.nutz.mvc.ioc.provider.ComboIocProvider.create(ComboIocProvider.java:15)
	... 22 more

一月 14, 2016 7:20:11 下午 org.apache.catalina.core.StandardContext start
严重: Error filterStart
一月 14, 2016 7:20:11 下午 org.apache.catalina.core.StandardContext start
严重: Context [/nutzbook] startup failed due to previous errors
一月 14, 2016 7:20:11 下午 org.apache.catalina.loader.WebappClassLoader checkThreadLocalMapForLeaks
严重: The web application [/nutzbook] created a ThreadLocal with key of type [org.nutz.mvc.NutMvcContext$1] (value [org.nutz.mvc.NutMvcContext$1@1a1cb1]) and a value of type [org.nutz.lang.util.SimpleContext] (value [{
}]) but failed to remove it when the web application was stopped. This is very likely to create a memory leak.
一月 14, 2016 7:20:11 下午 org.apache.catalina.startup.HostConfig deployDescriptor
4 回复
 args=["*.js", "ioc/", "*anno", "com.wxg.nutzbook", "*tx"],init=[])

第一个参数是 *js 你加个点号干啥

找到原因了.

@IocBy(type=ComboIocProvider.class, args={"*js", "ioc/", "*anno", "com.wxg.nutzbook", "*tx"})

写成了:

@IocBy(type=ComboIocProvider.class, args={"*.js", "ioc/", "*anno", "com.wxg.nutzbook", "*tx"})

引入source文件后,仔细看了ComboIocLoader的源码.发现加星号(*)是标识.代表后面的是个加载类或者加载类的简写.不加星号(*)的就是参数.
都怪我,当时都是照着文档手敲的,也许是刚刚创建一个dao.js文件.然后这里手一抖多写了一个点.当然解释就是掩饰.我错了.
不过,我还是觉得,这样特殊的语法是nutz的瑕疵. 也许有更好的方式来达到同样的目的.

@wendal 谢谢.就是这个点搞的鬼. 我理解错了星号(*)的意思. 以为是类似查找所有js文件. 当时想当然了. 手比脑快,根本没感觉到就多写了个点了.

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