apacheflumeflume-ngsolace

Incorrect username password while starting Solace source for Flume


I am trying to configure a Solace source for Apache Flume with configurations below :

jndi.properties

Solace_JMS_VPN=VPN name
Solace_JMS_SSL_TrustStore=<path to trustore file>
Solace_JMS_SSL_TrustStorePassword=truststore password

related Flume config

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

I am getting an exception while Source is starting as follows :

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

I have verified the username and password. Password has a special character (@) which I replaced by %40. Still getting the same error. Thanks for any help or pointer.


Solution

  • I found the issue. The password I was providing was getting overridden by the system property (java.naming.security.credentials) based on precedence given. I provided the username in JNDI properties file as java.naming.security.principal=username and password as a system property as -Djava.naming.security.credentials=password while starting Flume and providerURL simply as smfs://dns and everything works fine.