web-dev-qa-db-ja.com

ポート8080でリッスンするように構成されたTomcatコネクターを開始できませんでした

私はこのプロジェクトをダウンロードしました:

https://github.com/oktadeveloper/okta-spring-boot-2-angular-5-example

このチュートリアルで説明:

https://developer.okta.com/blog/2017/12/04/basic-crud-angular-and-spring-boot

しかし、私が推奨されるコマンドでサーバーを実行しようとすると:

./mvnw spring-boot:run

次の出力が表示されます。

David@HP /cygdrive/d/wamp64/www/external/okta.example.com/server
$ ./mvnw spring-boot:run
/cygdrive/d/wamp64/www/external/okta.example.com/server
[INFO] Scanning for projects...
[INFO]
[INFO] ----------------------< com.okta.developer:demo >-----------------------
[INFO] Building demo 0.0.1-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] >>> spring-boot-maven-plugin:2.0.1.RELEASE:run (default-cli) > test-compile @ demo >>>
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:resources (default-resources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:compile (default-compile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:3.0.1:testResources (default-testResources) @ demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory D:\wamp64\www\external\okta.example.com\server\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.7.0:testCompile (default-testCompile) @ demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< spring-boot-maven-plugin:2.0.1.RELEASE:run (default-cli) < test-compile @ demo <<<
[INFO]
[INFO]
[INFO] --- spring-boot-maven-plugin:2.0.1.RELEASE:run (default-cli) @ demo ---

  .   ____          _            __ _ _
 /\\ / ___'_ __ _ _(_)_ __  __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
 \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
  '  |____| .__|_| |_|_| |_\__, | / / / /
 =========|_|==============|___/=/_/_/_/
 :: Spring Boot ::        (v2.0.1.RELEASE)

2018-07-12 20:35:06.400  INFO 2812 --- [           main] com.okta.developer.demo.DemoApplication  : Starting DemoApplication on HP with PID 2812 (D:\wamp64\www\external\okta.example.com\server\target\classes started by David in D:\wamp64\www\external\okta.example.com\server)
2018-07-12 20:35:06.410  INFO 2812 --- [           main] com.okta.developer.demo.DemoApplication  : No active profile set, falling back to default profiles: default
2018-07-12 20:35:06.499  INFO 2812 --- [           main] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@ae5e109: startup date [Thu Jul 12 20:35:06 CDT 2018]; root of context hierarchy
2018-07-12 20:35:08.603  INFO 2812 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'httpRequestHandlerAdapter' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.servlet.WebMvcAutoConfiguration$EnableWebMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/servlet/WebMvcAutoConfiguration$EnableWebMvcConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.data.rest.webmvc.config.RepositoryRestMvcConfiguration; factoryMethodName=httpRequestHandlerAdapter; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/data/rest/webmvc/config/RepositoryRestMvcConfiguration.class]]
2018-07-12 20:35:09.470  INFO 2812 --- [           main] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$29541950] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2018-07-12 20:35:10.064  INFO 2812 --- [           main] o.s.b.w.embedded.Tomcat.TomcatWebServer  : Tomcat initialized with port(s): 8080 (http)
2018-07-12 20:35:10.114  INFO 2812 --- [           main] o.Apache.catalina.core.StandardService   : Starting service [Tomcat]

...

Using generated security password: 4f87a125-b4d8-47c0-9a24-bb5fb3b2a658

2018-07-12 20:35:17.428  INFO 2812 --- [           main] o.s.s.web.DefaultSecurityFilterChain     : Creating filter chain: org.springframework.security.web.util.matcher.AnyRequestMatcher@1, [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@3052460, org.springframework.security.web.context.SecurityContextPersistenceFilter@76eee741, org.springframework.security.web.header.HeaderWriterFilter@622ee9f2, org.springframework.security.web.authentication.logout.LogoutFilter@59d663e0, org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter@a2d3781, org.springframework.security.web.savedrequest.RequestCacheAwareFilter@7492ef4f, org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter@77d8457b, org.springframework.security.web.authentication.AnonymousAuthenticationFilter@1e249f41, org.springframework.security.web.session.SessionManagementFilter@43e1a956, org.springframework.security.web.access.ExceptionTranslationFilter@7130b0d2, org.springframework.security.web.access.intercept.FilterSecurityInterceptor@384e11db]
2018-07-12 20:35:17.539  INFO 2812 --- [           main] o.s.b.a.e.web.EndpointLinksResolver      : Exposing 2 endpoint(s) beneath base path '/actuator'
2018-07-12 20:35:17.558  INFO 2812 --- [           main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/health],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public Java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,Java.util.Map<Java.lang.String, Java.lang.String>)
2018-07-12 20:35:17.558  INFO 2812 --- [           main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator/info],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto public Java.lang.Object org.springframework.boot.actuate.endpoint.web.servlet.AbstractWebMvcEndpointHandlerMapping$OperationHandler.handle(javax.servlet.http.HttpServletRequest,Java.util.Map<Java.lang.String, Java.lang.String>)
2018-07-12 20:35:17.558  INFO 2812 --- [           main] s.b.a.e.w.s.WebMvcEndpointHandlerMapping : Mapped "{[/actuator],methods=[GET],produces=[application/vnd.spring-boot.actuator.v2+json || application/json]}" onto protected Java.util.Map<Java.lang.String, Java.util.Map<Java.lang.String, org.springframework.boot.actuate.endpoint.web.Link>> org.springframework.boot.actuate.endpoint.web.servlet.WebMvcEndpointHandlerMapping.links(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse)
2018-07-12 20:35:17.660  INFO 2812 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Registering beans for JMX exposure on startup
2018-07-12 20:35:17.665  INFO 2812 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Bean with name 'dataSource' has been autodetected for JMX exposure
2018-07-12 20:35:10.114  INFO 2812 --- [           main] org.Apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.5.29
2018-07-12 20:35:17.684  INFO 2812 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource]
2018-07-12 20:35:17.755 ERROR 2812 --- [           main] o.Apache.catalina.core.StandardService   : Failed to start connector [Connector[HTTP/1.1-8080]]

