NutzCN Logo
问答 配置动作链后启动tomcat报错类型转换异常
发布于 2469天前 作者 GTKnave 1506 次浏览 复制 上一个帖子 下一个帖子
标签:
2018-03-20 17:19:45,329 %1 INFO  -  NutFilter[nutz] starting ...
2018-03-20 17:19:45,458 %1 DEBUG -  Locations for Scans:
[Dir[path=F:\eclipse], Jar[path=E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\nutz-1.r.60.jar], Dir[path=E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\classes], Jar[path=D:\apache-tomcat-7.0.78\bin\bootstrap.jar], Jar[path=D:\apache-tomcat-7.0.78\bin\tomcat-juli.jar], Jar[path=C:\Java\jdk1.7.0_79\lib\tools.jar]]
2018-03-20 17:19:45,525 %1 DEBUG -  Locations for Scans:
{F:\eclipse=Dir[path=F:\eclipse], E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\nutz-1.r.60.jar=Jar[path=E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\nutz-1.r.60.jar], E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\classes=Dir[path=E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\classes], D:\apache-tomcat-7.0.78\bin\bootstrap.jar=Jar[path=D:\apache-tomcat-7.0.78\bin\bootstrap.jar], D:\apache-tomcat-7.0.78\bin\tomcat-juli.jar=Jar[path=D:\apache-tomcat-7.0.78\bin\tomcat-juli.jar], C:\Java\jdk1.7.0_79\lib\tools.jar=Jar[path=C:\Java\jdk1.7.0_79\lib\tools.jar], E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\mysql-connector-java-5.1.40.jar=Jar[path=E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\mysql-connector-java-5.1.40.jar], E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\druid-1.0.26.jar=Jar[path=E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\druid-1.0.26.jar], E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\log4j-1.2.17.jar=Jar[path=E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\wtpwebapps\nutzbook\WEB-INF\lib\log4j-1.2.17.jar]}
2018-03-20 17:19:45,594 %1 DEBUG -  Using 95 castor for Castors
2018-03-20 17:19:45,620 %1 DEBUG -  Loading by class org.nutz.mvc.impl.NutLoading
2018-03-20 17:19:45,621 %1 INFO  -  Nutz Version : 1.r.60 
2018-03-20 17:19:45,621 %1 INFO  -  Nutz.Mvc[nutz] is initializing ...
2018-03-20 17:19:45,622 %1 DEBUG -  Web Container Information:
2018-03-20 17:19:45,623 %1 DEBUG -   - Default Charset : UTF-8
2018-03-20 17:19:45,623 %1 DEBUG -   - Current . path  : F:\eclipse\.
2018-03-20 17:19:45,623 %1 DEBUG -   - Java Version    : 1.7.0_79
2018-03-20 17:19:45,623 %1 DEBUG -   - File separator  : \
2018-03-20 17:19:45,623 %1 DEBUG -   - Timezone        : Asia/Shanghai
2018-03-20 17:19:45,623 %1 DEBUG -   - OS              : Windows 8.1 amd64
2018-03-20 17:19:45,623 %1 DEBUG -   - ServerInfo      : Apache Tomcat/7.0.78
2018-03-20 17:19:45,623 %1 DEBUG -   - Servlet API     : 3.0
2018-03-20 17:19:45,623 %1 DEBUG -   - ContextPath     : /nutzbook
2018-03-20 17:19:45,623 %1 DEBUG -   - context.tempdir : E:\newworkspace\.metadata\.plugins\org.eclipse.wst.server.core\tmp1\work\Catalina\localhost\nutzbook
2018-03-20 17:19:45,623 %1 DEBUG -   - MainModule      : net.wendal.nutzbook.MainModule
2018-03-20 17:19:45,625 %1 DEBUG -  >> app.root = E:/newworkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/nutzbook
2018-03-20 17:19:45,628 %1 DEBUG -  @IocBy(type=org.nutz.mvc.ioc.provider.ComboIocProvider, args=["*js", "ioc/", "*anno", "net.wendal.nutzbook", "*tx", "*async"],init=[])
2018-03-20 17:19:45,648 %1 DEBUG -  Found 1 resource by src( ioc/ ) , regex( ^(.+[.])(js|json)$ )
2018-03-20 17:19:45,648 %1 DEBUG -  loading ioc js config from [dao.js]
2018-03-20 17:19:45,652 %1 DEBUG -  Loaded 2 bean define from path=[ioc/] --> [dataSource, dao]
2018-03-20 17:19:45,656 %1 DEBUG -  Found 5 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
2018-03-20 17:19:45,681 %1 DEBUG -  Found @IocBean : class net.wendal.nutzbook.module.UserModule
2018-03-20 17:19:45,688 %1 INFO  -  Found 1 classes in 1 base-packages!
beans = ["userModule"]
2018-03-20 17:19:45,689 %1 DEBUG -  Loaded 5 bean define from reader --
[txREPEATABLE_READ, txREAD_COMMITTED, txNONE, txSERIALIZABLE, txREAD_UNCOMMITTED]
2018-03-20 17:19:45,691 %1 DEBUG -  Load AopConfigure for anno=org.nutz.aop.interceptor.async.Async by type=org.nutz.aop.interceptor.async.AsyncAopIocLoader
2018-03-20 17:19:45,694 %1 INFO  -  NutIoc init begin ...
2018-03-20 17:19:45,696 %1 INFO  -  ... NutIoc init complete
2018-03-20 17:19:45,700 %1 INFO  -  Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2018-03-20 17:19:45,702 %1 DEBUG -  @Views(DefaultViewMaker.class)
2018-03-20 17:19:45,710 %1 DEBUG -  Found 1 resource by src( mvc/nutzbook-mvc-chain.js ) , regex( ^(.+[.])(js|json)$ )
2018-03-20 17:19:45,714 %1 DEBUG -  ActionChain Config:
{
   "default": {
      "ps": ["net.wendal.nutzbook.mvc.LogTimeProcessor", "org.nutz.mvc.impl.processor.UpdateRequestAttributesProcessor", "org.nutz.mvc.impl.processor.EncodingProcessor", "org.nutz.mvc.impl.processor.ModuleProcessor", "!org.nutz.integration.shiro.NutShiroProcessor", "org.nutz.mvc.impl.processor.ActionFiltersProcessor", "org.nutz.mvc.impl.processor.AdaptorProcessor", "org.nutz.mvc.impl.processor.MethodInvokeProcessor", "org.nutz.mvc.impl.processor.ViewProcessor"],
      "error": "org.nutz.mvc.impl.processor.FailProcessor"
   }
}
2018-03-20 17:19:45,714 %1 DEBUG -  @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2018-03-20 17:19:45,721 %1 DEBUG -  module class location 'file:/E:/newworkspace/.metadata/.plugins/org.eclipse.wst.server.core/tmp1/wtpwebapps/nutzbook/WEB-INF/classes/'
2018-03-20 17:19:45,721 %1 DEBUG -   > scan 'net.wendal.nutzbook'
2018-03-20 17:19:45,725 %1 DEBUG -  Found 5 resource by src( net/wendal/nutzbook/ ) , regex( ^.+[.]class$ )
2018-03-20 17:19:45,726 %1 DEBUG -     >> add 'net.wendal.nutzbook.module.UserModule'
2018-03-20 17:19:45,729 %1 DEBUG -  Eval FAIL!! : public java.lang.Object net.wendal.nutzbook.module.UserModule.add(net.wendal.nutzbook.bean.User)
java.lang.ClassCastException: net.wendal.nutzbook.mvc.LogTimeProcessor cannot be cast to org.nutz.mvc.Processor
	at org.nutz.mvc.impl.NutActionChainMaker.getProcessorByName(NutActionChainMaker.java:78)
	at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:36)
	at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:54)
	at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:204)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:108)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
