10

我正在尝试第一次设置 Apache ActiveMQ

我发现我的服务器名称中有一个下划线,这阻止了 ActiveMQ 启动。它抛出这个异常:

java.net.URISyntaxException:索引 8 处的主机名中存在非法字符:ws://cms_delta.mycompany.com:61614?最大连接数=1000&wireFormat.maxFrameSize=104857600) ...

我在哪里可以在配置中设置主机名。此服务器有其他没有下划线的别名,或者我可以使用 IP 地址。服务器名称 cms_delta.mycompany.com 正在自动获取。

除了 brokerName,我在 activemq.xml 中没有看到任何明显的东西,但这并没有解决问题。

这是完整的日志:

 2013-11-14 14:30:02,347 | INFO  | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@54520eb: startup date [Thu Nov 14 14:30:02 PST 2013]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
 2013-11-14 14:30:04,100 | INFO  | PListStore:[/opt/apache-activemq-5.9.0/data/esb-dev.mycompany.com/tmp_storage] started | org.apache.activemq.store.kahadb.plist.PListStoreImpl | main
 2013-11-14 14:30:04,154 | INFO  | Using Persistence Adapter: KahaDBPersistenceAdapter[/opt/apache-activemq-5.9.0/data/kahadb] | org.apache.activemq.broker.BrokerService | main
 2013-11-14 14:30:04,475 | INFO  | Persistence store purged. | org.apache.activemq.store.kahadb.MessageDatabase | main
 2013-11-14 14:30:04,678 | INFO  | Apache ActiveMQ 5.9.0 (esb-dev.mycompany.com, ID:cms_delta.mycompany.com-35039-1384468204550-0:1) is starting | org.apache.activemq.broker.BrokerService | main
 2013-11-14 14:30:04,697 | INFO  | Listening for connections at: tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
 2013-11-14 14:30:04,699 | INFO  | Connector openwire started | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:04,704 | INFO  | Listening for connections at: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
 2013-11-14 14:30:04,707 | INFO  | Connector amqp started | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:04,712 | INFO  | Listening for connections at: stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
 2013-11-14 14:30:04,734 | INFO  | Connector stomp started | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:04,738 | INFO  | Listening for connections at: mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600 | org.apache.activemq.transport.TransportServerThreadSupport | main
 2013-11-14 14:30:04,739 | INFO  | Connector mqtt started | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:04,853 | ERROR | Failed to start Apache ActiveMQ ([esb-dev.mycompany.com, ID:cms_delta.mycompany.com-35039-1384468204550-0:1], java.net.URISyntaxException: Illegal character in hostname at index 8: ws://cms_delta.mycompany.com:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600) | org.apache.activemq.broker.BrokerService | main
 2013-11-14 14:30:04,854 | INFO  | Apache ActiveMQ 5.9.0 (esb-dev.mycompany.com, ID:cms_delta.mycompany.com-35039-1384468204550-0:1) is shutting down | org.apache.activemq.broker.BrokerService | main
 2013-11-14 14:30:06,705 | INFO  | Connector openwire stopped | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:06,708 | INFO  | Connector amqp stopped | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:06,737 | INFO  | Connector stomp stopped | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:06,748 | INFO  | Connector mqtt stopped | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:06,749 | INFO  | Connector ws stopped | org.apache.activemq.broker.TransportConnector | main
 2013-11-14 14:30:06,752 | INFO  | PListStore:[/opt/apache-activemq-5.9.0/data/esb-dev.mycompany.com/tmp_storage] stopped | org.apache.activemq.store.kahadb.plist.PListStoreImpl | main
 2013-11-14 14:30:06,752 | INFO  | Stopping async queue tasks | org.apache.activemq.store.kahadb.KahaDBStore | main
 2013-11-14 14:30:06,753 | INFO  | Stopping async topic tasks | org.apache.activemq.store.kahadb.KahaDBStore | main
 2013-11-14 14:30:06,754 | INFO  | Stopped KahaDB | org.apache.activemq.store.kahadb.KahaDBStore | main
 2013-11-14 14:30:07,045 | INFO  | Apache ActiveMQ 5.9.0 (esb-dev.mycompany.com, ID:cms_delta.mycompany.com-35039-1384468204550-0:1) uptime 2.939 seconds | org.apache.activemq.broker.BrokerService | main
 2013-11-14 14:30:07,046 | INFO  | Apache ActiveMQ 5.9.0 (esb-dev.mycompany.com, ID:cms_delta.mycompany.com-35039-1384468204550-0:1) is shutdown | org.apache.activemq.broker.BrokerService | main
 2013-11-14 14:30:07,047 | INFO  | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1@54520eb: startup date [Thu Nov 14 14:30:02 PST 2013]; root of context hierarchy | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
 2013-11-14 14:30:07,050 | WARN  | Exception thrown from LifecycleProcessor on context close | org.apache.activemq.xbean.XBeanBrokerFactory$1 | main
 java.lang.IllegalStateException: LifecycleProcessor not initialized - call 'refresh' before invoking lifecycle methods via the context: org.apache.activemq.xbean.XBeanBrokerFactory$1@54520eb: startup date [Thu Nov 14 14:30:02 PST 2013]; root of context hierarchy
    at org.springframework.context.support.AbstractApplicationContext.getLifecycleProcessor(AbstractApplicationContext.java:360)
    at org.springframework.context.support.AbstractApplicationContext.doClose(AbstractApplicationContext.java:1057)
    at org.springframework.context.support.AbstractApplicationContext.close(AbstractApplicationContext.java:1010)
    at org.apache.activemq.hooks.SpringContextHook.run(SpringContextHook.java:30)
    at org.apache.activemq.broker.BrokerService.stop(BrokerService.java:782)
    at org.apache.activemq.xbean.XBeanBrokerService.stop(XBeanBrokerService.java:122)
    at org.apache.activemq.broker.BrokerService.start(BrokerService.java:574)
    at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1608)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1549)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1479)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:521)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:458)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:295)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:223)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:292)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:628)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:932)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:479)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:64)
    at org.apache.xbean.spring.context.ResourceXmlApplicationContext.<init>(ResourceXmlApplicationContext.java:52)
    at org.apache.activemq.xbean.XBeanBrokerFactory$1.<init>(XBeanBrokerFactory.java:104)
    at org.apache.activemq.xbean.XBeanBrokerFactory.createApplicationContext(XBeanBrokerFactory.java:104)
    at org.apache.activemq.xbean.XBeanBrokerFactory.createBroker(XBeanBrokerFactory.java:67)
    at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:71)
    at org.apache.activemq.broker.BrokerFactory.createBroker(BrokerFactory.java:54)
    at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:87)
    at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
    at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:150)
    at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:57)
    at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
    at java.lang.reflect.Method.invoke(Method.java:597)
    at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
    at org.apache.activemq.console.Main.main(Main.java:115)
4

2 回答 2

17

我刚刚ActiveMQ在我的电脑上运行时遇到了同样的问题。

要更改您使用的名称,ActiveMQ您应该进入/conf/activemq.xml文件并用您的 IP 地址替换0.0.0.0intransportConnectors/transportConnector uri属性,即127.0.0.1. 它应该看起来像:

<transportConnectors>
    <transportConnector name="openwire" uri="tcp://127.0.0.1:61616?maximumConnections=1000&amp;wireFormat.maxFrameSize=104857600"/>
    ...
</transportConnectors>

现在你应该去hosts文件并添加一些域映射到你的本地机器。在我的情况下(Windows 7),该文件位于C:\Windows\System32\drivers\etc\. 我添加的行是

127.0.0.1                   mydomain.com

然后,在运行 ActiveMQ 时,您应该会看到以下行:

信息 | 监听连接:tcp://mydomain.com:61616?maximumConnections=1000

ActiveMQ 将启动。

于 2014-07-30T14:35:35.923 回答
0

对于 Windows 8 或 10:

桌面→右键单击“这台电脑”→属性→重命名这台电脑

对于 Windows 7:

桌面→右键单击“这台电脑”→属性→更改计算机名称

于 2021-11-09T06:42:23.577 回答