Description
Use case:
- Artemis embedded in an application server.
- Persistence directories configured using absolute paths (e.g. : C:\Java\wildfly-10.0.0.CR1-SNAPSHOT\standalone\data\activemq\journal)
When the server starts, Artemis throws an exception:
2015-09-08 10:16:35,751 ERROR [org.jboss.msc.service.fail] (ServerService Thread Pool -- 64) MSC000001: Failed to start service jboss.messaging-activemq.default.jms.manager: org.jboss.msc.service.StartException in service jboss.messaging-activemq.default.jms.manager: WFLYMSGAMQ0033: Failed to start service at org.wildfly.extension.messaging.activemq.jms.JMSService.doStart(JMSService.java:177) at org.wildfly.extension.messaging.activemq.jms.JMSService.access$000(JMSService.java:60) at org.wildfly.extension.messaging.activemq.jms.JMSService$1.run(JMSService.java:94) at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511) at java.util.concurrent.FutureTask.run(FutureTask.java:266) 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) at org.jboss.threads.JBossThread.run(JBossThread.java:320) Caused by: java.lang.RuntimeException: java.lang.IllegalArgumentException: Illegal character in opaque part at index 2: C:\Java\wildfly-10.0.0.CR1-SNAPSHOT\standalone\data\activemq\journal at org.apache.activemq.artemis.core.config.impl.ConfigurationImpl.subFolder(ConfigurationImpl.java:1434) at org.apache.activemq.artemis.core.config.impl.ConfigurationImpl.getJournalLocation(ConfigurationImpl.java:507) at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.checkJournalDirectory(ActiveMQServerImpl.java:1800) at org.apache.activemq.artemis.core.server.impl.ActiveMQServerImpl.start(ActiveMQServerImpl.java:381) at org.apache.activemq.artemis.jms.server.impl.JMSServerManagerImpl.start(JMSServerManagerImpl.java:381) at org.wildfly.extension.messaging.activemq.jms.JMSService.doStart(JMSService.java:173) ... 8 more Caused by: java.lang.IllegalArgumentException: Illegal character in opaque part at index 2: C:\Java\wildfly-10.0.0.CR1-SNAPSHOT\standalone\data\activemq\journal at java.net.URI.create(URI.java:852) at java.net.URI.resolve(URI.java:1036) at org.apache.activemq.artemis.core.config.impl.ConfigurationImpl.subFolder(ConfigurationImpl.java:1430) ... 13 more Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 2: C:\Java\wildfly-10.0.0.CR1-SNAPSHOT\standalone\data\activemq\journal at java.net.URI$Parser.fail(URI.java:2848) at java.net.URI$Parser.checkChars(URI.java:3021) at java.net.URI$Parser.parse(URI.java:3058) at java.net.URI.<init>(URI.java:588) at java.net.URI.create(URI.java:850) ... 15 more
It is common usage to use absolute paths for these persistence directories in the shared store use case. It is no longer possible to do so.
The configuration will now always be stored in a subfolder based on the artemis.instance or user.dir sysprop. In the shared store use case, these sys props makes no sense.
Note that it works in Unix but I'm not sure that's by design. A file://XXX// folder will be ignored if it resolves an absolute file path (code in ConfigurationImpl#subFolder).
This is critical for us to be able to use absolute paths to configure Artemis persistence. Our app server has its own way to resolve paths and we just need to pass the resolved absolute paths to Artemis.
Using only relative paths will make the configuration of Artemis more complex than it already is.
Possible fix:
- Detect if the configured directory is absolute before trying to resolve it as a relative path