2018-03-20 17:19:45,731 %1 ERROR -  Error happend during start serivce!
java.lang.ClassCastException: net.wendal.nutzbook.mvc.LogTimeProcessor cannot be cast to org.nutz.mvc.Processor
	at org.nutz.mvc.impl.NutActionChainMaker.getProcessorByName(NutActionChainMaker.java:78)
	at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:36)
	at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:54)
	at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:204)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:108)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
2018-03-20 17:19:45,731 %1 ERROR -  try to depose ioc
2018-03-20 17:19:45,733 %1 INFO  -  org.nutz.ioc.impl.NutIoc@1708041420 is closing. startup date [18-03-20 17:19:45.694]
2018-03-20 17:19:45,733 %1 INFO  -  org.nutz.ioc.impl.NutIoc@1708041420 is deposed. startup date [18-03-20 17:19:45.694]
三月 20, 2018 5:19:45 下午 org.apache.catalina.core.StandardContext filterStart
严重: Exception starting filter nutz
org.nutz.mvc.LoadingException: java.lang.ClassCastException: net.wendal.nutzbook.mvc.LogTimeProcessor cannot be cast to org.nutz.mvc.Processor
	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:990)
	at org.nutz.lang.Lang.wrapThrow(Lang.java:197)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:135)
	at org.nutz.mvc.ActionHandler.<init>(ActionHandler.java:19)
	at org.nutz.mvc.NutFilter._init(NutFilter.java:87)
	at org.nutz.mvc.NutFilter.init(NutFilter.java:65)
	at org.apache.catalina.core.ApplicationFilterConfig.initFilter(ApplicationFilterConfig.java:279)
	at org.apache.catalina.core.ApplicationFilterConfig.getFilter(ApplicationFilterConfig.java:260)
	at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:105)
	at org.apache.catalina.core.StandardContext.filterStart(StandardContext.java:4958)
	at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5652)
	at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:145)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1571)
	at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1561)
	at java.util.concurrent.FutureTask.run(FutureTask.java:262)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
	at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.ClassCastException: net.wendal.nutzbook.mvc.LogTimeProcessor cannot be cast to org.nutz.mvc.Processor
	at org.nutz.mvc.impl.NutActionChainMaker.getProcessorByName(NutActionChainMaker.java:78)
	at org.nutz.mvc.impl.NutActionChainMaker.eval(NutActionChainMaker.java:36)
	at org.nutz.mvc.impl.UrlMappingImpl.add(UrlMappingImpl.java:54)
	at org.nutz.mvc.impl.NutLoading.evalUrlMapping(NutLoading.java:204)
	at org.nutz.mvc.impl.NutLoading.load(NutLoading.java:108)
	... 15 more

