Tomcat 部署 Could not copy all resources to 或者Undeployment Failure could not be re

本文介绍了在Tomcat6.x上部署应用时遇到的部署失败问题及其解决方案。常见原因是尝试重新部署时服务器正在运行,导致文件被锁定。解决方法是在Eclipse中移除并重新添加项目引用的所有jar文件。
Tomcat 部署,在部署可能会出现以下问题:

Deployment failure on Tomcat 6.x. Could not copy all resources to E:/apache-tomcat-6.0.16/webapps/HebbnWebServices. If a file is locked, you can wait until the lock times out to redeploy, or stop the server and redeploy, or manually remove the deployment at E:/apache-tomcat-6.0.16/webapps/HebbnWebServices

再次点部署按钮时就会提示如下:

Undeployment Failure could not be redeployed because it could not be completely removed in the undeployment phase. the most common cuase of this problem is attempting to redeploy while the server is running,which has locked one or more files.

to correct the deployment you will need to stop the server and then redeploy the project before restarting the server.

解决的办法就是在Eclipse中把项目中引用的jar文件重新加一遍就行了,基本原因就是以前的jar文件不存在了,但是项目信息中还有,即项目的.classpath文件中还有不存在的jar文件引用。

可以右键点项目名称,选择Properties,选择Java Build Path,选择Libraries,把所有项目中的jar都remove,然后再点"add jars",把项目中的jar文件都加进来,再次部署就正常了。
<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <parent> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-parent</artifactId> <version>3.5.7</version> <relativePath/> </parent> <groupId>com.hkbn.ae</groupId> <artifactId>ae</artifactId> <version>2.7.2</version> <packaging>war</packaging> <name>ae</name> <description>ae</description> <properties> <java.version>17</java.version> <skipTests>true</skipTests> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding> <spring-boot.repackage.skip>false</spring-boot.repackage.skip> <!-- Dependency versions --> <org.mapstruct.version>1.5.5.Final</org.mapstruct.version> <lombok.version>1.18.24</lombok.version> <ojdbc11.version>23.4.0.24.05</ojdbc11.version> <httpclient5.version>5.4.1</httpclient5.version> <mybatis-plus.version>3.5.12</mybatis-plus.version> <dynamic-datasource.version>4.1.3</dynamic-datasource.version> <plexus-utils.version>3.4.2</plexus-utils.version> <jdependency.version>2.10</jdependency.version> <plexus-archiver.version>4.8.0</plexus-archiver.version> <lombok-mapstruct-binding.version>0.2.0</lombok-mapstruct-binding.version> </properties> <dependencies> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-logging</artifactId> </exclusion> <exclusion> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-jdbc</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-security</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> <exclusions> <exclusion> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> </exclusion> <exclusion> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </exclusion> </exclusions> </dependency> <dependency> <groupId>com.oracle.database.jdbc</groupId> <artifactId>ojdbc11</artifactId> <version>${ojdbc11.version}</version> <scope>runtime</scope> </dependency> <dependency> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> <optional>true</optional> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-tomcat</artifactId> <scope>provided</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-log4j2</artifactId> </dependency> <dependency> <groupId>org.springframework.security</groupId> <artifactId>spring-security-test</artifactId> <scope>test</scope> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-oauth2-client</artifactId> </dependency> <!-- mybatis-plus --> <dependency> <groupId>com.baomidou</groupId> <artifactId>mybatis-plus-spring-boot3-starter</artifactId> <version>${mybatis-plus.version}</version> </dependency> <!-- mybatis-plus 动态数据源 --> <dependency> <groupId>com.baomidou</groupId> <artifactId>dynamic-datasource-spring-boot3-starter</artifactId> <version>${dynamic-datasource.version}</version> </dependency> <!-- 验证依赖:Spring Boot 3.x 需要显式添加 spring-boot-starter-validation 依赖 --> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-validation</artifactId> <exclusions> <exclusion> <groupId>org.hibernate</groupId> <artifactId>hibernate-core</artifactId> </exclusion> <exclusion> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </exclusion> </exclusions> </dependency> <!--SQL Server drive--> <dependency> <groupId>com.microsoft.sqlserver</groupId> <artifactId>mssql-jdbc</artifactId> <version>13.2.1.jre11</version> <scope>runtime</scope> </dependency> </dependencies> <profiles> <profile> <id>dev</id> <properties> <profile-id>dev</profile-id> <spring.profiles.active>dev</spring.profiles.active> </properties> </profile> <profile> <id>prod</id> <properties> <profile-id>prod</profile-id> <spring.profiles.active>prod</spring.profiles.active> </properties> </profile> <profile> <id>uat</id> <properties> <profile-id>uat</profile-id> <spring.profiles.active>uat</spring.profiles.active> </properties> <activation> <activeByDefault>true</activeByDefault> </activation> </profile> </profiles> <build> <finalName>ae</finalName> <plugins> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.1</version> <configuration> <source>${java.version}</source> <target>${java.version}</target> <annotationProcessorPaths> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> <version>${lombok.version}</version> </path> <path> <groupId>org.projectlombok</groupId> <artifactId>lombok-mapstruct-binding</artifactId> <version>${lombok-mapstruct-binding.version}</version> </path> <path> <groupId>org.mapstruct</groupId> <artifactId>mapstruct-processor</artifactId> <version>${org.mapstruct.version}</version> </path> </annotationProcessorPaths> <compilerArgs> <compilerArg> -Amapstruct.unmappedTargetPolicy=ERROR </compilerArg> <compilerArg> -Amapstruct.nullValueIterableMappingStrategy=RETURN_DEFAULT </compilerArg> </compilerArgs> </configuration> </plugin> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> <version>3.5.7</version> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-utils</artifactId> <version>${plexus-utils.version}</version> </dependency> <dependency> <groupId>org.vafer</groupId> <artifactId>jdependency</artifactId> <version>${jdependency.version}</version> </dependency> </dependencies> <executions> <execution> <id>build-info</id> <goals> <goal>build-info</goal> </goals> </execution> </executions> <configuration> <excludes> <exclude> <groupId>org.projectlombok</groupId> <artifactId>lombok</artifactId> </exclude> <exclude> <groupId>org.apache.commons</groupId> <artifactId>commons-lang3</artifactId> </exclude> </excludes> </configuration> </plugin> <plugin> <artifactId>maven-clean-plugin</artifactId> <configuration> <filesets> <fileset> <directory>${basedir}</directory> <includes> <include>**/resources/static/**</include> </includes> <followSymlinks>false</followSymlinks> </fileset> </filesets> </configuration> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <configuration> <encoding>${project.build.sourceEncoding}</encoding> </configuration> <executions> <execution> <id>copy-resources</id> <phase>generate-resources</phase> <goals> <goal>copy-resources</goal> </goals> <configuration> <outputDirectory>${basedir}/src/main/resources/static</outputDirectory> <resources> <resource> <directory>../eform-fe/dist/eform-fe</directory> <filtering>false</filtering> </resource> </resources> </configuration> </execution> </executions> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-war-plugin</artifactId> <dependencies> <dependency> <groupId>org.codehaus.plexus</groupId> <artifactId>plexus-archiver</artifactId> <version>${plexus-archiver.version}</version> </dependency> </dependencies> <configuration> <archive> <manifest> <addClasspath>true</addClasspath> </manifest> </archive> <warSourceExcludes> META-INF/context.xml </warSourceExcludes> <packagingExcludes> WEB-INF/lib/hibernate-core-*.jar, WEB-INF/lib/byte-buddy-*.jar, WEB-INF/lib/commons-lang3-*.jar, %regex[WEB-INF/classes/application-(?:(?!${profile-id}).)*.properties], WEB-INF/classes/keystore/ </packagingExcludes> </configuration> </plugin> </plugins> </build> </project> 报错:[INFO] --- spring-boot:3.5.7:build-info (build-info) @ ae --- Downloading from Virtual-ESIT-Marven-Repo: http://192.168.236.139:8081/artifactory/Virtual-ESIT-Marven-Repo/org/apache/commons/commons-lang3/3.16.0/commons-lang3-3.16.0.jar [INFO] ------------------------------------------------------------------------ [INFO] BUILD FAILURE [INFO] ------------------------------------------------------------------------ [INFO] Total time: 5.595 s [INFO] Finished at: 2025-11-28T15:31:00+08:00 [INFO] ------------------------------------------------------------------------ [ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:3.5.7:build-info (build-info) on project ae: Execution build-info of goal org.springframework.boot:spring-boot-maven-plugin:3.5.7:build-info failed: Plugin org.springframework.boot:spring-boot-maven-plugin:3.5.7 or one of its dependencies could not be resolved: [ERROR] Could not transfer artifact org.apache.commons:commons-lang3:jar:3.16.0 from/to Virtual-ESIT-Marven-Repo (http://192.168.236.139:8081/artifactory/Virtual-ESIT-Marven-Repo): status code: 403, reason phrase: (403) [ERROR] [ERROR] -> [Help 1] [ERROR] [ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch. [ERROR] Re-run Maven using the -X switch to enable full debug logging. [ERROR] [ERROR] For more information about the errors and possible solutions, please read the following articles: [ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/PluginResolutionException 如何全局排除org.apache.commons:commons-lang3
最新发布
11-29
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值