org.Apache.catalina.LifecycleException: Failed to start component [Connector[HTTP/1.1-8080]]
        at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:167) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        at org.Apache.catalina.core.StandardService.addConnector(StandardService.Java:225) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.addPreviouslyRemovedConnectors(TomcatWebServer.Java:256) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.start(TomcatWebServer.Java:198) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.Java:300) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.Java:162) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.Java:553) [spring-context-5.0.5.RELEASE.jar:5.0.5.RELEASE]
        at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.Java:140) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.SpringApplication.refresh(SpringApplication.Java:759) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.Java:395) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.Java:327) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1255) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at org.springframework.boot.SpringApplication.run(SpringApplication.Java:1243) [spring-boot-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at com.okta.developer.demo.DemoApplication.main(DemoApplication.Java:23) [classes/:na]
        at Sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[na:1.8.0_172]
        at Sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.Java:62) ~[na:1.8.0_172]
        at Sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.Java:43) ~[na:1.8.0_172]
        at Java.lang.reflect.Method.invoke(Method.Java:498) ~[na:1.8.0_172]
        at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run(AbstractRunMojo.Java:496) [spring-boot-maven-plugin-2.0.1.RELEASE.jar:2.0.1.RELEASE]
        at Java.lang.Thread.run(Thread.Java:748) [na:1.8.0_172]
Caused by: org.Apache.catalina.LifecycleException: Protocol handler start failed
        at org.Apache.catalina.connector.Connector.startInternal(Connector.Java:1020) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        at org.Apache.catalina.util.LifecycleBase.start(LifecycleBase.Java:150) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        ... 19 common frames omitted
Caused by: Java.net.BindException: Address already in use: bind
        at Sun.nio.ch.Net.bind0(Native Method) ~[na:1.8.0_172]
        at Sun.nio.ch.Net.bind(Net.Java:433) ~[na:1.8.0_172]
        at Sun.nio.ch.Net.bind(Net.Java:425) ~[na:1.8.0_172]
        at Sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.Java:223) ~[na:1.8.0_172]
        at Sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.Java:74) ~[na:1.8.0_172]
        at org.Apache.Tomcat.util.net.NioEndpoint.bind(NioEndpoint.Java:210) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        at org.Apache.Tomcat.util.net.AbstractEndpoint.start(AbstractEndpoint.Java:1150) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        at org.Apache.coyote.AbstractProtocol.start(AbstractProtocol.Java:591) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        at org.Apache.catalina.connector.Connector.startInternal(Connector.Java:1018) ~[Tomcat-embed-core-8.5.29.jar:8.5.29]
        ... 20 common frames omitted

2018-07-12 20:35:17.770  INFO 2812 --- [           main] o.Apache.catalina.core.StandardService   : Stopping service [Tomcat]
2018-07-12 20:35:17.815  INFO 2812 --- [           main] ConditionEvaluationReportLoggingListener :

Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2018-07-12 20:35:17.820 ERROR 2812 --- [           main] o.s.b.d.LoggingFailureAnalysisReporter   :

***************************
APPLICATION FAILED TO START
***************************

Description:

The Tomcat connector configured to listen on port 8080 failed to start. The port may already be in use or the connector may be misconfigured.

Action:

Verify the connector's configuration, identify and stop any process that's listening on port 8080, or configure this application to listen on another port.

