Jetty启动项目失败,WebService在本机上发布后报错:

启动报错:

Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 21,110: Cannot assign requested address

2021-03-30 08:12:14.301 [main] ERROR org.apache.catalina.core.ContainerBase.[Tomcat].[localhost].[/] Line:175 - StandardWrapper.Throwable
javax.xml.ws.WebServiceException: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 21,110: Cannot assign requested address
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:375)
	at org.apache.cxf.jaxws.EndpointImpl.publish(EndpointImpl.java:255)
	at org.apache.cxf.jaxws.spi.ProviderImpl.createAndPublishEndpoint(ProviderImpl.java:134)
	at javax.xml.ws.Endpoint.publish(Endpoint.java:240)
	at OThinker.H3.Portal.webservices.impl.OrganizationImpl.startService(OrganizationImpl.java:370)
	at OThinker.servlet.StartServlet.init(StartServlet.java:46)
	at javax.servlet.GenericServlet.init(GenericServlet.java:158)
	at org.apache.catalina.core.StandardWrapper.initServlet(StandardWrapper.java:1124)
	at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:974)
	at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.load(TomcatEmbeddedContext.java:83)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:184)
	at java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1380)
	at java.util.stream.ReferencePipeline$Head.forEach(ReferencePipeline.java:580)
	at java.util.stream.ReferencePipeline$7$1.accept(ReferencePipeline.java:270)
	at java.util.TreeMap$ValueSpliterator.forEachRemaining(TreeMap.java:2897)
	at java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:481)
	at java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:471)
	at java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:151)
	at java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:174)
	at java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
	at java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:418)
	at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.lambda$deferredLoadOnStartup$0(TomcatEmbeddedContext.java:65)
	at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.doWithThreadContextClassLoader(TomcatEmbeddedContext.java:108)
	at org.springframework.boot.web.embedded.tomcat.TomcatEmbeddedContext.deferredLoadOnStartup(TomcatEmbeddedContext.java:64)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.performDeferredLoadOnStartup(TomcatWebServer.java:282)
	at org.springframework.boot.web.embedded.tomcat.TomcatWebServer.start(TomcatWebServer.java:200)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.startWebServer(ServletWebServerApplicationContext.java:311)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.finishRefresh(ServletWebServerApplicationContext.java:164)
	at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:549)
	at org.springframework.boot.web.servlet.context.ServletWebServerApplicationContext.refresh(ServletWebServerApplicationContext.java:142)
	at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:775)
	at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:397)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:316)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1260)
	at org.springframework.boot.SpringApplication.run(SpringApplication.java:1248)
	at com.h3bpm.web.WebApiBootStartupApplication.main(WebApiBootStartupApplication.java:18)
	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.loader.MainMethodRunner.run(MainMethodRunner.java:48)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
	at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
	at org.springframework.boot.loader.JarLauncher.main(JarLauncher.java:58)
Caused by: org.apache.cxf.interceptor.Fault: Could not start Jetty server on port 21,110: Cannot assign requested address
	at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:484)
	at org.apache.cxf.transport.http_jetty.JettyHTTPDestination.activate(JettyHTTPDestination.java:187)
	at org.apache.cxf.transport.AbstractObservable.setMessageObserver(AbstractObservable.java:53)
	at org.apache.cxf.binding.AbstractBindingFactory.addListener(AbstractBindingFactory.java:95)
	at org.apache.cxf.binding.soap.SoapBindingFactory.addListener(SoapBindingFactory.java:894)
	at org.apache.cxf.endpoint.ServerImpl.start(ServerImpl.java:132)
	at org.apache.cxf.jaxws.EndpointImpl.doPublish(EndpointImpl.java:366)
	... 43 common frames omitted
