Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/387.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/vue.js/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java Web服务器无法启动。端口已在使用中。错误。但应用程序仍在运行_Java_Spring_Spring Boot_Hibernate - Fatal编程技术网

Java Web服务器无法启动。端口已在使用中。错误。但应用程序仍在运行

Java Web服务器无法启动。端口已在使用中。错误。但应用程序仍在运行,java,spring,spring-boot,hibernate,Java,Spring,Spring Boot,Hibernate,我正在制作一个spring启动应用程序。直到两天前,一切都很顺利。 当我启动我的应用程序时,我得到: “应用程序无法启动。 Web服务器启动失败。端口8443已在使用。“ 但是。。。。当我检查我的邮递员时,应用程序正在运行。。。。所以错误不应该存在。我真的很想在这里得到一些帮助。我不知道我做错了什么。 我已经尝试了不同的端口,但这不是问题所在 这是我的“application.properties” 还有我的pom.xml <?xml version="1.0" enc

我正在制作一个spring启动应用程序。直到两天前,一切都很顺利。 当我启动我的应用程序时,我得到:

“应用程序无法启动。 Web服务器启动失败。端口8443已在使用。“

但是。。。。当我检查我的邮递员时,应用程序正在运行。。。。所以错误不应该存在。我真的很想在这里得到一些帮助。我不知道我做错了什么。 我已经尝试了不同的端口,但这不是问题所在

这是我的“application.properties”

还有我的pom.xml

<?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>2.4.4</version>
        <relativePath/> <!-- lookup parent from repository -->
    </parent>
    <groupId>nl.eind.java</groupId>
    <artifactId>backend</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <name>backend</name>
    <description>Java eindopdracht </description>
    <properties>
        <java.version>11</java.version>
    </properties>
    <dependencies>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</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>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-devtools</artifactId>
            <scope>runtime</scope>
            <optional>true</optional>
        </dependency>
        <dependency>
            <groupId>org.postgresql</groupId>
            <artifactId>postgresql</artifactId>
            <scope>runtime</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-test</artifactId>
            <scope>test</scope>
            <exclusions>
                <exclusion>
                    <groupId>org.junit.vintage</groupId>
                    <artifactId>junit-vintage-engine</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>junit</groupId>
            <artifactId>junit</artifactId>
            <scope>test</scope>
        </dependency>
        <dependency>
            <groupId>org.springframework.security</groupId>
            <artifactId>spring-security-test</artifactId>
            <scope>test</scope>
        </dependency>
</dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
            </plugin>
        </plugins>
    </build>

</project>

4.0.0
org.springframework.boot
spring启动程序父级
2.4.4
nl.eind.java
后端
0.0.1-快照
后端
Java eindopdracht
11
org.springframework.boot
spring引导启动器数据jpa
org.springframework.boot
弹簧启动安全
org.springframework.boot
SpringBootStarterWeb
org.springframework.boot
弹簧靴开发工具
运行时
真的
org.postgresql
postgresql
运行时
org.springframework.boot
弹簧起动试验
测试
org.junit.vintage
朱尼特老式发动机
朱尼特
朱尼特
测试
org.springframework.security
弹簧安全性试验
测试
org.springframework.boot
springbootmaven插件

如果您在windows上运行,您可以找到在端口上运行的进程,并使用下面的命令终止该进程,以便释放该端口

netstat -ano | findstr :8443
taskkill /pid "EnterProcessIdHere" /F

对于linux

lsof -i :8443
kill EnterProcessIdHere

捕获java.net.bindeException,其中消息:Address已在使用中

try {
        SpringApplication.run(Application.class, args);
    } catch (org.springframework.boot.web.server.PortInUseException e) {
//Runtime.exec("pkil")..
//or
SpringApplication.run(Application.class, otherargs);
//SpringApplication.run(Application.class, new String[]{"--server.port=8444"});
//when invoked recursively it is a port rebalancer for port usage among port pool with server as from client for startup stage via application restarts within many busy ports which are used before or without querying.
}

它正在运行,因为您尚未停止它,当您尝试重新运行它时,它会说它无法重新分配已在使用的端口。杀死以前运行的实例并再次运行。最好终止JVM实例(运行服务器)并重新启动。有时,当您在不停止tomcat服务器的情况下强制关闭IDE时,JVM不会被终止,如果您遇到此问题,请尝试终止java任务/进程,它会工作。感谢您的建议,我如何通过。。。?无法选择“正常停止”选项,因为它未在运行。@lisa来自您的操作系统(我们不知道),即Windows的任务管理器或使用*nix环境上的
kill
命令
try {
        SpringApplication.run(Application.class, args);
    } catch (org.springframework.boot.web.server.PortInUseException e) {
//Runtime.exec("pkil")..
//or
SpringApplication.run(Application.class, otherargs);
//SpringApplication.run(Application.class, new String[]{"--server.port=8444"});
//when invoked recursively it is a port rebalancer for port usage among port pool with server as from client for startup stage via application restarts within many busy ports which are used before or without querying.
}