javax.jms.JMSException: 未能创建会话工厂
javax.jms.JMSException: Failed to create session factory
我正在尝试 运行 Artemis。当我尝试使用以下命令生成消息时,出现错误。我正在使用 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>
带有 --
的选项需要 =
你可以试试
artemis producer --url=tcp://localhost:61616 --user=xxxx --password=yyyy
您收到的异常是核心 JMS 客户端无法与代理建立网络连接时的 "standard" 异常。请确认您在端口 61616
上与生产者(即 localhost
)在同一台机器上有代理 运行ning。您可以通过 运行 执行以下命令来执行此操作:
netstat -a | grep 61616
并确保有进程在监听。
你可以运行这个命令:
jps -v | grep Artemis
并确保 Artemis 进程是 运行ning。
您还可以查看 Artemis 实例的 log
目录中的 artemis.log
文件,以了解代理当前是 运行ning 还是已关闭。
实际上下面的步骤已经解决了我的查询。在创建代理时,我使用默认端口 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
y
Auto tuning journal ...
done! Your system can make 0.54 writes per millisecond, your journal-buffer-timeout
will be 1855999
然后我运行按以下步骤制作消息
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
我正在尝试 运行 Artemis。当我尝试使用以下命令生成消息时,出现错误。我正在使用 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>
带有 --
的选项需要 =
你可以试试
artemis producer --url=tcp://localhost:61616 --user=xxxx --password=yyyy
您收到的异常是核心 JMS 客户端无法与代理建立网络连接时的 "standard" 异常。请确认您在端口 61616
上与生产者(即 localhost
)在同一台机器上有代理 运行ning。您可以通过 运行 执行以下命令来执行此操作:
netstat -a | grep 61616
并确保有进程在监听。
你可以运行这个命令:
jps -v | grep Artemis
并确保 Artemis 进程是 运行ning。
您还可以查看 Artemis 实例的 log
目录中的 artemis.log
文件,以了解代理当前是 运行ning 还是已关闭。
实际上下面的步骤已经解决了我的查询。在创建代理时,我使用默认端口 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
y
Auto tuning journal ...
done! Your system can make 0.54 writes per millisecond, your journal-buffer-timeout
will be 1855999
然后我运行按以下步骤制作消息
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