为 Flume 启动 Solace 源时用户名密码不正确
Incorrect username password while starting Solace source for Flume
我正在尝试为 Apache Flume 配置一个 Solace 源,配置如下:
jndi.properties
Solace_JMS_VPN=VPN name
Solace_JMS_SSL_TrustStore=<path to trustore file>
Solace_JMS_SSL_TrustStorePassword=truststore password
相关Flume配置
a1.sources.recieveFromJMS.type = jms
a1.sources.recieveFromJMS.channels = c1
a1.sources.recieveFromJMS.initialContextFactory = com.solacesystems.jndi.SolJNDIInitialContextFactory
a1.sources.recieveFromJMS.connectionFactory = connectionFactoryname
a1.sources.recieveFromJMS.providerURL = smfs://username:pass%40word@dns:port
a1.sources.recieveFromJMS.destinationName = queueName
a1.sources.recieveFromJMS.destinationType = QUEUE
a1.sources.recieveFromJMS.batchSize=100
我在 Source 如下启动时遇到异常:
2018-11-13 14:43:36,710 (conf-file-poller-0) [INFO - com.solacesystems.jcsmp.protocol.impl.TcpClientChannel$ClientChannelConnect.call(TcpClientChannel.java:2327)] Connection attempt failed to host 'DNS' ConnectException ((Client name: MyMachine/30512/#00140001 Local addr: IP:port Remote addr: DNS:port) - ) com.solacesystems.jcsmp.JCSMPErrorResponseException: 401: The username or password is incorrect [Subcode:1] cause: null ((Client name: MyMachine/30512/#00140001 Local addr: DNS:port Remote addr: DNS:port) - )
2018-11-13 14:43:39,752 (conf-file-poller-0) [INFO - com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.close(TcpClientChannel.java:458)] Channel Closed (smfclient 2)
2018-11-13 14:43:39,783 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.protocol.smf.SimpleSmfClient.close(SimpleSmfClient.java:937)] Local addr: IP:port Remote addr: DNS:port(smfclient 2) Closing socket
2018-11-13 14:43:39,830 (conf-file-poller-0) [INFO - com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.close(TcpClientChannel.java:458)] Channel Closed (smfclient 2)
2018-11-13 14:43:39,861 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.protocol.smf.SimpleSmfClient.close(SimpleSmfClient.java:937)] Local port: port Remote addr: DNS:port(smfclient 2) Closing socket
2018-11-13 14:43:39,892 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.impl.flow.SubFlowManagerImpl.close(SubFlowManagerImpl.java:896)] SubFlowManagerImpl closing... close 0 flows
2018-11-13 14:43:39,924 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.impl.JCSMPBasicSession.closeSession(JCSMPBasicSession.java:545)] JCSMPSession[username@tcps://DNS:port] (0001)closed
2018-11-13 14:43:39,970 (conf-file-poller-0) [ERROR - org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:361)] Source recieveFromJMS has been removed due to an error during configuration
org.apache.flume.FlumeException: Could not lookup ConnectionFactory
at org.apache.flume.source.jms.JMSSource.doConfigure(JMSSource.java:245)
at org.apache.flume.source.BasicSourceSemantics.configure(BasicSourceSemantics.java:65)
at org.apache.flume.source.AbstractPollableSource.configure(AbstractPollableSource.java:63)
at org.apache.flume.conf.Configurables.configure(Configurables.java:41)
at org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:326)
at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:97)
at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.naming.NamingException: JNDI lookup failed - 401: The username or password is incorrect
我已经验证了用户名和密码。密码有一个特殊字符 (@),我将其替换为 %40。仍然出现相同的错误。感谢您的帮助或指点。
我发现了问题。
根据给定的优先级,我提供的密码已被系统 属性 (java.naming.security.credentials) 覆盖。
我在 JNDI 属性文件中将用户名提供为 java.naming.security.principal=username
和密码作为系统 属性 作为 -Djava.naming.security.credentials=password
而启动 Flume 和 providerURL 只是作为 smfs://dns
并且一切正常。
我正在尝试为 Apache Flume 配置一个 Solace 源,配置如下:
jndi.properties
Solace_JMS_VPN=VPN name
Solace_JMS_SSL_TrustStore=<path to trustore file>
Solace_JMS_SSL_TrustStorePassword=truststore password
相关Flume配置
a1.sources.recieveFromJMS.type = jms
a1.sources.recieveFromJMS.channels = c1
a1.sources.recieveFromJMS.initialContextFactory = com.solacesystems.jndi.SolJNDIInitialContextFactory
a1.sources.recieveFromJMS.connectionFactory = connectionFactoryname
a1.sources.recieveFromJMS.providerURL = smfs://username:pass%40word@dns:port
a1.sources.recieveFromJMS.destinationName = queueName
a1.sources.recieveFromJMS.destinationType = QUEUE
a1.sources.recieveFromJMS.batchSize=100
我在 Source 如下启动时遇到异常:
2018-11-13 14:43:36,710 (conf-file-poller-0) [INFO - com.solacesystems.jcsmp.protocol.impl.TcpClientChannel$ClientChannelConnect.call(TcpClientChannel.java:2327)] Connection attempt failed to host 'DNS' ConnectException ((Client name: MyMachine/30512/#00140001 Local addr: IP:port Remote addr: DNS:port) - ) com.solacesystems.jcsmp.JCSMPErrorResponseException: 401: The username or password is incorrect [Subcode:1] cause: null ((Client name: MyMachine/30512/#00140001 Local addr: DNS:port Remote addr: DNS:port) - )
2018-11-13 14:43:39,752 (conf-file-poller-0) [INFO - com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.close(TcpClientChannel.java:458)] Channel Closed (smfclient 2)
2018-11-13 14:43:39,783 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.protocol.smf.SimpleSmfClient.close(SimpleSmfClient.java:937)] Local addr: IP:port Remote addr: DNS:port(smfclient 2) Closing socket
2018-11-13 14:43:39,830 (conf-file-poller-0) [INFO - com.solacesystems.jcsmp.protocol.impl.TcpClientChannel.close(TcpClientChannel.java:458)] Channel Closed (smfclient 2)
2018-11-13 14:43:39,861 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.protocol.smf.SimpleSmfClient.close(SimpleSmfClient.java:937)] Local port: port Remote addr: DNS:port(smfclient 2) Closing socket
2018-11-13 14:43:39,892 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.impl.flow.SubFlowManagerImpl.close(SubFlowManagerImpl.java:896)] SubFlowManagerImpl closing... close 0 flows
2018-11-13 14:43:39,924 (conf-file-poller-0) [DEBUG - com.solacesystems.jcsmp.impl.JCSMPBasicSession.closeSession(JCSMPBasicSession.java:545)] JCSMPSession[username@tcps://DNS:port] (0001)closed
2018-11-13 14:43:39,970 (conf-file-poller-0) [ERROR - org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:361)] Source recieveFromJMS has been removed due to an error during configuration
org.apache.flume.FlumeException: Could not lookup ConnectionFactory
at org.apache.flume.source.jms.JMSSource.doConfigure(JMSSource.java:245)
at org.apache.flume.source.BasicSourceSemantics.configure(BasicSourceSemantics.java:65)
at org.apache.flume.source.AbstractPollableSource.configure(AbstractPollableSource.java:63)
at org.apache.flume.conf.Configurables.configure(Configurables.java:41)
at org.apache.flume.node.AbstractConfigurationProvider.loadSources(AbstractConfigurationProvider.java:326)
at org.apache.flume.node.AbstractConfigurationProvider.getConfiguration(AbstractConfigurationProvider.java:97)
at org.apache.flume.node.PollingPropertiesFileConfigurationProvider$FileWatcherRunnable.run(PollingPropertiesFileConfigurationProvider.java:140)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access1(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Caused by: javax.naming.NamingException: JNDI lookup failed - 401: The username or password is incorrect
我已经验证了用户名和密码。密码有一个特殊字符 (@),我将其替换为 %40。仍然出现相同的错误。感谢您的帮助或指点。
我发现了问题。
根据给定的优先级,我提供的密码已被系统 属性 (java.naming.security.credentials) 覆盖。
我在 JNDI 属性文件中将用户名提供为 java.naming.security.principal=username
和密码作为系统 属性 作为 -Djava.naming.security.credentials=password
而启动 Flume 和 providerURL 只是作为 smfs://dns
并且一切正常。