Ich habe diesen Fehler beim Starten meiner Frühlingsanwendung:
Java -jar target/gs-serving-web-content-0.1.0.jar
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v0.5.0.M6)
2013-12-23 00:23:09.466 INFO 19252 --- [ main] hello.Application : Starting Application on mbp-de-antoine.home with PID 19252 (/Users/antoine/Documents/workspace-sts-3.4.0.RELEASE/springapp/target/gs-serving-web-content-0.1.0.jar started by antoine)
2013-12-23 00:23:09.511 INFO 19252 --- [ main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot[email protected]24024c39: startup date [Mon Dec 23 00:23:09 CET 2013]; root of context hierarchy
2013-12-23 00:23:10.910 INFO 19252 --- [ main] o.Apache.catalina.core.StandardService : Starting service Tomcat
2013-12-23 00:23:10.910 INFO 19252 --- [ main] org.Apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/7.0.42
2013-12-23 00:23:11.045 INFO 19252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext
2013-12-23 00:23:11.046 INFO 19252 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1537 ms
2013-12-23 00:23:11.274 INFO 19252 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring FrameworkServlet 'dispatcherServlet'
2013-12-23 00:23:11.274 INFO 19252 --- [ost-startStop-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization started
2013-12-23 00:23:11.409 INFO 19252 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2013-12-23 00:23:11.634 INFO 19252 --- [ost-startStop-1] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/greeting],methods=[],params=[],headers=[],consumes=[],produces=[],custom=[]}" onto public Java.lang.String hello.GreetingController.greeting(Java.lang.String,org.springframework.ui.Model)
2013-12-23 00:23:11.717 INFO 19252 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2013-12-23 00:23:11.717 INFO 19252 --- [ost-startStop-1] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler]
2013-12-23 00:23:12.406 INFO 19252 --- [ost-startStop-1] o.s.web.servlet.DispatcherServlet : FrameworkServlet 'dispatcherServlet': initialization completed in 1132 ms
2013-12-23 00:23:12.417 ERROR 19252 --- [ main] o.a.coyote.http11.Http11NioProtocol : Failed to start end point associated with ProtocolHandler ["http-nio-8080"]
Java.net.BindException: Address already in use
at Sun.nio.ch.Net.bind0(Native Method)
at Sun.nio.ch.Net.bind(Net.Java:444)
at Sun.nio.ch.Net.bind(Net.Java:436)
at Sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.Java:214)
at Sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.Java:74)
at org.Apache.Tomcat.util.net.NioEndpoint.bind(NioEndpoint.Java:473)
at org.Apache.Tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.Java:617)
at org.Apache.coyote.AbstractProtocol.start(AbstractProtocol.Java:444)
at org.Apache.catalina.connector.Connector.startInternal(Connector.Java:1010)
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
at org.Apache.catalina.core.StandardService.startInternal(StandardService.Java:459)
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
at org.Apache.catalina.core.StandardServer.startInternal(StandardServer.Java:732)
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
at org.Apache.catalina.startup.Tomcat.start(Tomcat.Java:335)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.Java:58)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.Java:53)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.Java:259)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.Java:140)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.Java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.Java:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.Java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:552)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:293)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:749)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:738)
at hello.Application.main(Application.Java:12)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.Java:53)
at Java.lang.Thread.run(Thread.Java:744)
2013-12-23 00:23:12.419 ERROR 19252 --- [ main] o.Apache.catalina.core.StandardService : Failed to start connector [Connector[org.Apache.coyote.http11.Http11NioProtocol-8080]]
org.Apache.catalina.LifecycleException: Failed to start component [Connector[org.Apache.coyote.http11.Http11NioProtocol-8080]]
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:154)
at org.Apache.catalina.core.StandardService.startInternal(StandardService.Java:459)
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
at org.Apache.catalina.core.StandardServer.startInternal(StandardServer.Java:732)
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
at org.Apache.catalina.startup.Tomcat.start(Tomcat.Java:335)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.Java:58)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.Java:53)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.Java:259)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.Java:140)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.Java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.Java:135)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.Java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:552)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:293)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:749)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:738)
at hello.Application.main(Application.Java:12)
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.Java:53)
at Java.lang.Thread.run(Thread.Java:744)
Caused by: org.Apache.catalina.LifecycleException: service.getName(): "Tomcat"; Protocol handler start failed
at org.Apache.catalina.connector.Connector.startInternal(Connector.Java:1017)
at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150)
... 24 common frames omitted
Caused by: Java.net.BindException: Address already in use
at Sun.nio.ch.Net.bind0(Native Method)
at Sun.nio.ch.Net.bind(Net.Java:444)
at Sun.nio.ch.Net.bind(Net.Java:436)
at Sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.Java:214)
at Sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.Java:74)
at org.Apache.Tomcat.util.net.NioEndpoint.bind(NioEndpoint.Java:473)
at org.Apache.Tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.Java:617)
at org.Apache.coyote.AbstractProtocol.start(AbstractProtocol.Java:444)
at org.Apache.catalina.connector.Connector.startInternal(Connector.Java:1010)
... 25 common frames omitted
2013-12-23 00:23:12.420 INFO 19252 --- [ main] o.Apache.catalina.core.StandardService : Stopping service Tomcat
2013-12-23 00:23:12.430 INFO 19252 --- [ main] nitializer$AutoConfigurationReportLogger :
=========================
AUTO-CONFIGURATION REPORT
=========================
Positive matches:
-----------------
MessageSourceAutoConfiguration
- @ConditionalOnMissingBean (types: org.springframework.context.MessageSource; SearchStrategy: all) found no beans (OnBeanCondition)
PropertyPlaceholderAutoConfiguration#propertySourcesPlaceholderConfigurer
- @ConditionalOnMissingBean (types: org.springframework.context.support.PropertySourcesPlaceholderConfigurer; SearchStrategy: current) found no beans (OnBeanCondition)
ThymeleafAutoConfiguration
- @ConditionalOnClass classes found: org.thymeleaf.spring3.SpringTemplateEngine (OnClassCondition)
- @ConditionalOnClass classes found: org.thymeleaf.spring3.SpringTemplateEngine (OnClassCondition)
ThymeleafAutoConfiguration.DefaultTemplateResolverConfiguration
- @ConditionalOnMissingBean (names: defaultTemplateResolver; SearchStrategy: all) found no beans (OnBeanCondition)
ThymeleafAutoConfiguration.ThymeleafDefaultConfiguration
- @ConditionalOnMissingBean (types: org.thymeleaf.spring3.SpringTemplateEngine; SearchStrategy: all) found no beans (OnBeanCondition)
ThymeleafAutoConfiguration.ThymeleafViewResolverConfiguration
- @ConditionalOnClass classes found: javax.servlet.Servlet (OnClassCondition)
- @ConditionalOnClass classes found: javax.servlet.Servlet (OnClassCondition)
ThymeleafAutoConfiguration.ThymeleafViewResolverConfiguration#thymeleafViewResolver
- @ConditionalOnMissingBean (names: thymeleafViewResolver; SearchStrategy: all) found no beans (OnBeanCondition)
DispatcherServletAutoConfiguration
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- @ConditionalOnClass classes found: org.springframework.web.servlet.DispatcherServlet (OnClassCondition)
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- @ConditionalOnClass classes found: org.springframework.web.servlet.DispatcherServlet (OnClassCondition)
- @ConditionalOnBean (types: org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; SearchStrategy: all) found the following [tomcatEmbeddedServletContainerFactory] (OnBeanCondition)
DispatcherServletAutoConfiguration#dispatcherServlet
- no DispatcherServlet found (DispatcherServletAutoConfiguration.DefaultDispatcherServletCondition)
EmbeddedServletContainerAutoConfiguration
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- found web application StandardServletEnvironment (OnWebApplicationCondition)
EmbeddedServletContainerAutoConfiguration.EmbeddedTomcat
- @ConditionalOnClass classes found: javax.servlet.Servlet,org.Apache.catalina.startup.Tomcat (OnClassCondition)
- @ConditionalOnClass classes found: javax.servlet.Servlet,org.Apache.catalina.startup.Tomcat (OnClassCondition)
- @ConditionalOnMissingBean (types: org.springframework.boot.context.embedded.EmbeddedServletContainerFactory; SearchStrategy: current) found no beans (OnBeanCondition)
ServerPropertiesAutoConfiguration#serverProperties
- @ConditionalOnMissingBean (types: org.springframework.boot.context.embedded.properties.ServerProperties; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- @ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet,org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter (OnClassCondition)
- found web application StandardServletEnvironment (OnWebApplicationCondition)
- @ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.servlet.DispatcherServlet,org.springframework.web.servlet.config.annotation.WebMvcConfigurerAdapter (OnClassCondition)
- @ConditionalOnMissingBean (types: org.springframework.web.servlet.config.annotation.WebMvcConfigurationSupport; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration#hiddenHttpMethodFilter
- @ConditionalOnMissingBean (types: org.springframework.web.filter.HiddenHttpMethodFilter; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#defaultViewResolver
- @ConditionalOnMissingBean (types: org.springframework.web.servlet.view.InternalResourceViewResolver; SearchStrategy: all) found no beans (OnBeanCondition)
Negative matches:
-----------------
RabbitAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.amqp.rabbit.core.RabbitTemplate,com.rabbitmq.client.Channel (OnClassCondition)
AopAutoConfiguration
- required @ConditionalOnClass classes not found: org.aspectj.lang.annotation.Aspect,org.aspectj.lang.reflect.Advice (OnClassCondition)
BatchAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.batch.core.launch.JobLauncher (OnClassCondition)
JpaRepositoriesAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.data.jpa.repository.JpaRepository (OnClassCondition)
MongoRepositoriesAutoConfiguration
- required @ConditionalOnClass classes not found: com.mongodb.Mongo,org.springframework.data.mongodb.repository.MongoRepository (OnClassCondition)
DataSourceAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.jdbc.datasource.embedded.EmbeddedDatabaseType (OnClassCondition)
DataSourceTransactionManagerAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.jdbc.core.JdbcTemplate,org.springframework.transaction.PlatformTransactionManager (OnClassCondition)
JmsTemplateAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.jms.core.JmsTemplate,javax.jms.ConnectionFactory (OnClassCondition)
DeviceResolverAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.mobile.device.DeviceResolverHandlerInterceptor,org.springframework.mobile.device.DeviceHandlerMethodArgumentResolver (OnClassCondition)
HibernateJpaAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.orm.jpa.LocalContainerEntityManagerFactoryBean,org.springframework.transaction.annotation.EnableTransactionManagement,javax.persistence.EntityManager,org.hibernate.ejb.HibernateEntityManager (OnClassCondition)
ReactorAutoConfiguration
- required @ConditionalOnClass classes not found: reactor.spring.context.config.EnableReactor (OnClassCondition)
ThymeleafAutoConfiguration.ThymeleafSecurityDialectConfiguration
- required @ConditionalOnClass classes not found: org.thymeleaf.extras.springsecurity3.dialect.SpringSecurityDialect (OnClassCondition)
ThymeleafAutoConfiguration.ThymeleafWebLayoutConfiguration
- required @ConditionalOnClass classes not found: nz.net.ultraq.thymeleaf.LayoutDialect (OnClassCondition)
EmbeddedServletContainerAutoConfiguration.EmbeddedJetty
- required @ConditionalOnClass classes not found: org.Eclipse.jetty.server.Server,org.Eclipse.jetty.util.Loader (OnClassCondition)
MultipartAutoConfiguration
- @ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.multipart.support.StandardServletMultipartResolver (OnClassCondition)
- @ConditionalOnClass classes found: javax.servlet.Servlet,org.springframework.web.multipart.support.StandardServletMultipartResolver (OnClassCondition)
- @ConditionalOnBean (types: javax.servlet.MultipartConfigElement; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#beanNameViewResolver
- @ConditionalOnBean (types: org.springframework.web.servlet.View; SearchStrategy: all) found no beans (OnBeanCondition)
WebMvcAutoConfiguration.WebMvcAutoConfigurationAdapter#viewResolver
- @ConditionalOnBean (types: org.springframework.web.servlet.View; SearchStrategy: all) found no beans (OnBeanCondition)
WebSocketAutoConfiguration
- required @ConditionalOnClass classes not found: org.springframework.web.socket.WebSocketHandler (OnClassCondition)
Java.lang.reflect.InvocationTargetException
at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:57)
at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43)
at Java.lang.reflect.Method.invoke(Method.Java:606)
at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.Java:53)
at Java.lang.Thread.run(Thread.Java:744)
Caused by: org.springframework.context.ApplicationContextException: Unable to start embedded container; nested exception is org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embdedded Tomcat
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.Java:138)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:476)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.Java:122)
at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:552)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:293)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:749)
at org.springframework.boot.SpringApplication.run(SpringApplication.Java:738)
at hello.Application.main(Application.Java:12)
... 6 more
Caused by: org.springframework.boot.context.embedded.EmbeddedServletContainerException: Unable to start embdedded Tomcat
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.Java:85)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainer.<init>(TomcatEmbeddedServletContainer.Java:53)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainerFactory.getTomcatEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.Java:259)
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainerFactory.getEmbeddedServletContainer(TomcatEmbeddedServletContainerFactory.Java:140)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.createEmbeddedServletContainer(EmbeddedWebApplicationContext.Java:158)
at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.onRefresh(EmbeddedWebApplicationContext.Java:135)
... 13 more
Caused by: Java.lang.IllegalStateException: Tomcat connector in failed state
at org.springframework.boot.context.embedded.Tomcat.TomcatEmbeddedServletContainer.initialize(TomcatEmbeddedServletContainer.Java:81)
... 18 more
Ich denke das liegt daran, dass mein Port benutzt wird. Mein Port 8080 wird verwendet, also versuche ich den Port 8181 Ich habe keine Anwendung für den Port 8181
in der Tomcat server.xml habe ich den Port auf 8181 gesetzt, aber das Problem bleibt bestehen
Ich finde diesen Beitrag:
Alternativer Port für Tomcat (nicht 8080) beim Start mit Maven?
Aber ich habe das gleiche Problem nach dem Start von mvn -Dmaven.Tomcat.port = 8181 Tomcat: run-war
Ich verstehe nicht wirklich, wie Maven mit dem Tomcat-Server verbunden ist Dies ist meine 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 http://maven.Apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.springframework</groupId>
<artifactId>gs-serving-web-content</artifactId>
<version>0.1.0</version>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>0.5.0.M6</version>
</parent>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.thymeleaf</groupId>
<artifactId>thymeleaf-spring3</artifactId>
</dependency>
</dependencies>
<properties>
<start-class>hello.Application</start-class>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>spring-milestone</id>
<url>http://repo.spring.io/libs-milestone</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
</project>
Danke für Ihre Hilfe
Spring Boot verwendet standardmäßig eingebettetes Tomcat, behandelt es jedoch anders, ohne Tomcat-maven-plugin
zu verwenden. Um den Port zu ändern, verwenden Sie beispielsweise den Parameter --server.port
:
Java -jar target/gs-serving-web-content-0.1.0.jar --server.port=8181
Führen Sie den folgenden Befehl aus, um nach dem Prozess zu suchen, der den Port verwendet
lsof -i :<portNumber> | grep LISTEN
in Ihrem Fall wird dies -> sein
lsof -i :8080 | grep LISTEN
Java 78960 xyxss 119u IPv6 0x6c20d372bc88c27d 0t0 TCP *:8092 (LISTEN)
Die 78960 ist die Prozess-ID. Verwenden Sie den folgenden Befehl, um den Prozess zu beenden
kill -9 78960
Starten Sie die Anwendung erneut.
Konfigurieren Sie eine weitere Portnummer (zB: 8181) in /src/main/resources/application.properties.
server.port = 8181
Sie müssen den Server vor dem Neustart stoppen. Suchen Sie nach dem roten Kästchen oder der Serveransicht.
Beim Verwenden von IntelliJ erhielt ich diese Fehlermeldung, als ich versuchte, eine Spring-App auszuführen, während bereits eine App lief. Ich musste den ersten stoppen. Nach dem Ausführen der zweiten App wurden keine Fehler zurückgegeben.
prüfen Sie zunächst, wer den Port 8080 verwendet.
wenn der Port 8080 verwendet wird, ändern Sie den Empfangsport auf 8181.
wenn Sie IDEA verwenden, ändern Sie die Startkonfiguration.... Run-> Edit Configuration geben Sie die Bildbeschreibung hier ein
wenn Sie mvn spring-boot verwenden, verwenden Sie den Befehl:
mvn spring-boot:run -Dserver.port=8181
wenn Sie Java -jar verwenden, verwenden Sie den Befehl:
Java -jar xxxx.jar --server.port=8181
In meinem Fall zeigte der Blick in das Serverfenster nur einen Tomcat-Server, den ich noch nie für dieses Projekt verwendet hatte. Mein SpringBoot-Projekt verwendete einen eingebetteten Tomcat-Server und wurde nicht beendet, als meine Anwendung beendet war. Diese Schaltfläche, die ich mit einem roten Pfeil anzeige, stoppt die Anwendung und den Tomcat-Server. Beim nächsten Ausführen der Anwendung erhalte ich nicht die Fehlermeldung, dass eine Instanz von Tomcat bereits auf Port 8080 ausgeführt wird.
aktuelle Fehlermeldungen:
Überprüfen Sie die Konfiguration des Connectors, identifizieren und stoppen Sie jeden Prozess das Port 8080 überwacht, oder konfigurieren Sie diese Anwendung für das Hören an einem anderen Hafen.
Verursacht durch: Java.net.BindException: Bereits verwendete Adresse Verursacht durch: org.Apache.catalina.LifecycleException: service.getName (): "Tomcat"; Protokollhandlerstart fehlgeschlagen
Ich werde nun nach einer Möglichkeit suchen, alle Dienste nach Abschluss meiner SpringBoot Consuming Rest-Anwendung in diesem Tutorial herunterzufahren. https://spring.io/guides/gs/consuming-rest/
sie können eine andere Portnummer in Ihrer IDE konfigurieren /src/main/resources/application.properties
server.port = 8081
ansonsten klicken Sie mit der rechten Maustaste auf die Registerkarte IDE console und wählen Sie Terminate/Disconnect All aus.
Ich würde vorschlagen, die Portnummer zu töten. Es hat für mich funktioniert
netstat -ano | findstr :yourPortNumber taskkill /PID typeyourPIDhere /F
Sie können dies folgendermaßen beheben:
server.port=8181
oder einen beliebigen anderen Port Ihrer Wahl hinzu. Dadurch wird der Standardport (8080) überschriebenIn Ihrer application.properties -Datei -
/ src/main/resources/application.properties
Ändern Sie die Portnummer in etwa so -
server.port = 8181
Alternativ können Sie eine alternative Portnummer angeben, während Sie Ihre JAR-Datei ausführen. -Java-Ressourcen-Server/build/libs/resource-server.jar --server.port = 8888
In meinem Fall verwendete Oracle TNS Service den Port 8080 und stellte fest, dass der Befehl "netstat - anob" als Administrator ausgeführt wurde. Sie haben einfach Shutdown Database aus dem Windows-Startmenü verwendet, um diesen Dienst zu stoppen und konnten die SpringBoot-App ohne Probleme starten.
Wenn Sie nicht herausfinden können, welche App den 8080-Port verwendet, und nur die SprintBoot-App ausführen möchten, klicken Sie auf Ausführen als ... und geben Sie in die Argumente VM Folgendes ein: - Dserver.port = 0 (dadurch wird ein beliebiger verfügbarer Port ausgewählt) oder Sie können Folgendes angeben: -Dserver.port = 8081
Ich hoffe es hilft.
Dies funktionierte nur für mich, indem zusätzliche Eigenschaften festgelegt und verfügbare Portnummern verwendet wurden.
/src/main/resources/application.yml
server:
port: 18181
management:
port: 9191
Tomcat:
jvmroute: 5478
ajp:
port: 4512
redirectPort: 1236
/src/main/resources/application.properties
server.port=18181
management.port=9191
Tomcat.jvmroute=5478
Tomcat.ajp.port=4512
Tomcat.ajp.redirectPort=1236
Ich versuche die Portnummer in der folgenden Datei zu ändern - /src/main/resources/application-prod.yml
Und in dieser Datei habe ich diese Änderung vorgenommen:
server: Port: 8100 (oder was auch immer Sie möchten)
Ich hoffe, dass dies gut für Sie funktioniert
Ich habe dieses Problem gelöst, indem Sie die Anwendung anhalten (rotes Quadrat in Eclipse), bevor Sie es erneut ausführen .. Wenn Sie es nicht beenden, bleibt die Anwendung im Ausführungsmodus, also wird der Port weiterhin verwendet.
Das ist wirklich eine alte Frage. Vielleicht ist das nützlich. Wenn ich mich auf Ihr Titelproblem konzentriere, starte ich meine Anwendungen und kann sie dann ganz einfach beenden. Ändern Sie die Portnummer für jede Anwendung, die Sie starten möchten, wie oben erwähnt.
application.properties
#using curl -X POST localhost:8080/actuator/shutdown to avoid:
#netstat -ano | find "8080"
#taskkill /F /PID xxxx (xxxx stands for PID)
management.endpoints.web.exposure.include=*
management.endpoint.shutdown.enabled=true
endpoints.shutdown.enabled=true
füge diese Abhängigkeit hinzu:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
Jetzt können Sie leicht durch Abschießen
curl -X POST localhost:8080/actuator/shutdown
Schließen Sie die Anwendung und starten Sie sie neu, nachdem Sie einen neuen Port ausgewählt haben:
${port:8181}
Sie können jeden neuen, nicht verwendeten Port verwenden. Hier habe ich Port 8181 verwendet.
Sie haben einen anderen Prozess, der Port 8080 überwacht. Dies ist der Standardport, der vom Web-Support von Spring Boot verwendet wird. Sie müssen diesen Vorgang entweder anhalten oder Ihre App so konfigurieren, dass ein anderer Port überwacht wird.
Sie können die Portkonfiguration ändern, indem Sie server.port = 4040 (beispielsweise) zu src/main/resources/application.properties hinzufügen.
Grundsätzlich wird der Standardserver normalerweise im Hintergrund an Port 8080 ausgeführt. Öffnen Sie services.msc, stoppen Sie den Tomcat-Server und versuchen Sie, die Spring-Boot-Anwendung erneut auszuführen.
Wenn die Spring Tool Suite in Eclipse installiert ist, können Sie nach Boot Dashboard gehen und local im Explorer erweitern. Klicken Sie mit der rechten Maustaste auf die Anwendung, die auf Port 8080 ausgeführt wird, und stoppen Sie sie, bevor Sie die Anwendung erneut ausführen.