Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

I was trying to run Artemis. When I am trying to produce the message using below command then I am getting an error. I am using Windows 10.

C:\Users\a.subhashrao.pande\Downloads\apache-artemis-2.6.3-bin\apache-artemis-2.6.3\bin\tmp\mybroker\bin>artemis producer --url tcp://localhost:61616
Connection failed::Failed to create session factory
--url: is a mandatory property!
Type in the broker URL for a retry (e.g. tcp://localhost:61616)
tcp://localhost:61616
--user: is a mandatory property!
Type the username for a retry
admin
--password: is mandatory with this configuration:
Type the password for a retry    (I have entered password as admin)
Exception in thread "main" javax.jms.JMSException: Failed to create session factory
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:837)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:282)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnection(ActiveMQConnectionFactory.java:277)
        at org.apache.activemq.artemis.cli.commands.messages.Producer.execute(Producer.java:70)
        at org.apache.activemq.artemis.cli.Artemis.internalExecute(Artemis.java:149)
        at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:97)
        at org.apache.activemq.artemis.cli.Artemis.execute(Artemis.java:124)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.apache.activemq.artemis.boot.Artemis.execute(Artemis.java:129)
        at org.apache.activemq.artemis.boot.Artemis.main(Artemis.java:49)
Caused by: ActiveMQNotConnectedException[errorType=NOT_CONNECTED message=AMQ119007: Cannot connect to server(s). Tried with all available servers.]
        at org.apache.activemq.artemis.core.client.impl.ServerLocatorImpl.createSessionFactory(ServerLocatorImpl.java:797)
        at org.apache.activemq.artemis.jms.client.ActiveMQConnectionFactory.createConnectionInternal(ActiveMQConnectionFactory.java:835)
        ... 12 more
C:\Users\a.subhashrao.pande\Downloads\apache-artemis-2.6.3-bin\apache-artemis-2.6.3\bin\tmp\mybroker\bin>

The exception you're receiving is the "standard" exception for when the core JMS client is unable to make a network connection with a broker. Please confirm you have a broker running on the same machine as the producer (i.e. localhost) on port 61616. You can do this by running a command like:

netstat -a | grep 61616

And making sure there is a process listening.

You could run this command:

jps -v | grep Artemis

And ensure the Artemis process is running.

You could also take a look at the artemis.log file in the log directory of your Artemis instance to see if the broker is currently running or has been shut down.

Thanks for the reply. But could you please mention how to check broker and producer running on the same port – Ajinkya Dec 19, 2018 at 16:50

Actually below step has resolved my query. While creating broker I have created it with default-port as 83836.

C:\apache-artemis-2.6.3-bin\apache-artemis-2.6.3\bin>artemis create --default-port 
63636 /test/broker
Creating ActiveMQ Artemis instance at: C:\test\broker
--user: is a mandatory property!
Please provide the default username:
admin
--password: is mandatory with this configuration:
Please provide the default password:
--allow-anonymous | --require-login: is a mandatory property!
Allow anonymous access?, valid values are Y,N,True,False
Auto tuning journal ...
done! Your system can make 0.54 writes per millisecond, your journal-buffer-timeout 
will be 1855999

Then I run the following steps to produce messages

 C:\test\broker\bin>artemis-service.exe install
 C:\test\broker\bin>artemis-service.exe start
 C:\test\broker\bin>artemis producer
 Connection failed::Failed to create session factory
 --url: is a mandatory property!
 Type in the broker URL for a retry (e.g. tcp://localhost:61616)
 tcp://localhost:63636
 --user: is a mandatory property!
 Type the username for a retry
 admin
 --password: is mandatory with this configuration:
 Type the password for a retry
 Producer ActiveMQQueue[TEST], thread=0 Started to calculate elapsed time ...
 Producer ActiveMQQueue[TEST], thread=0 Produced: 1000 messages
 Producer ActiveMQQueue[TEST], thread=0 Elapsed time in second : 4 s
 Producer ActiveMQQueue[TEST], thread=0 Elapsed time in milli second : 4990 milli                
 seconds
 C:\test\broker\bin>artemis consumer
 Consumer:: filter = null
 Connection failed::Failed to create session factory
 --url: is a mandatory property!
 Type in the broker URL for a retry (e.g. tcp://localhost:61616)
 tcp://localhost:63636
 --user: is a mandatory property!
 Type the username for a retry
 admin
 --password: is mandatory with this configuration:
 Type the password for a retry
 Consumer ActiveMQQueue[TEST], thread=0 wait until 1000 messages are consumed
 Received 1000
 Consumer ActiveMQQueue[TEST], thread=0 Consumed: 1000 messages
 Consumer ActiveMQQueue[TEST], thread=0 Consumer thread finished
                Couple of points...1) This is basically the same as my answer - you weren't running the broker on the expected port. 2) You should simply pass the --url tcp://localhost:63636 along with the producer and consumer commands rather than allowing the first try to fail and then using the correct url value. 3) You don't need to specify username and password on your producer and consumer commands because you allowed anonymous access when you created the broker instance (which is another reason you should just pass the --url with the command).
– Justin Bertram
                Dec 19, 2018 at 19:25
                @JustinBertram Thanks for your help. Yes  I have tried running as you said and it is running fine. But I have one question like the default port  selected by MQ is 61616 why i needed to change it to 63636 explicitly. I have followed the artemis official documents, thus those needs to be updated.
– Ajinkya
                Dec 20, 2018 at 4:48
                Can you clarify specifically what needs to be updated? The default port is 61616 (which is documented). If you change the default port to something else it stands to reason that any clients using that default port will also need to change.
– Justin Bertram
                Dec 20, 2018 at 14:17
                For me default port 61616 was not running and i didn't have changed default port before. When i changed it to 63636 while creating broker then only it ran (you gave the reason for it). I just wanted to say here, In documentation we should explicitly mention these things, like if it is not running on default port you should change it. PS: I know help in commands you can find the command but in documentation its not explicitly mentioned.
– Ajinkya
                Dec 21, 2018 at 5:04
                If the broker won't run on the default port an assessment needs to be made about why it's not running. Is something already using that port? If so, should that process be stopped or allowed to continue? Is there an permission issue? etc. Until it's clear why it's not running as expected then no recommendation can be made about the appropriate remedy.
– Justin Bertram
                Dec 21, 2018 at 15:50
                Still the same isuue  C:\Users\a.subhashrao.pande\Downloads\apache-artemis-2.6.3-bin\apache-artemis-2.6.3\bin\tmp\mybroker\bin>artemis producer --url=tcp://localhost:61616 Connection failed::Failed to create session factory  --url: is a mandatory property! Type in the broker URL for a retry (e.g. tcp://localhost:61616) tcp://localhost:61616  --user: is a mandatory property! Type the username for a retry admin  --password: is mandatory with this configuration: Type the password for a retry  Exception in thread "main" javax.jms.JMSException: Failed to create session factory
– Ajinkya
                Dec 19, 2018 at 16:25
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.