NutzCN Logo
问答 配置都正确,但nutz就不初始化...
发布于 2689天前 作者 蛋蛋的忧伤 1583 次浏览 复制 上一个帖子 下一个帖子
标签:

我从原来项目copy一番之后,出现了一件愁人的事情...tomcat启动时不走nutz,配置都正确的啊......
web.xml配置:

<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:web="http://java.sun.com/xml/ns/javaee" xmlns="http://java.sun.com/xml/ns/javaee"
	xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_1.xsd"
	version="3.1">
	
	<session-config>
		<tracking-mode>COOKIE</tracking-mode>
	</session-config>

	<listener>
		<listener-class>org.apache.shiro.web.env.EnvironmentLoaderListener</listener-class>
	</listener>
	
	<filter>
		<filter-name>ShiroFilter</filter-name>
		<filter-class>org.apache.shiro.web.servlet.ShiroFilter</filter-class>
	</filter>

	<filter-mapping>
		<filter-name>ShiroFilter</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
		<dispatcher>ERROR</dispatcher>
	</filter-mapping>


	<filter>
		<filter-name>DruidWebStatFilter</filter-name>
		<filter-class>com.alibaba.druid.support.http.WebStatFilter</filter-class>
		<init-param>
			<param-name>exclusions</param-name>
			<param-value>*.js,*.gif,*.jpg,*.png,*.css,*.ico,/druid/*,/rs/*</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>DruidWebStatFilter</filter-name>
		<url-pattern>/*</url-pattern>
	</filter-mapping>

	<!-- Nutz -->
	<filter>
		<filter-name>burro</filter-name>
		<filter-class>me.zouooh.mvc.BurroFilter</filter-class>
		<init-param>
			<param-name>modules</param-name>
			<param-value>com.yixin.zgws.admin.MainController</param-value>
		</init-param>
		<init-param>
			<param-name>ignore</param-name>
			<param-value>^(.+[.])(html|png|gif|jpg|js|css|jspx|jpeg|ftl|jsp|ico)$</param-value>
		</init-param>
	</filter>
	<filter-mapping>
		<filter-name>burro</filter-name>
		<url-pattern>/*</url-pattern>
		<dispatcher>REQUEST</dispatcher>
		<dispatcher>FORWARD</dispatcher>
		<dispatcher>INCLUDE</dispatcher>
	</filter-mapping>

	<!-- freemarker -->
	<servlet>
		<servlet-name>freemarker</servlet-name>
		<servlet-class>freemarker.ext.servlet.FreemarkerServlet</servlet-class>
		<init-param>
			<param-name>TemplatePath</param-name>
			<param-value>/</param-value>
		</init-param>
		<init-param>
			<param-name>template_exception_handler</param-name>
			<param-value>ignore</param-value>
		</init-param>
		<init-param>
			<param-name>ContentType</param-name>
			<param-value>text/html</param-value>
		</init-param>
		<init-param>
			<param-name>template_update_delay</param-name>
			<param-value>0</param-value>
		</init-param>
		<init-param>
			<param-name>default_encoding</param-name>
			<param-value>UTF-8</param-value>
		</init-param>
		<init-param>
			<param-name>locale</param-name>
			<param-value>zh_CN </param-value>
		</init-param>
		<init-param>
			<param-name>number_format</param-name>
			<param-value>0.##########</param-value>
		</init-param>
		<init-param>
			<param-name>datetime_format</param-name>
			<param-value>yyyy-MM-dd HH:mm</param-value>
		</init-param>
		<load-on-startup>2</load-on-startup>
	</servlet>
	<servlet-mapping>
		<servlet-name>freemarker</servlet-name>
		<url-pattern>*.ftl</url-pattern>
	</servlet-mapping>
	<servlet-mapping>
		<servlet-name>freemarker</servlet-name>
		<url-pattern>*.html</url-pattern>
	</servlet-mapping>

	<servlet>
		<servlet-name>DruidStatView</servlet-name>
		<servlet-class>com.alibaba.druid.support.http.StatViewServlet</servlet-class>
	</servlet>
	<servlet-mapping>
		<servlet-name>DruidStatView</servlet-name>
		<url-pattern>/druid/*</url-pattern>
	</servlet-mapping>

	<welcome-file-list>
		<welcome-file>/index.html</welcome-file>
	</welcome-file-list>
</web-app>

me.zouooh.mvc.BurroFilter类:

package me.zouooh.mvc;

import java.io.IOException;
import java.util.HashSet;
import java.util.Set;

import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;

import org.nutz.mvc.NutFilter;

public class BurroFilter extends NutFilter {

    protected Set<String> prefixs = new HashSet<String>();


    public void init(FilterConfig conf) throws ServletException {
        super.init(conf);
        prefixs.add(conf.getServletContext().getContextPath() + "/druid/");
        prefixs.add(conf.getServletContext().getContextPath() + "/rs/");
    }

    @Override
    public void doFilter(ServletRequest req, ServletResponse resp, FilterChain chain) throws IOException, ServletException {
        if (req instanceof HttpServletRequest) {
            String uri = ((HttpServletRequest) req).getRequestURI();
            for (String prefix : prefixs) {
                if (uri.startsWith(prefix)) {
                    chain.doFilter(req, resp);
                    return;
                }
            }
        }
        super.doFilter(req, resp, chain);
    }
}

tomcat启动日志:

E:\Dev\apache-tomcat-8.0.44\bin\catalina.bat run
[2017-07-13 11:16:40,034] Artifact oa-web-admin:war exploded: Server is not connected. Deploy is not available.
[2017-07-13 11:16:40,034] Artifact zgws-web-upload:war exploded: Server is not connected. Deploy is not available.
Using CATALINA_BASE:   "C:\Users\17194\.IntelliJIdea2017.1\system\tomcat\Unnamed_zgws_2"
Using CATALINA_HOME:   "E:\Dev\apache-tomcat-8.0.44"
Using CATALINA_TMPDIR: "E:\Dev\apache-tomcat-8.0.44\temp"
Using JRE_HOME:        "E:\Dev\java 8\jdk"
Using CLASSPATH:       "E:\Dev\apache-tomcat-8.0.44\bin\bootstrap.jar;E:\Dev\apache-tomcat-8.0.44\bin\tomcat-juli.jar"
Connected to the target VM, address: '127.0.0.1:64903', transport: 'socket'
13-Jul-2017 11:16:40.969 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server version:        Apache Tomcat/8.0.44
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server built:          May 10 2017 17:21:09 UTC
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Server number:         8.0.44.0
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Name:               Windows 10
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log OS Version:            10.0
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Architecture:          amd64
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Java Home:             E:\Dev\java 8\jdk\jre
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Version:           1.8.0_131-b11
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log JVM Vendor:            Oracle Corporation
13-Jul-2017 11:16:40.987 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_BASE:         C:\Users\17194\.IntelliJIdea2017.1\system\tomcat\Unnamed_zgws_2
13-Jul-2017 11:16:40.988 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log CATALINA_HOME:         E:\Dev\apache-tomcat-8.0.44
13-Jul-2017 11:16:40.989 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.config.file=C:\Users\17194\.IntelliJIdea2017.1\system\tomcat\Unnamed_zgws_2\conf\logging.properties
13-Jul-2017 11:16:40.989 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.util.logging.manager=org.apache.juli.ClassLoaderLogManager
13-Jul-2017 11:16:40.989 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -agentlib:jdwp=transport=dt_socket,address=127.0.0.1:64903,suspend=y,server=n
13-Jul-2017 11:16:40.989 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dfile.encoding=UTF-8
13-Jul-2017 11:16:40.989 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote=
13-Jul-2017 11:16:40.989 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.port=1099
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.ssl=false
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcom.sun.management.jmxremote.authenticate=false
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.rmi.server.hostname=127.0.0.1
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djdk.tls.ephemeralDHKeySize=2048
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.protocol.handler.pkgs=org.apache.catalina.webresources
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.endorsed.dirs=E:\Dev\apache-tomcat-8.0.44\endorsed
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.base=C:\Users\17194\.IntelliJIdea2017.1\system\tomcat\Unnamed_zgws_2
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Dcatalina.home=E:\Dev\apache-tomcat-8.0.44
13-Jul-2017 11:16:40.990 信息 [main] org.apache.catalina.startup.VersionLoggerListener.log Command line argument: -Djava.io.tmpdir=E:\Dev\apache-tomcat-8.0.44\temp
13-Jul-2017 11:16:40.990 信息 [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: E:\Dev\java 8\jdk\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\;E:\Dev\java 8\jdk\bin;E:\Dev\apache-maven-3.5.0\bin;E:\Dev\TortoiseSVN\bin;C:\Program Files\Git\cmd;C:\Users\17194\AppData\Local\Microsoft\WindowsApps;.
13-Jul-2017 11:16:41.148 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["http-nio-8080"]
13-Jul-2017 11:16:41.181 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Jul-2017 11:16:41.182 信息 [main] org.apache.coyote.AbstractProtocol.init Initializing ProtocolHandler ["ajp-nio-8009"]
13-Jul-2017 11:16:41.182 信息 [main] org.apache.tomcat.util.net.NioSelectorPool.getSharedSelector Using a shared selector for servlet write/read
13-Jul-2017 11:16:41.182 信息 [main] org.apache.catalina.startup.Catalina.load Initialization processed in 545 ms
13-Jul-2017 11:16:41.213 信息 [main] org.apache.catalina.core.StandardService.startInternal Starting service Catalina
13-Jul-2017 11:16:41.213 信息 [main] org.apache.catalina.core.StandardEngine.startInternal Starting Servlet Engine: Apache Tomcat/8.0.44
13-Jul-2017 11:16:41.229 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["http-nio-8080"]
13-Jul-2017 11:16:41.245 信息 [main] org.apache.coyote.AbstractProtocol.start Starting ProtocolHandler ["ajp-nio-8009"]
13-Jul-2017 11:16:41.245 信息 [main] org.apache.catalina.startup.Catalina.start Server startup in 70 ms
Connected to server
[2017-07-13 11:16:41,604] Artifact oa-web-admin:war exploded: Artifact is being deployed, please wait...
[2017-07-13 11:16:41,604] Artifact zgws-web-upload:war exploded: Artifact is being deployed, please wait...
13-Jul-2017 11:16:43.988 信息 [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-07-13 11:16:44,060] Artifact oa-web-admin:war exploded: Artifact is deployed successfully
[2017-07-13 11:16:44,060] Artifact oa-web-admin:war exploded: Deploy took 2,456 milliseconds
13-Jul-2017 11:16:44.123 信息 [RMI TCP Connection(4)-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-07-13 11:16:44,154] Artifact zgws-web-upload:war exploded: Artifact is deployed successfully
[2017-07-13 11:16:44,154] Artifact zgws-web-upload:war exploded: Deploy took 2,550 milliseconds
13-Jul-2017 11:16:51.230 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deploying web application directory E:\Dev\apache-tomcat-8.0.44\webapps\manager
13-Jul-2017 11:16:51.261 信息 [localhost-startStop-1] org.apache.catalina.startup.HostConfig.deployDirectory Deployment of web application directory E:\Dev\apache-tomcat-8.0.44\webapps\manager has finished in 31 ms

简直不知道是idea的原因,还是maven的原因,还是项目自身的原因。。。。。。。。

4 回复

我没玩过nutzwk...改天玩玩啊

启动错项目了

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