我创建了一个非常简单的应用程序(只是一个索引文件)和一个Java Servlet过滤器。
我在Netbeans部署的日志中看到以下错误:
Deployment is in progress...
deploy?config=file%3A%2FC%3A%2FUsers%2Fuser%2FAppData%2FLocal%2FTemp%2Fcontext490289541373061276.xml&path=/EXD
http://localhost:8080/manager/deploy?config=file%3A%2FC%3A%2FUsers%2Fuser%2FAppData%2FLocal%2FTemp%2Fcontext490289541373061276.xml&path=/EXD
C:\Users\user\Documents\NetBeansProjects\EXDLogger\nbproject\build-impl.xml:1070: The module has not been deployed.
See the server log for details.
BUILD FAILED (total time: 57 seconds)
其他任何日志都没有任何错误。
知道发生了什么事吗?
web.xml内容:
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<session-config>
<session-timeout>30</session-timeout>
</session-config>
<welcome-file-list>
<welcome-file>index.jsp</welcome-file>
</welcome-file-list>
<filter>
<filter-name>EXDLogger</filter-name>
<filter-class>com.cn.filters.EXDLogger</filter-class>
<init-param>
<param-name>paramExclude</param-name>
<!-- Parameters which should be excluded from the hash in determining
if a request is unique. Separate multiple values with a ; -->
<param-value>PARAM_1;PARAM_2</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>EXDLogger</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
</web-app>
被调用的类:
package com.cn.filters;
import java.io.IOException;
import java.util.Date;
import javax.servlet.Filter;
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;
public class EXDLogger implements Filter {
public void doFilter(ServletRequest req, ServletResponse res,
FilterChain chain) throws IOException, ServletException {
HttpServletRequest request = (HttpServletRequest) req;
//Get the IP address of client machine.
String ipAddress = request.getRemoteAddr();
//Log the IP address and current timestamp.
System.out.println("IP "+ipAddress + ", Time "
+ new Date().toString());
chain.doFilter(req, res);
}
public void init(FilterConfig config) throws ServletException {
//Get init parameter
String testParam = config.getInitParameter("paramExclude");
//Print the init parameter
System.out.println("Test Param: " + testParam);
}
public void destroy() {
//add code to release any resource
}
}
答案 0 :(得分:0)
我砍了一个答案。我确定有更好的。我更新了build-impl.xml的相关部分,如下所示:
<target depends="init,-init-cos,compile,compile-jsps,-do-compile-single-jsp,-pre-dist,-do-tmp-dist-with-manifest,-do-tmp-dist-without-manifest,-pre-run-deploy,-pre-nbmodule-run-deploy,-run-deploy-nb,-init-deploy-ant,-deploy-ant,-run-deploy-am,-post-nbmodule-run-deploy,-post-run-deploy,-do-update-breakpoints" name="run-deploy"/>
<target if="netbeans.home" name="-run-deploy-nb">
<!-- <delete dir="${deployTarget}"/> -->
<copy toDir="${deployTarget}" overwrite="true">
<fileset dir="${build.web.dir}"></fileset>
</copy>
<copy toDir="${deployTarget}/WEB-INF/classes" overwrite="true">
<fileset dir="${build.classes.dir}"></fileset>
</copy>
<!-- <nbdeploy clientUrlPart="${client.urlPart}" debugmode="true" forceRedeploy="${forceRedeploy}"/> -->
</target>
然后我添加到我的project.properties:
deployTarget=c:/xampp/tomcat/webapps/EXD
client.url=http://localhost:8080/EXD/