Kill命令在java.net上不起作用,BindException:地址已在使用错误

jdgnovmf  于 2023-05-12  发布在  Java
关注(0)|答案(1)|浏览(173)

其他类似的帖子都没有解决我的问题。
为Apache Nifi生成的用户名和密码不起作用。

我在执行these指令。

我尝试运行tail -f nifi-app.log命令来解决问题。
并得到了以下结果……

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

我尝试使用以下命令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 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

这似乎是与我杀死进程之前相同的错误。任何帮助都很感激。

enxuqcxy

enxuqcxy1#

好吧,我 * 似乎 * 在其他一些文章的帮助下弄明白了这一点。
我进入nifi.properties位于conf文件夹中的www.example.com文件。
我将下面的属性从8443更改为8442(我随意选择了8442,因为它接近8443,使其成为一个很好的端口候选者,所以您可能想选择一个不同的端口)

nifi.web.https.port=8442

然后,我导航到位于同一个conf文件夹中的login-identity-providers.xml文件。
我删除了文件中的默认用户名和密码,以便它看起来像下面一样。

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

然后,我回到终端,导航到bin目录并运行以下命令...

./nifi.sh restart

它吐出了大量的代码,但如果你使用ctrl + F并搜索单词“生成”(不带引号),你应该会看到一个生成的用户名和密码。
最后,我导航到https://127.0.0.1:8442/nifi/,并输入生成的用户名和密码和Eureka 它似乎是工作!
希望没有什么重要的事情使用端口8442!

相关问题