Caused by: java.net.BindException: Cannot assign requested address
	at sun.nio.ch.Net.bind0(Native Method)
	at sun.nio.ch.Net.bind(Net.java:433)
	at sun.nio.ch.Net.bind(Net.java:425)
	at sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:223)
	at sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:74)
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:339)
	at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:307)
	at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
	at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:235)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.eclipse.jetty.server.Server.doStart(Server.java:395)
	at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:68)
	at org.apache.cxf.transport.http_jetty.JettyHTTPServerEngine.addServant(JettyHTTPServerEngine.java:473)
	... 49 common frames omitted

经调试发现是发布时发布的IP地址有误所致!将IP地址修改正确即可


#修改配置地址为本机地址
  webServices: #webservice发布地址
    OrganizationAddress: http://10.10.10.107:21110/Portal/WebServices/Organization
    SSOServiceAddress: http://10.10.10.107:21111/Portal/WebServices/SSOService
    BPMServiceAddress: http://10.10.10.107:21112/Portal/WebServices/BPMService
    ActivityInfoServiceAddress: http://10.10.10.107:21113/Portal/WebServices/ActivityInfoService

将IP地址修改正确即可正常启动

2021-03-30 08:30:49.966 [main-EventThread] INFO  org.I0Itec.zkclient.ZkClient Line:713 - zookeeper state changed (SyncConnected)
2021-03-30 08:30:49.971 [main] INFO  com.authine.zk.impl.DiscoveryServiceImpl Line:85  - address node is /authine/h3bpm-engine/address-0000000016
2021-03-30 08:30:49.976 [main] INFO  com.authine.zk.impl.DiscoveryServiceImpl Line:88  - data found.
2021-03-30 08:30:49.978 [main] INFO  com.h3bpm.base.engine.connection.EngineConnectionUtil Line:63  - get engine
2021-03-30 08:30:49.979 [main] INFO  com.h3bpm.base.engine.connection.EngineConnectionUtil Line:125 - Registry center is enabled, will get engine config from registry center...
2021-03-30 08:30:49.980 [main] INFO  com.authine.zk.impl.DiscoveryServiceImpl Line:85  - address node is /authine/h3bpm-engine/address-0000000016
2021-03-30 08:30:49.980 [main] INFO  com.authine.zk.impl.DiscoveryServiceImpl Line:88  - data found.
2021-03-30 08:30:49.980 [main] DEBUG com.h3bpm.base.engine.AuthInfoHolder Line:61  - load user info from config file
2021-03-30 08:30:50.000 [main] INFO  com.h3bpm.base.engine.connection.EngineConnectionUtil Line:125 - Registry center is enabled, will get engine config from registry center...
2021-03-30 08:30:50.001 [main] INFO  com.authine.zk.impl.DiscoveryServiceImpl Line:85  - address node is /authine/h3bpm-engine/address-0000000016
2021-03-30 08:30:50.002 [main] INFO  com.authine.zk.impl.DiscoveryServiceImpl Line:88  - data found.
2021-03-30 08:30:50.049 [main] DEBUG com.h3bpm.base.engine.AuthInfoHolder Line:61  - load user info from config file
2021-03-30 08:30:50.113 [main] INFO  OThinker.Common.util.ShutdownHookUtil Line:17  - register hook datasource
2021-03-30 08:30:51.114 [main] INFO  com.alibaba.druid.pool.DruidDataSource Line:930 - {dataSource-1} inited
2021-03-30 08:30:51.300 [main] DEBUG com.h3bpm.base.util.DataTableConvert Line:94  - toBean method cost 21 ms
2021-03-30 08:30:51.456 [main] INFO  io.lettuce.core.EpollProvider Line:68  - Starting without optional epoll library
2021-03-30 08:30:51.457 [main] INFO  io.lettuce.core.KqueueProvider Line:70  - Starting without optional kqueue library
2021-03-30 08:30:52.041 [main] INFO  com.h3bpm.web.cars.cache.CacheInitialize Line:34  - 初始化缓存完成。。。

版权声明:本文为作者原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。

原创文章,作者:老C,如若转载,请注明出处:https://www.code404.icu/122.html

发表评论

登录后才能评论