2018-07-12 20:35:17.820  INFO 2812 --- [           main] ConfigServletWebServerApplicationContext : Closing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@ae5e109: startup date [Thu Jul 12 20:35:06 CDT 2018]; root of context hierarchy
2018-07-12 20:35:17.825  INFO 2812 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans on shutdown
2018-07-12 20:35:17.825  INFO 2812 --- [           main] o.s.j.e.a.AnnotationMBeanExporter        : Unregistering JMX-exposed beans
2018-07-12 20:35:17.835  INFO 2812 --- [           main] j.LocalContainerEntityManagerFactoryBean : Closing JPA EntityManagerFactory for persistence unit 'default'
2018-07-12 20:35:17.835  INFO 2812 --- [           main] .SchemaDropperImpl$DelayedDropActionImpl : HHH000477: Starting delayed drop of schema as part of SessionFactory shut-down'
2018-07-12 20:35:17.850  INFO 2812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown initiated...
2018-07-12 20:35:17.860  INFO 2812 --- [           main] com.zaxxer.hikari.HikariDataSource       : HikariPool-1 - Shutdown completed.
[WARNING]
Java.lang.reflect.InvocationTargetException
    at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.Java:62)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke (Method.Java:498)
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.Java:496)
    at Java.lang.Thread.run (Thread.Java:748)
Caused by: org.springframework.boot.web.embedded.Tomcat.ConnectorStartFailedException: Connector configured to listen on port 8080 failed to start
    at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.checkThatConnectorsHaveStarted (TomcatWebServer.Java:228)
    at org.springframework.boot.web.embedded.Tomcat.TomcatWebServer.start (TomcatWebServer.Java:203)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer (ServletWebServerApplicationContext.Java:300)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh (ServletWebServerApplicationContext.Java:162)
    at org.springframework.context.support.AbstractApplicationContext.refresh (AbstractApplicationContext.Java:553)
    at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh (ServletWebServerApplicationContext.Java:140)
    at org.springframework.boot.SpringApplication.refresh (SpringApplication.Java:759)
    at org.springframework.boot.SpringApplication.refreshContext (SpringApplication.Java:395)
    at org.springframework.boot.SpringApplication.run (SpringApplication.Java:327)
    at org.springframework.boot.SpringApplication.run (SpringApplication.Java:1255)
    at org.springframework.boot.SpringApplication.run (SpringApplication.Java:1243)
    at com.okta.developer.demo.DemoApplication.main (DemoApplication.Java:23)
    at Sun.reflect.NativeMethodAccessorImpl.invoke0 (Native Method)
    at Sun.reflect.NativeMethodAccessorImpl.invoke (NativeMethodAccessorImpl.Java:62)
    at Sun.reflect.DelegatingMethodAccessorImpl.invoke (DelegatingMethodAccessorImpl.Java:43)
    at Java.lang.reflect.Method.invoke (Method.Java:498)
    at org.springframework.boot.maven.AbstractRunMojo$LaunchRunner.run (AbstractRunMojo.Java:496)
    at Java.lang.Thread.run (Thread.Java:748)
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 19.171 s
[INFO] Finished at: 2018-07-12T20:35:17-05:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:2.0.1.RELEASE:run (default-cli) on project demo: An exception occurred while running. null: InvocationTargetException: Connector configured to listen on port 8080 failed to start -> [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/MojoExecutionException

ご覧のとおり、次の1行があります。

The Tomcat connector configured to listen on port 8080 failed to start. 

サーバーを機能させる方法に関するアイデアはありますか?

ありがとう!

3
davidesp

Windows CMDでは、特定のポートで実行中のプロセスのProcess-idを見つけることができます。

netstat/nao | findstr "8080"

次に、このプロセスを終了させることができます:

taskkill/pid Process-id/f

0
SJX

私は最近このport in useの問題にSpring Boot 5.1.8.RELEASEを使用していて、Tomcat 9.0.26を使用していました

プロジェクトはEclipse STSで完全に正常に動作しましたが、(Mavenを使用して)ビルドするとCLIで実行されませんでした。たくさんの異なるポートを使ってみましたが、役に立ちませんでした。毎回同じ問題。

私は2つのことをしました

1)パッケージングがwar(jarではない)に設定されていることを確認しました-私のページではJSP/JSTLを使用しています。自分でこれを行う必要はないかもしれません。

2)Tomcatのバージョンを9.0.27に更新しましたSO post: Spring boot 2埋め込みTomcat 9.0.26はjksファイルストリームを閉じることができません 使用されていたTomcatのバージョンにバグがあるようです-9.0.26

Spring Bootから「port in use」というメッセージを受け取りましたが、これは非常に危険なことでした。

例外トレースを調べたところ、SSL構成中に爆弾が爆発したようです。簡単なグーグルは私を上記の投稿に連れて行ってくれました。

私はそれを試しました、そしてそれは初めて働きました。

ここでの他の答えは、チェック/変更されているポートに関して完全に正しいです。この回答が、私のようにポートの使用状況をチェックした人に役立つことを願っています。

0
thonnor

8080ポート以外を使用してください。 server.port = port番号を追加します。たとえば、src/main/resourcesディレクトリからapplication.propertiesファイルにserver.port = 8085を追加します。

0
Tidlee