Kill命令在java.net.BindException: Address already in use错误上无法工作。

huangapple go评论67阅读模式
英文:

Kill command not working on java.net.BindException: Address already in use error

问题

以下是您提供的内容的翻译:

没有其他类似的帖子能解决我的问题。

为Apache Nifi生成的用户名和密码无法使用。

我正在按照这些说明进行操作。

我尝试运行tail -f nifi-app.log命令来排除问题。

并获得以下结果...

引起: java.net.BindException: 地址已被使用
	at java.base/sun.nio.ch.Net.bind0(Native Method)
	at java.base/sun.nio.ch.Net.bind(Net.java:555)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
	at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
	... 10个常见帧省略
2023-05-10 14:22:54,303 INFO [Thread-0] org.apache.nifi.NiFi应用程序服务器已启动关闭

我尝试使用以下命令检查端口sudo lsof -i :8443

并获得以下响应...

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    71776 user 3146u  IPv4 0x9a0863600c7cb941      0t0  TCP localhost:pcsync-https (LISTEN)

所以,我使用kill 71776杀死了该进程。

然后,我再次使用bin/nifi.sh start启动了Nifi

并再次运行了tail -f nifi-app.log命令,结果如下...

2023-05-10 14:57:09,939 INFO [main] o.e.jetty.server.handler.ContextHandler 已启动o.e.j.w.WebAppContext@ff0e6d4{/nifi-jolt-transform-json-ui-1.21.0,/nifi-jolt-transform-json-ui-1.21.0,file:///Users/user/nifi-1.21.0/work/jetty/nifi-jolt-transform-json-ui-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-standard-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-jolt-transform-json-ui-1.21.0.war}
2023-05-10 14:57:10,512 INFO [main] o.e.j.a.AnnotationConfiguration 扫描经过的时间= 143毫秒
2023-05-10 14:57:10,530 INFO [main] o.e.j.s.handler.ContextHandler._nifi 在类路径上未检测到Spring WebApplicationInitializer类型
2023-05-10 14:57:10,604 INFO [main] o.e.jetty.server.handler.ContextHandler 已启动o.e.j.w.WebAppContext@70d3cdbf{nifi,/nifi,file:///Users/user/nifi-1.21.0/work/jetty/nifi-web-ui-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-server-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-web-ui-1.21.0.war}
英文:

None of the other similar posts to this issue fix my problem.

The generated username and password for Apache Nifi doesn't work.

Kill命令在java.net.BindException: Address already in use错误上无法工作。

I'm following these instructions.

Kill命令在java.net.BindException: Address already in use错误上无法工作。

I tried running the tail -f nifi-app.log command to troubleshoot the issue.

And got the following results...

Caused by: java.net.BindException: Address already in use
	at java.base/sun.nio.ch.Net.bind0(Native Method)
	at java.base/sun.nio.ch.Net.bind(Net.java:555)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
	at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
	at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
	at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
	... 10 common frames omitted
2023-05-10 14:22:54,303 INFO [Thread-0] org.apache.nifi.NiFi Application Server shutdown started

I tried checking the port with the following command sudo lsof -i :8443

and got the following response,,,

COMMAND   PID USER   FD   TYPE             DEVICE SIZE/OFF NODE NAME
java    71776 user 3146u  IPv4 0x9a0863600c7cb941      0t0  TCP localhost:pcsync-https (LISTEN)

So, I killed the process using kill 71776

I started Nifi again using bin/nifi.sh start

and again ran the command tail -f nifi-app.log

which resulted in the following...

2023-05-10 14:57:09,939 INFO [main] o.e.jetty.server.handler.ContextHandler Started o.e.j.w.WebAppContext@ff0e6d4{/nifi-jolt-transform-json-ui-1.21.0,/nifi-jolt-transform-json-ui-1.21.0,file:///Users/user/nifi-1.21.0/work/jetty/nifi-jolt-transform-json-ui-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-standard-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-jolt-transform-json-ui-1.21.0.war}
2023-05-10 14:57:10,512 INFO [main] o.e.j.a.AnnotationConfiguration Scanning elapsed time=143ms
2023-05-10 14:57:10,530 INFO [main] o.e.j.s.handler.ContextHandler._nifi No Spring WebApplicationInitializer types detected on classpath
2023-05-10 14:57:10,604 INFO [main] o.e.jetty.server.handler.ContextHandler Started o.e.j.w.WebAppContext@70d3cdbf{nifi,/nifi,file:///Users/user/nifi-1.21.0/work/jetty/nifi-web-ui-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-server-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-web-ui-1.21.0.war}
2023-05-10 14:57:11,128 INFO [main] o.e.j.a.AnnotationConfiguration Scanning elapsed time=273ms
2023-05-10 14:57:11,131 INFO [main] o.e.j.s.handler.ContextHandler._nifi_api No Spring WebApplicationInitializer types detected on classpath
2023-05-10 14:57:11,248 INFO [main] o.e.j.s.handler.ContextHandler._nifi_api Initializing Spring root WebApplicationContext
2023-05-10 14:57:14,041 INFO [main] o.a.nifi.properties.NiFiPropertiesLoader Loading Application Properties [/Users/user/nifi-1.21.0/./conf/nifi.properties]
2023-05-10 14:57:17,367 INFO [main] o.a.n.r.v.FileBasedVariableRegistry Loaded 91 properties from system properties and environment variables
2023-05-10 14:57:17,367 INFO [main] o.a.n.r.v.FileBasedVariableRegistry Loaded a total of 91 properties.  Including precedence overrides effective accessible registry key size is 91
2023-05-10 14:57:18,441 INFO [main] o.a.n.c.r.WriteAheadFlowFileRepository Initialized FlowFile Repository
2023-05-10 14:57:18,450 INFO [main] o.apache.nifi.controller.FlowController Creating Provenance Repository [org.apache.nifi.provenance.WriteAheadProvenanceRepository]
2023-05-10 14:57:18,509 INFO [main] o.a.n.p.store.WriteAheadStorePartition After recovering ./provenance_repository, next Event ID to be generated will be 0
2023-05-10 14:57:18,514 INFO [main] o.a.n.p.index.lucene.LuceneEventIndex Will avoid re-indexing Provenance Events because the newest index is defunct, so it will be re-indexed in the background
2023-05-10 14:57:18,515 INFO [main] o.apache.nifi.controller.FlowController Creating Content Repository [org.apache.nifi.controller.repository.FileSystemRepository]
2023-05-10 14:57:18,523 INFO [main] o.a.n.c.repository.FileSystemRepository Maximum Threshold for Container default set to 129851995586 bytes; if volume exceeds this size, archived data will be deleted until it no longer exceeds this size
2023-05-10 14:57:18,523 INFO [main] o.a.n.c.repository.FileSystemRepository Initializing FileSystemRepository with 'Always Sync' set to false
2023-05-10 14:57:18,927 INFO [main] org.wali.MinimalLockingWriteAheadLog org.wali.MinimalLockingWriteAheadLog@149fab7f finished recovering records. Performing Checkpoint to ensure proper state of Partitions before updates
2023-05-10 14:57:18,927 INFO [main] org.wali.MinimalLockingWriteAheadLog Successfully recovered 2 records in 8 milliseconds
2023-05-10 14:57:18,951 INFO [main] org.wali.MinimalLockingWriteAheadLog org.wali.MinimalLockingWriteAheadLog@149fab7f checkpointed with 2 Records and 0 Swap Files in 24 milliseconds (Stop-the-world time = 7 milliseconds, Clear Edit Logs time = 10 millis), max Transaction ID 1
2023-05-10 14:57:19,032 INFO [main] o.apache.nifi.controller.FlowController Not enabling RAW Socket Site-to-Site functionality because nifi.remote.input.socket.port is not set
2023-05-10 14:57:22,380 INFO [main] o.s.s.web.DefaultSecurityFilterChain Will secure any request with [org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter@6b89cbc0, org.apache.nifi.web.security.csrf.SkipReplicatedCsrfFilter@7a9c91e7, org.springframework.security.web.csrf.CsrfFilter@52e10d07, org.apache.nifi.web.security.x509.X509AuthenticationFilter@2b7e07e0, org.springframework.security.oauth2.server.resource.web.authentication.BearerTokenAuthenticationFilter@37717b97, org.apache.nifi.web.security.log.AuthenticationUserFilter@12837172, org.springframework.security.web.access.ExceptionTranslationFilter@40b4a59c, org.springframework.security.web.access.intercept.AuthorizationFilter@26d38b98]
2023-05-10 14:57:23,190 INFO [main] o.a.n.w.c.ApplicationStartupContextListener Starting Flow Controller...
2023-05-10 14:57:23,209 INFO [main] o.a.n.c.s.VersionedFlowSynchronizer Synchronizing FlowController with proposed flow: Controller Already Synchronized = false
2023-05-10 14:57:23,444 INFO [main] o.a.n.c.s.VersionedFlowSynchronizer In order to inherit proposed dataflow, will stop any components that will be affected by the update
2023-05-10 14:57:23,445 INFO [main] o.a.n.c.s.AffectedComponentSet Stopping the following components: AffectedComponentSet[inputPorts=[], outputPorts=[], remoteInputPorts=[], remoteOutputPorts=[], processors=[], parameterProviders=[], flowRegistryCliens=[], controllerServices=[], reportingTasks=[]]
2023-05-10 14:57:23,449 INFO [main] o.a.n.c.s.AffectedComponentSet Successfully stopped all components in 3 milliseconds
2023-05-10 14:57:23,456 INFO [main] o.a.n.wali.SequentialAccessWriteAheadLog Recovering records from Write-Ahead Log at ./flowfile_repository
2023-05-10 14:57:23,470 INFO [main] org.apache.nifi.wali.HashMapSnapshot org.apache.nifi.wali.HashMapSnapshot@5c2463d8 restored 0 Records and 0 Swap Files from Snapshot, ending with Transaction ID -1
2023-05-10 14:57:23,472 INFO [main] o.a.n.wali.SequentialAccessWriteAheadLog Successfully recovered 0 records and 0 swap files from Snapshot at ./flowfile_repository/checkpoint with Max Transaction ID of -1 in 14 milliseconds. Now recovering records from 1 journal files
2023-05-10 14:57:23,477 INFO [main] o.a.nifi.wali.LengthDelimitedJournal Recovering records from journal ./flowfile_repository/journals/0.journal
2023-05-10 14:57:23,482 INFO [main] o.a.nifi.wali.LengthDelimitedJournal Successfully recovered 0 updates from journal ./flowfile_repository/journals/0.journal
2023-05-10 14:57:23,483 INFO [main] o.a.n.wali.SequentialAccessWriteAheadLog Successfully recovered 0 records in 26 milliseconds. Now checkpointing to ensure that Write-Ahead Log is in a consistent state
2023-05-10 14:57:23,503 INFO [main] o.a.n.wali.SequentialAccessWriteAheadLog Checkpointed Write-Ahead Log with 0 Records and 0 Swap Files in 19 milliseconds (Stop-the-world time = 4 milliseconds), max Transaction ID -1
2023-05-10 14:57:23,504 INFO [main] o.apache.nifi.controller.FlowController [Timer Driven] Maximum Thread Count updated [10] previous [10]
2023-05-10 14:57:23,504 INFO [main] o.apache.nifi.controller.FlowController [Event Driven] Maximum Thread Count updated [1] previous [1]
2023-05-10 14:57:23,555 INFO [main] o.a.n.f.s.StandardVersionedComponentSynchronizer No differences between current flow and proposed flow for StandardProcessGroup[identifier=06e6af5d-0188-1000-2060-fb348a94c582,name=NiFi Flow]
2023-05-10 14:57:23,594 INFO [main] o.a.n.c.s.AffectedComponentSet Starting the following components: AffectedComponentSet[inputPorts=[], outputPorts=[], remoteInputPorts=[], remoteOutputPorts=[], processors=[], parameterProviders=[], flowRegistryCliens=[], controllerServices=[], reportingTasks=[]]
2023-05-10 14:57:23,596 INFO [main] o.a.n.c.s.VersionedFlowSynchronizer Successfully synchronized dataflow with the proposed flow in 387 millis
2023-05-10 14:57:23,596 INFO [main] o.apache.nifi.controller.FlowController Successfully synchronized controller with proposed flow. Flow contains the following number of components: {Processors=0, Controller Services=0, Reporting Tasks=0, Process Groups=0, Remote Process Groups=0, Parameter Providers=0, Flow Registry Clients=0, Local Input Ports=0, Local Output Ports=0, Public Input Ports=0, Public Output Ports=0}
2023-05-10 14:57:23,712 INFO [main] o.a.n.c.r.WriteAheadFlowFileRepository Successfully restored 0 FlowFiles and 0 Swap Files
2023-05-10 14:57:23,808 INFO [main] o.apache.nifi.controller.FlowController Performed initial validation of all components in 1 milliseconds
2023-05-10 14:57:23,809 INFO [main] o.apache.nifi.controller.FlowController Starting 0 processors/ports/funnels
2023-05-10 14:57:23,810 INFO [main] o.apache.nifi.controller.FlowController Started 0 Remote Group Ports transmitting
2023-05-10 14:57:23,812 INFO [main] o.a.n.w.c.ApplicationStartupContextListener Flow Controller started successfully.
2023-05-10 14:57:28,530 INFO [main] o.e.jetty.server.handler.ContextHandler Started o.e.j.w.WebAppContext@72a7aa4f{nifi-api,/nifi-api,file:///Users/user/nifi-1.21.0/work/jetty/nifi-web-api-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-server-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-web-api-1.21.0.war}
2023-05-10 14:57:29,274 INFO [main] o.e.j.a.AnnotationConfiguration Scanning elapsed time=183ms
2023-05-10 14:57:29,356 INFO [main] o.e.j.s.h.C._nifi_content_viewer No Spring WebApplicationInitializer types detected on classpath
2023-05-10 14:57:29,362 INFO [main] o.e.jetty.server.handler.ContextHandler Started o.e.j.w.WebAppContext@537ca28e{nifi-content-viewer,/nifi-content-viewer,file:///Users/user/nifi-1.21.0/work/jetty/nifi-web-content-viewer-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-server-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-web-content-viewer-1.21.0.war}
2023-05-10 14:57:29,421 INFO [main] o.e.j.a.AnnotationConfiguration Scanning elapsed time=13ms
2023-05-10 14:57:29,500 INFO [main] o.e.j.s.h.ContextHandler._nifi_docs No Spring WebApplicationInitializer types detected on classpath
2023-05-10 14:57:29,505 INFO [main] o.e.jetty.server.handler.ContextHandler Started o.e.j.w.WebAppContext@5b322873{nifi-docs,/nifi-docs,file:///Users/user/nifi-1.21.0/work/jetty/nifi-web-docs-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-server-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-web-docs-1.21.0.war}
2023-05-10 14:57:29,552 INFO [main] o.e.j.a.AnnotationConfiguration Scanning elapsed time=12ms
2023-05-10 14:57:29,626 INFO [main] o.e.j.server.handler.ContextHandler._ No Spring WebApplicationInitializer types detected on classpath
2023-05-10 14:57:29,631 INFO [main] o.e.jetty.server.handler.ContextHandler Started o.e.j.w.WebAppContext@35e2b89f{nifi-error,/,file:///Users/user/nifi-1.21.0/work/jetty/nifi-web-error-1.21.0.war/webapp/,AVAILABLE}{./work/nar/extensions/nifi-server-nar-1.21.0.nar-unpacked/NAR-INF/bundled-dependencies/nifi-web-error-1.21.0.war}
2023-05-10 14:57:29,647 WARN [main] org.apache.nifi.web.server.JettyServer Failed to start web server... shutting down.
java.io.IOException: Failed to bind to /127.0.0.1:8443
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:349)
at org.eclipse.jetty.server.ServerConnector.open(ServerConnector.java:310)
at org.eclipse.jetty.server.AbstractNetworkConnector.doStart(AbstractNetworkConnector.java:80)
at org.eclipse.jetty.server.ServerConnector.doStart(ServerConnector.java:234)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.eclipse.jetty.server.Server.doStart(Server.java:401)
at org.eclipse.jetty.util.component.AbstractLifeCycle.start(AbstractLifeCycle.java:73)
at org.apache.nifi.web.server.JettyServer.start(JettyServer.java:816)
at org.apache.nifi.NiFi.<init>(NiFi.java:172)
at org.apache.nifi.NiFi.<init>(NiFi.java:83)
at org.apache.nifi.NiFi.main(NiFi.java:332)
Caused by: java.net.BindException: Address already in use
at java.base/sun.nio.ch.Net.bind0(Native Method)
at java.base/sun.nio.ch.Net.bind(Net.java:555)
at java.base/sun.nio.ch.ServerSocketChannelImpl.netBind(ServerSocketChannelImpl.java:337)
at java.base/sun.nio.ch.ServerSocketChannelImpl.bind(ServerSocketChannelImpl.java:294)
at java.base/sun.nio.ch.ServerSocketAdaptor.bind(ServerSocketAdaptor.java:89)
at org.eclipse.jetty.server.ServerConnector.openAcceptChannel(ServerConnector.java:344)
... 10 common frames omitted
2023-05-10 14:57:29,652 INFO [Thread-0] org.apache.nifi.NiFi Application Server shutdown started

It appears to be the same error as before I killed the process. Any help is appreciated.

答案1

得分: 1

I went into the nifi.properties file located in the conf folder.
我进入了位于conf文件夹中的nifi.properties文件。

I changed the following property from 8443 to 8442 (I chose 8442 arbitrarily hoping since it was close to 8443 that made it a good port candidate so you may want to choose a different one)
我将以下属性从8443更改为8442(我随意选择了8442,希望因为它接近8443,所以它是一个良好的端口候选项,所以您可以选择一个不同的端口)

nifi.web.https.port=8442

Then, I navigated to the login-identity-providers.xml file located in the same conf folder.
然后,我导航到位于同一conf文件夹中的login-identity-providers.xml文件。

I removed the default username and password that were in the file so that it looks like it does below.
我删除了文件中的默认用户名和密码,使其看起来如下所示。

single-user-provider
org.apache.nifi.authentication.single.user.SingleUserLoginIdentityProvider

Then, I went back to the terminal, navigated to the bin directory and ran the following command...
然后,我回到终端,导航到bin目录,并运行了以下命令...

./nifi.sh restart

It spit out a ton of code but if you use ctrl + F and search for the word "generated" (without quotes) you should see a generated username and password.
它会输出大量代码,但如果您使用Ctrl + F搜索词"generated"(不带引号),您应该会看到生成的用户名和密码。

Finally, I navigated to https://127.0.0.1:8442/nifi/ and entered the generated username and password and eureka it seems to be working!
最后,我导航到https://127.0.0.1:8442/nifi/,输入生成的用户名和密码,咦,它似乎在工作!

英文:

Well I seemed to have figured it out with some help from some other articles.

I went into the nifi.properties file located in the conf folder.

I changed the following property from 8443 to 8442 (I chose 8442 arbitrarily hoping since it was close to 8443 that made it a good port candidate so you may want to choose a different one)

nifi.web.https.port=8442

Then, I navigated to the login-identity-providers.xml file located in the same conf folder.

I removed the default username and password that were in the file so that it looks like it does below.

<provider>
<identifier>single-user-provider</identifier>
<class>org.apache.nifi.authentication.single.user.SingleUserLoginIdentityProvider</class>
<property name="Username"></property>
<property name="Password"></property>
</provider>

Then, I went back to the terminal, navigated to the bin directory and ran the following command...

./nifi.sh restart

It spit out a ton of code but if you use ctrl + F and search for the word "generated" (without quotes) you should see a generated username and password.

Finally, I navigated to https://127.0.0.1:8442/nifi/ and entered the generated username and password and eureka it seems to be working!

Hopefully nothing important was using port 8442!

huangapple
  • 本文由 发表于 2023年5月11日 03:11:24
  • 转载请务必保留本文链接:https://go.coder-hub.com/76221847.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定