NutzCN Logo
问答 竟然扫描不到controller????
发布于 2584天前 作者 蛋蛋的忧伤 1508 次浏览 复制 上一个帖子 下一个帖子
标签:

web.xml

<!DOCTYPE web-app PUBLIC
 "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
 "http://java.sun.com/dtd/web-app_2_3.dtd" >

<web-app>
  <display-name>Archetype Created Web Application</display-name>

  <filter>
    <filter-name>nutz</filter-name>
    <filter-class>org.nutz.mvc.NutFilter</filter-class>
    <init-param>
      <param-name>modules</param-name>
      <param-value>com.test.MainModule</param-value>
    </init-param>
  </filter>
  <filter-mapping>
    <filter-name>nutz</filter-name>
    <url-pattern>/*</url-pattern>
    <dispatcher>REQUEST</dispatcher>
    <dispatcher>FORWARD</dispatcher>
  </filter-mapping>
</web-app>

MainModule.java

package com.test;

import org.nutz.mvc.annotation.Modules;

@Modules(scanPackage = true)
public class MainModule {
}

controller

package com.test.controller;

import org.nutz.mvc.annotation.At;
import org.nutz.mvc.annotation.Fail;
import org.nutz.mvc.annotation.Ok;

@At("hello")
@Ok("json")
@Fail("json")
public class HelloController {

    @At("hello")
    String hello(){
        return "Hi Nutz!";
    }

    @At("hello2")
    String hello2(){
        return "Hi Nutz!";
    }
}

started log:

D:\Dev\apache-tomcat-8.0.44\bin\catalina.bat run
[2017-11-25 09:48:33,639] Artifact nutzdemo:war exploded: Waiting for server connection to start artifact deployment...
Using CATALINA_BASE:   "C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_nutzdemo"
Using CATALINA_HOME:   "D:\Dev\apache-tomcat-8.0.44"
Using CATALINA_TMPDIR: "D:\Dev\apache-tomcat-8.0.44\temp"
Using JRE_HOME:        "C:\Program Files\Java\jdk1.8.0_151"
Using CLASSPATH:       "D:\Dev\apache-tomcat-8.0.44\bin\bootstrap.jar;D:\Dev\apache-tomcat-8.0.44\bin\tomcat-juli.jar"
Connected to the target VM, address: '127.0.0.1:60270', transport: 'socket'
25-Nov-2017 09:48:34.459 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.44
25-Nov-2017 09:48:34.462 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          May 10 2017 17:21:09 UTC
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.44.0
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 7
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            6.1
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             C:\Program Files\Java\jdk1.8.0_151\jre
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_151-b12
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_nutzdemo
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         D:\Dev\apache-tomcat-8.0.44
25-Nov-2017 09:48:34.463 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_nutzdemo\conf\logging.properties
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:60270,suspend=y,server=n
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=UTF-8
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
25-Nov-2017 09:48:34.464 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
25-Nov-2017 09:48:34.465 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
25-Nov-2017 09:48:34.465 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
25-Nov-2017 09:48:34.465 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=D:\Dev\apache-tomcat-8.0.44\endorsed
25-Nov-2017 09:48:34.465 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_nutzdemo
25-Nov-2017 09:48:34.465 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=D:\Dev\apache-tomcat-8.0.44
25-Nov-2017 09:48:34.465 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=D:\Dev\apache-tomcat-8.0.44\temp
25-Nov-2017 09:48:34.465 信息 [main] org.apache.catalina.core.AprLifecycleListener.lifecycleEvent The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jdk1.8.0_151\bin;C:\Windows\Sun\Java\bin;C:\Windows\system32;C:\Windows;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files\Java\jdk1.8.0_151\bin;D:\Dev\apache-maven-3.5.0\bin;C:\Program Files\TortoiseSVN\bin;C:\Program Files\Git\cmd;.
25-Nov-2017 09:48:34.594 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
25-Nov-2017 09:48:34.609 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Nov-2017 09:48:34.612 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
25-Nov-2017 09:48:34.614 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
25-Nov-2017 09:48:34.614 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 438 ms
25-Nov-2017 09:48:34.641 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
25-Nov-2017 09:48:34.641 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.44
25-Nov-2017 09:48:34.648 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
25-Nov-2017 09:48:34.657 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
25-Nov-2017 09:48:34.660 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 45 ms
Connected to server
[2017-11-25 09:48:34,706] Artifact nutzdemo:war exploded: Artifact is being deployed, please wait...
25-Nov-2017 09:48:35.520 信息 [RMI TCP Connection(3)-127.0.0.1] org.apache.jasper.servlet.TldScanner.scanJars At least one JAR was scanned for TLDs yet contained no TLDs. Enable debug logging for this logger for a complete list of JARs that were scanned but no TLDs were found in them. Skipping unneeded JARs during scanning can improve startup time and JSP compilation time.
2017-11-25 9:48:35.565 INFO [RMI TCP Connection(3)-127.0.0.1] Select SystemLog as Nutz.Log implement
2017-11-25 9:48:35.570 INFO [RMI TCP Connection(3)-127.0.0.1] NutFilter[nutz] starting ...
2017-11-25 9:48:35.621 DEBUG [RMI TCP Connection(3)-127.0.0.1] Locations for Scans:
[Dir[path=D:\Dev\apache-tomcat-8.0.44\bin], Jar[path=E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\lib\nutz-1.r.60.jar], Jar[path=D:\Dev\apache-tomcat-8.0.44\bin\bootstrap.jar], Jar[path=D:\Dev\apache-tomcat-8.0.44\bin\tomcat-juli.jar]]
2017-11-25 9:48:35.678 DEBUG [RMI TCP Connection(3)-127.0.0.1] Locations for Scans:
{D:\Dev\apache-tomcat-8.0.44\bin=Dir[path=D:\Dev\apache-tomcat-8.0.44\bin], E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\lib\nutz-1.r.60.jar=Jar[path=E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\lib\nutz-1.r.60.jar], D:\Dev\apache-tomcat-8.0.44\bin\bootstrap.jar=Jar[path=D:\Dev\apache-tomcat-8.0.44\bin\bootstrap.jar], D:\Dev\apache-tomcat-8.0.44\bin\tomcat-juli.jar=Jar[path=D:\Dev\apache-tomcat-8.0.44\bin\tomcat-juli.jar], E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\classes=Dir[path=E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\classes], E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\lib\druid-1.0.27.jar=Jar[path=E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\lib\druid-1.0.27.jar], E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\lib\mysql-connector-java-5.1.40.jar=Jar[path=E:\Idea_workspace\NutzRapid2\nutzdemo\target\nutzdemo-1.0-SNAPSHOT\WEB-INF\lib\mysql-connector-java-5.1.40.jar]}
2017-11-25 9:48:35.738 DEBUG [RMI TCP Connection(3)-127.0.0.1] Using 95 castor for Castors
2017-11-25 9:48:35.752 DEBUG [RMI TCP Connection(3)-127.0.0.1] Loading by class org.nutz.mvc.impl.NutLoading
2017-11-25 9:48:35.755 INFO [RMI TCP Connection(3)-127.0.0.1] Nutz Version : 1.r.60 
2017-11-25 9:48:35.757 INFO [RMI TCP Connection(3)-127.0.0.1] Nutz.Mvc[nutz] is initializing ...
2017-11-25 9:48:35.757 DEBUG [RMI TCP Connection(3)-127.0.0.1] Web Container Information:
2017-11-25 9:48:35.758 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - Default Charset : UTF-8
2017-11-25 9:48:35.758 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - Current . path  : D:\Dev\apache-tomcat-8.0.44\bin\.
2017-11-25 9:48:35.759 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - Java Version    : 1.8.0_151
2017-11-25 9:48:35.759 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - File separator  : \
2017-11-25 9:48:35.759 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - Timezone        : Asia/Shanghai
2017-11-25 9:48:35.759 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - OS              : Windows 7 amd64
2017-11-25 9:48:35.759 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - ServerInfo      : Apache Tomcat/8.0.44
2017-11-25 9:48:35.760 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - Servlet API     : 3.1
2017-11-25 9:48:35.760 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - ContextPath     : 
2017-11-25 9:48:35.760 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - context.tempdir : C:\Users\Administrator\.IntelliJIdea2017.2\system\tomcat\Unnamed_nutzdemo\work\Catalina\localhost\ROOT
2017-11-25 9:48:35.761 DEBUG [RMI TCP Connection(3)-127.0.0.1]  - MainModule      : com.test.MainModule
2017-11-25 9:48:35.762 DEBUG [RMI TCP Connection(3)-127.0.0.1] >> app.root = E:/Idea_workspace/NutzRapid2/nutzdemo/target/nutzdemo-1.0-SNAPSHOT
2017-11-25 9:48:35.764 INFO [RMI TCP Connection(3)-127.0.0.1] !!!Your application without @IocBy supporting
2017-11-25 9:48:35.768 INFO [RMI TCP Connection(3)-127.0.0.1] Build URL mapping by org.nutz.mvc.impl.UrlMappingImpl ...
2017-11-25 9:48:35.771 DEBUG [RMI TCP Connection(3)-127.0.0.1] @Views(DefaultViewMaker.class)
2017-11-25 9:48:35.780 DEBUG [RMI TCP Connection(3)-127.0.0.1] @ChainBy(org.nutz.mvc.impl.NutActionChainMaker)
2017-11-25 9:48:35.790 DEBUG [RMI TCP Connection(3)-127.0.0.1] module class location 'file:/E:/Idea_workspace/NutzRapid2/nutzdemo/target/nutzdemo-1.0-SNAPSHOT/WEB-INF/classes/'
2017-11-25 9:48:35.791 DEBUG [RMI TCP Connection(3)-127.0.0.1]  > scan 'com.test'
17-11-25 09:48:35.797 WARN [RMI TCP Connection(3)-127.0.0.1] None module classes found!!!
17-11-25 09:48:35.798 WARN [RMI TCP Connection(3)-127.0.0.1] None @At found in any modules class!!
2017-11-25 9:48:35.796 DEBUG [RMI TCP Connection(3)-127.0.0.1] Found 2 resource by src( com/test/ ) , regex( ^.+[.]class$ )
2017-11-25 9:48:35.799 DEBUG [RMI TCP Connection(3)-127.0.0.1] @Localization not define
2017-11-25 9:48:35.801 INFO [RMI TCP Connection(3)-127.0.0.1] Nutz.Mvc[nutz] is up in 39ms
[2017-11-25 09:48:35,841] Artifact nutzdemo:war exploded: Artifact is deployed successfully
[2017-11-25 09:48:35,841] Artifact nutzdemo:war exploded: Deploy took 1,135 milliseconds
2017-11-25 9:48:36.300 DEBUG [http-nio-8080-exec-1] Search mapping for [GET] path=/ : NOT Action match
2017-11-25 9:48:36.312 DEBUG [http-nio-8080-exec-2] Search mapping for [GET] path=/ : NOT Action match
2017-11-25 9:48:36.445 DEBUG [http-nio-8080-exec-4] Search mapping for [GET] path=/ : NOT Action match
25-Nov-2017 09:48:44.649 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory D:\Dev\apache-tomcat-8.0.44\webapps\manager
25-Nov-2017 09:48:44.689 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory D:\Dev\apache-tomcat-8.0.44\webapps\manager has finished in 40 ms

2017-11-25 9:48:35.791 DEBUG [RMI TCP Connection(3)-127.0.0.1]  > scan 'com.test'
17-11-25 09:48:35.797 WARN [RMI TCP Connection(3)-127.0.0.1] None module classes found!!!
17-11-25 09:48:35.798 WARN [RMI TCP Connection(3)-127.0.0.1] None @At found in any modules class!!

Why???

1 回复

竟然必须要public.......好吧我知道了....

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