三月 20, 2018 5:19:45 下午 org.apache.catalina.core.StandardContext startInternal
严重: One or more Filters failed to start. Full details will be found in the appropriate container log file
三月 20, 2018 5:19:45 下午 org.apache.catalina.core.StandardContext startInternal
严重: Context [/nutzbook] startup failed due to previous errors
三月 20, 2018 5:19:45 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["http-bio-8080"]
三月 20, 2018 5:19:45 下午 org.apache.coyote.AbstractProtocol start
信息: Starting ProtocolHandler ["ajp-bio-8009"]
三月 20, 2018 5:19:45 下午 org.apache.catalina.startup.Catalina start
4 回复
public class LogTimeProcessor extends AbstractProcessor {

	private static final Log log = Logs.get();

    @Override
    public void process(ActionContext ac) throws Throwable {
        Stopwatch sw = Stopwatch.begin();
        try {
            doNext(ac);
        } finally {
            sw.stop();
            if (log.isDebugEnabled()) {
                HttpServletRequest req = ac.getRequest();
                log.debugf("[%4s]URI=%s %sms", req.getMethod(), req.getRequestURI(), sw.getDuration());
            }
        }
    }

继承了的呢

然后我下了你的代码看下把@ChainBy放到@modules下就不会报错了,之前我是放在注解的最下面

你用的是假的jdk吧

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