6 Replies Latest reply on Feb 19, 2015 5:40 PM by Kevin Scott

    MalformedURLException: no protocol: hornetq-configuration.xml

    Kevin Scott Newbie

      Hi all,

      I am trying to follow the instructions here Chapter 4. Installation and Configuration to configure the HornetQ REST interface and I am running into some difficulty.  I tried to construct my own WAR using the instructions in Chapter 4. I have the same pom.xml as well as all the configuration files under /src/main/resources.  I am deploying the WAR using a Jboss-as-7.1.1-FINAL server.  Every time I deploy the war I get the following exception:

       

      16:08:37,267 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-5) JB
      AS018567: Deployment "deployment.myapp-0.1-SNAPSHOT.war" is using a private modu
      le ("org.jboss.netty:main") which may be changed or removed in future versions w
      ithout notice.
      16:08:37,272 WARN  [org.jboss.as.dependency.private] (MSC service thread 1-5) JB
      AS018567: Deployment "deployment.myapp-0.1-SNAPSHOT.war" is using a private modu
      le ("org.apache.httpcomponents:main") which may be changed or removed in future
      versions without notice.
      16:08:37,552 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
      host].[/myapp-0.1-SNAPSHOT]] (MSC service thread 1-3) Exception sending context
      initialized event to listener instance of class org.hornetq.rest.integration.Hor
      netqBootstrapListener: java.lang.RuntimeException: java.net.MalformedURLExceptio
      n: no protocol: hornetq-configuration.xml
              at org.hornetq.rest.integration.HornetqBootstrapListener.contextInitiali
      zed(HornetqBootstrapListener.java:28) [hornetq-rest-2.3.4.Final.jar:]
              at org.apache.catalina.core.StandardContext.contextListenerStart(Standar
      dContext.java:3392) [jbossweb-7.0.13.Final.jar:]
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
      850) [jbossweb-7.0.13.Final.jar:]
              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
      ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
      rviceControllerImpl.java:1811)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
      rollerImpl.java:1746)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
      java:1145) [rt.jar:1.7.0_71]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
      .java:615) [rt.jar:1.7.0_71]
              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
      Caused by: java.net.MalformedURLException: no protocol: hornetq-configuration.xm
      l
              at java.net.URL.<init>(URL.java:585) [rt.jar:1.7.0_71]
              at java.net.URL.<init>(URL.java:482) [rt.jar:1.7.0_71]
              at java.net.URL.<init>(URL.java:431) [rt.jar:1.7.0_71]
              at org.hornetq.core.config.impl.FileConfiguration.start(FileConfiguratio
      n.java:67) [hornetq-core-2.2.13.Final.jar:]
              at org.hornetq.core.server.embedded.EmbeddedHornetQ.initStart(EmbeddedHo
      rnetQ.java:86) [hornetq-core-2.2.13.Final.jar:]
              at org.hornetq.jms.server.embedded.EmbeddedJMS.start(EmbeddedJMS.java:88
      ) [hornetq-jms-2.2.13.Final.jar:]
              at org.hornetq.rest.integration.HornetqBootstrapListener.contextInitiali
      zed(HornetqBootstrapListener.java:24) [hornetq-rest-2.3.4.Final.jar:]
              ... 8 more
      
      
      16:08:37,743 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
      host].[/myapp-0.1-SNAPSHOT]] (MSC service thread 1-3) Exception sending context
      initialized event to listener instance of class org.hornetq.rest.integration.Res
      tMessagingBootstrapListener: java.lang.RuntimeException: HornetQException[errorC
      ode=2 message=Cannot connect to server(s). Tried with all available servers.]
              at org.hornetq.rest.integration.RestMessagingBootstrapListener.contextIn
      itialized(RestMessagingBootstrapListener.java:40) [hornetq-rest-2.3.4.Final.jar:
      ]
              at org.apache.catalina.core.StandardContext.contextListenerStart(Standar
      dContext.java:3392) [jbossweb-7.0.13.Final.jar:]
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
      850) [jbossweb-7.0.13.Final.jar:]
              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
      ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
      rviceControllerImpl.java:1811)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
      rollerImpl.java:1746)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
      java:1145) [rt.jar:1.7.0_71]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
      .java:615) [rt.jar:1.7.0_71]
              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
      Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tri
      ed with all available servers.]
              at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(S
      erverLocatorImpl.java:769) [hornetq-core-2.2.13.Final.jar:]
              at org.hornetq.rest.MessageServiceManager.start(MessageServiceManager.ja
      va:157) [hornetq-rest-2.3.4.Final.jar:]
              at org.hornetq.rest.integration.RestMessagingBootstrapListener.contextIn
      itialized(RestMessagingBootstrapListener.java:34) [hornetq-rest-2.3.4.Final.jar:
      ]
              ... 8 more
      
      
      16:08:37,806 ERROR [org.apache.catalina.core.StandardContext] (MSC service threa
      d 1-3) Error listenerStart
      16:08:37,808 ERROR [org.apache.catalina.core.StandardContext] (MSC service threa
      d 1-3) Context [/myapp-0.1-SNAPSHOT] startup failed due to previous errors
      16:08:37,820 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
      host].[/myapp-0.1-SNAPSHOT]] (MSC service thread 1-3) Exception sending context
      destroyed event to listener instance of class org.hornetq.rest.integration.Horne
      tqBootstrapListener: java.lang.RuntimeException: java.lang.NullPointerException
              at org.hornetq.rest.integration.HornetqBootstrapListener.contextDestroye
      d(HornetqBootstrapListener.java:40) [hornetq-rest-2.3.4.Final.jar:]
              at org.apache.catalina.core.StandardContext.listenerStop(StandardContext
      .java:3489) [jbossweb-7.0.13.Final.jar:]
              at org.apache.catalina.core.StandardContext.stop(StandardContext.java:39
      99) [jbossweb-7.0.13.Final.jar:]
              at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
      917) [jbossweb-7.0.13.Final.jar:]
              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
      ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
      rviceControllerImpl.java:1811)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
      rollerImpl.java:1746)
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
      java:1145) [rt.jar:1.7.0_71]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
      .java:615) [rt.jar:1.7.0_71]
              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
      Caused by: java.lang.NullPointerException
              at org.hornetq.jms.server.embedded.EmbeddedJMS.stop(EmbeddedJMS.java:107
      ) [hornetq-jms-2.2.13.Final.jar:]
              at org.hornetq.rest.integration.HornetqBootstrapListener.contextDestroye
      d(HornetqBootstrapListener.java:36) [hornetq-rest-2.3.4.Final.jar:]
              ... 9 more
      
      
      16:08:37,846 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-3) MSC0000
      1: Failed to start service jboss.web.deployment.default-host."/myapp-0.1-SNAPSHO
      T": org.jboss.msc.service.StartException in service jboss.web.deployment.default
      -host."/myapp-0.1-SNAPSHOT": JBAS018040: Failed to start context
              at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
      ervice.java:95)
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
      rviceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
              at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
      rollerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
              at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
      java:1145) [rt.jar:1.7.0_71]
              at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
      .java:615) [rt.jar:1.7.0_71]
              at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
      

       

      My hornetq-configuration looks like this:

      <configuration xmlns="urn:hornetq"
                     xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                     xsi:schemaLocation="urn:hornetq /schema/hornetq-configuration.xsd">
      
      
         <paging-directory>${data.dir:../data}/paging</paging-directory>
         
         <bindings-directory>${data.dir:../data}/bindings</bindings-directory>
         
         <journal-directory>${data.dir:../data}/journal</journal-directory>
         
         <journal-min-files>10</journal-min-files>
         
         <large-messages-directory>${data.dir:../data}/large-messages</large-messages-directory>
         
         <connectors>
            <connector name="netty">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
            </connector>
            
            <connector name="netty-throughput">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyConnectorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
               <param key="batch-delay" value="50"/>
            </connector>
         </connectors>
      
      
         <acceptors>
            <acceptor name="netty">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.port:5445}"/>
            </acceptor>
            
            <acceptor name="netty-throughput">
               <factory-class>org.hornetq.core.remoting.impl.netty.NettyAcceptorFactory</factory-class>
               <param key="host"  value="${hornetq.remoting.netty.host:localhost}"/>
               <param key="port"  value="${hornetq.remoting.netty.batch.port:5455}"/>
               <param key="batch-delay" value="50"/>
               <param key="direct-deliver" value="false"/>
            </acceptor>
         </acceptors>
      
      
         <security-settings>
            <security-setting match="#">
               <permission type="createNonDurableQueue" roles="guest"/>
               <permission type="deleteNonDurableQueue" roles="guest"/>
               <permission type="consume" roles="guest"/>
               <permission type="send" roles="guest"/>
            </security-setting>
         </security-settings>
      
      
         <address-settings>
            <!--default for catch all-->
            <address-setting match="#">
               <dead-letter-address>jms.queue.DLQ</dead-letter-address>
               <expiry-address>jms.queue.ExpiryQueue</expiry-address>
               <redelivery-delay>0</redelivery-delay>
               <max-size-bytes>10485760</max-size-bytes>       
               <message-counter-history-day-limit>10</message-counter-history-day-limit>
               <address-full-policy>BLOCK</address-full-policy>
            </address-setting>
         </address-settings>
      
      
      </configuration>
      

       

      My questions are how do I debug this problem?  Is there a log somewhere that gives me more detail about the issue?

       

      Thanks in advance

        • 1. Re: MalformedURLException: no protocol: hornetq-configuration.xml
          Justin Bertram Master

          The fact that it's looking for hornetq-configuration.xml instead of trying to use the existing HornetQ server running within JBoss AS tells me you're trying to bootstrap HornetQ along with the REST interface which is incorrect for this use-case.  The documentation covers both scenarios (i.e. REST interface in an environment with HornetQ pre-configured and without).  I recommend you check your web.xml.

          1 of 1 people found this helpful
          • 2. Re: Re: MalformedURLException: no protocol: hornetq-configuration.xml
            Kevin Scott Newbie

            Hi Justin,

            Thanks for the quick reply, you are right that I was trying to use the bootstrap configurations. I switched to the pre-configured POM and web.xml and now I am getting a different exception:

             

            16:51:50,342 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-
            host].[/myapp-0.1-SNAPSHOT]] (MSC service thread 1-1) Exception sending context
            initialized event to listener instance of class org.hornetq.rest.integration.Res
            tMessagingBootstrapListener: java.lang.RuntimeException: HornetQException[errorC
            ode=2 message=Cannot connect to server(s). Tried with all available servers.]
                    at org.hornetq.rest.integration.RestMessagingBootstrapListener.contextIn
            itialized(RestMessagingBootstrapListener.java:42) [hornetq-rest-2.2.14.Final.jar
            :]
                    at org.apache.catalina.core.StandardContext.contextListenerStart(Standar
            dContext.java:3392) [jbossweb-7.0.13.Final.jar:]
                    at org.apache.catalina.core.StandardContext.start(StandardContext.java:3
            850) [jbossweb-7.0.13.Final.jar:]
                    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
            ervice.java:90) [jboss-as-web-7.1.1.Final.jar:7.1.1.Final]
                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
            rviceControllerImpl.java:1811)
                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
            rollerImpl.java:1746)
                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
            java:1145) [rt.jar:1.7.0_71]
                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
            .java:615) [rt.jar:1.7.0_71]
                    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
            Caused by: HornetQException[errorCode=2 message=Cannot connect to server(s). Tri
            ed with all available servers.]
                    at org.hornetq.core.client.impl.ServerLocatorImpl.createSessionFactory(S
            erverLocatorImpl.java:769) [hornetq-core-2.2.13.Final.jar:]
                    at org.hornetq.rest.MessageServiceManager.start(MessageServiceManager.ja
            va:154) [hornetq-rest-2.2.14.Final.jar:]
                    at org.hornetq.rest.integration.RestMessagingBootstrapListener.contextIn
            itialized(RestMessagingBootstrapListener.java:36) [hornetq-rest-2.2.14.Final.jar
            :]
                    ... 8 more
            
            
            16:51:50,411 ERROR [org.apache.catalina.core.StandardContext] (MSC service threa
            d 1-1) Error listenerStart
            16:51:50,413 ERROR [org.apache.catalina.core.StandardContext] (MSC service threa
            d 1-1) Context [/myapp-0.1-SNAPSHOT] startup failed due to previous errors
            16:51:50,429 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC0000
            1: Failed to start service jboss.web.deployment.default-host."/myapp-0.1-SNAPSHO
            T": org.jboss.msc.service.StartException in service jboss.web.deployment.default
            -host."/myapp-0.1-SNAPSHOT": JBAS018040: Failed to start context
                    at org.jboss.as.web.deployment.WebDeploymentService.start(WebDeploymentS
            ervice.java:95)
                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(Se
            rviceControllerImpl.java:1811) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                    at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceCont
            rollerImpl.java:1746) [jboss-msc-1.0.2.GA.jar:1.0.2.GA]
                    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.
            java:1145) [rt.jar:1.7.0_71]
                    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
            .java:615) [rt.jar:1.7.0_71]
                    at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_71]
            

             

            Any ideas on this error?

            • 3. Re: Re: MalformedURLException: no protocol: hornetq-configuration.xml
              Justin Bertram Master

              I'd need to see the whole log to be able to help much.

               

              Also, when you paste your log snippets try to unwrap them if possible.  The wrapped lines are unnecessarily difficult to read.

              1 of 1 people found this helpful
              • 4. Re: Re: Re: MalformedURLException: no protocol: hornetq-configuration.xml
                Kevin Scott Newbie

                Sorry about the poor formatting, here is the complete logs.  I see a warning about some of the JAXB jars but I don't know  if I can ignore those or not

                • 5. Re: Re: Re: MalformedURLException: no protocol: hornetq-configuration.xml
                  Justin Bertram Master

                  I see no evidence in your log that JBoss AS is starting HornetQ.  If HornetQ isn't started then obviously the REST interface can't connect to it.

                   

                  Are you using a JBoss AS configuration which contains HornetQ (e.g. standalone-full.xml)?

                  • 6. Re: Re: Re: MalformedURLException: no protocol: hornetq-configuration.xml
                    Kevin Scott Newbie

                    That was the problem, when I added the correct switch ( --server-config=standalone-full.xml)  it started the system.

                     

                    Thank you so much for your help!