Tag Archives: java.net.URISyntaxException:

[Solved] ActiveMQ startup error: java.net.urisyntaxexception…

Active startup error:

Extensions classpath:
  [C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\lib,C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\lib\camel,C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\lib\optional,C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\lib\web,C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\lib\extra]
ACTIVEMQ_HOME: C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..
ACTIVEMQ_BASE: C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..
ACTIVEMQ_CONF: C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\conf
ACTIVEMQ_DATA: C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\data
Loading message broker from: xbean:activemq.xml
 INFO | Refreshing org.apache.activemq.xbean.XBeanBrokerFactory$1@7e07db1f: startup date [Mon Aug 23 14:54:03 CST 2021]; root of context hierarchy
 INFO | Using Persistence Adapter: KahaDBPersistenceAdapter[C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\data\kahadb]
 INFO | PListStore:[C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\data\localhost\tmp_storage] started
 INFO | Sanitized hostname from: xiaobai to:
 INFO | Apache ActiveMQ 5.16.3 (localhost, ID:-56758-1629701645862-0:1) is starting
 INFO | Listening for connections at: tcp://0.0.0.0:61616?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector openwire started
 INFO | Listening for connections at: amqp://0.0.0.0:5672?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector amqp started
 INFO | Listening for connections at: stomp://0.0.0.0:61613?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector stomp started
 INFO | Listening for connections at: mqtt://0.0.0.0:1883?maximumConnections=1000&wireFormat.maxFrameSize=104857600
 INFO | Connector mqtt started
 INFO | Starting Jetty server
 INFO | Creating Jetty connector
ERROR | Failed to start Apache ActiveMQ (localhost, ID:-56758-1629701645862-0:1)
java.net.URISyntaxException: Illegal character in hostname at index 5: ws://小白酒菊:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
        at java.base/java.net.URI$Parser.fail(URI.java:2936)
        at java.base/java.net.URI$Parser.parseHostname(URI.java:3471)
        at java.base/java.net.URI$Parser.parseServer(URI.java:3320)
        at java.base/java.net.URI$Parser.parseAuthority(URI.java:3239)
        at java.base/java.net.URI$Parser.parseHierarchical(URI.java:3181)
        at java.base/java.net.URI$Parser.parse(URI.java:3137)
        at java.base/java.net.URI.<init>(URI.java:708)
        at org.apache.activemq.transport.WebTransportServerSupport.bind(WebTransportServerSupport.java:106)
        at org.apache.activemq.transport.ws.WSTransportServer.doStart(WSTransportServer.java:67)
        at org.apache.activemq.util.ServiceSupport.start(ServiceSupport.java:55)
        at org.apache.activemq.broker.TransportConnector.start(TransportConnector.java:254)
        at org.apache.activemq.broker.BrokerService.startTransportConnector(BrokerService.java:2772)
        at org.apache.activemq.broker.BrokerService.startAllConnectors(BrokerService.java:2665)
        at org.apache.activemq.broker.BrokerService.doStartBroker(BrokerService.java:780)
        at org.apache.activemq.broker.BrokerService.startBroker(BrokerService.java:742)
        at org.apache.activemq.broker.BrokerService.start(BrokerService.java:645)
        at org.apache.activemq.xbean.XBeanBrokerService.afterPropertiesSet(XBeanBrokerService.java:73)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeCustomInitMethod(AbstractAutowireCapableBeanFactory.java:1748)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1685)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1615)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:553)
        at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:481)
        at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:312)
        at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
        at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:308)
        at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
        at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:756)
        at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:542)
        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:63)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
        at org.apache.activemq.console.Main.main(Main.java:115)
 INFO | Apache ActiveMQ 5.16.3 (localhost, ID:-56758-1629701645862-0:1) is shutting down
 INFO | Connector openwire stopped
 INFO | Connector amqp stopped
 INFO | Connector stomp stopped
 INFO | Connector mqtt stopped
 INFO | Connector ws stopped
 INFO | PListStore:[C:\Users\99043\software\apache-activemq-5.16.3-bin\apache-activemq-5.16.3\bin\..\data\localhost\tmp_storage] stopped
 INFO | Stopping async queue tasks
 INFO | Stopping async topic tasks
 INFO | Stopped KahaDB
 INFO | Apache ActiveMQ 5.16.3 (localhost, ID:-56758-1629701645862-0:1) uptime 1.600 seconds
 INFO | Apache ActiveMQ 5.16.3 (localhost, ID:-56758-1629701645862-0:1) is shutdown
 INFO | Closing org.apache.activemq.xbean.XBeanBrokerFactory$1@7e07db1f: startup date [Mon Aug 23 14:54:03 CST 2021]; root of context hierarchy
 WARN | Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.apache.activemq.xbean.XBeanBrokerService#0' defined in class path resource [activemq.xml]: Invocation of init method failed; nested exception is java.net.URISyntaxException: Illegal character in hostname at index 5: ws://小白酒菊:61614?maximumConnections=1000&wireFormat.maxFrameSize=104857600
ERROR: java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
java.lang.RuntimeException: Failed to execute start task. Reason: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
        at org.apache.activemq.console.command.StartCommand.runTask(StartCommand.java:91)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
        at org.apache.activemq.console.Main.main(Main.java:115)
Caused by: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
        at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:164)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1034)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555)
        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)
        ... 10 more
ERROR: java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext
        at org.springframework.context.support.AbstractRefreshableApplicationContext.getBeanFactory(AbstractRefreshableApplicationContext.java:164)
        at org.springframework.context.support.AbstractApplicationContext.destroyBeans(AbstractApplicationContext.java:1034)
        at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:555)
        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:63)
        at org.apache.activemq.console.command.ShellCommand.runTask(ShellCommand.java:154)
        at org.apache.activemq.console.command.AbstractCommand.execute(AbstractCommand.java:63)
        at org.apache.activemq.console.command.ShellCommand.main(ShellCommand.java:104)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:567)
        at org.apache.activemq.console.Main.runTaskClass(Main.java:262)
        at org.apache.activemq.console.Main.main(Main.java:115)

Solution: enter the installation root directory/apache-activemq-5.16.3/conf folder and configure activemq.xml;

*Amend as follows: