启动Flume的Solace源时输入了错误的用户名密码

时间:2018-11-13 14:11:50

标签: apache username flume flume-ng solace

我正在尝试使用以下配置为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.access$301(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。仍然出现相同的错误。感谢您的帮助或指导。

1 个答案:

答案 0 :(得分:1)

我发现了问题。 根据给定的优先级,我提供的密码已被系统属性(java.naming.security.credentials)覆盖。 我在JNDI属性文件中将用户名提供为java.naming.security.principal=username 并将密码作为系统属性设置为-Djava.naming.security.credentials=password,而将Flume和providerURL用作smfs://dns则启动,一切正常。