2 Replies Latest reply on Nov 9, 2015 3:31 AM by vic neiman

    EmbeddedJMS: "java.net.MalformedURLException: no protocol"

    vic neiman Newbie

      Hi all,

       

      I have an EmbeddedJMS that I would like to configure using files located in a non-standard folder (I want to keep them in /opt/config/hornetq), the following files in particular:

      hornetq-configuration.xml 

      hornetq-jms.xml 

      hornetq-users.xml

       

      EmbeddedJMS jmsServer = new EmbeddedJMS();
      String configPath = termDriverConfig.getJmsServer().getConfigPath();
      jmsServer.setConfigResourcePath("/opt/config/hornetq/hornetq-configuration.xml");
      jmsServer.setJmsConfigResourcePath("/opt/config/hornetq/hornetq-jms.xml");

       

      And I keep getting the following exception:

      Exception in thread "SAFJMSServer" za.co.fnb.ms.switchtofnb.safcommon.SAFException: SAFServiceMain Error

        at za.co.fnb.ms.switchtofnb.safservice.SAFServiceMain.startServer(SAFServiceMain.java:99)

        at za.co.fnb.ms.switchtofnb.safservice.threading.SAFServiceMainRunnable.run(SAFServiceMainRunnable.java:25)

        at java.lang.Thread.run(Thread.java:745)

      Caused by: java.net.MalformedURLException: no protocol: /opt/config/hornetq/hornetq-configuration.xml

        at java.net.URL.<init>(URL.java:586)

        at java.net.URL.<init>(URL.java:483)

        at java.net.URL.<init>(URL.java:432)

        at org.hornetq.core.config.impl.FileConfiguration.start(FileConfiguration.java:67)

        at org.hornetq.core.server.embedded.EmbeddedHornetQ.initStart(EmbeddedHornetQ.java:97)

        at org.hornetq.jms.server.embedded.EmbeddedJMS.start(EmbeddedJMS.java:101)

        at za.co.fnb.ms.switchtofnb.safservice.SAFServiceMain.startServer(SAFServiceMain.java:64)

        ... 2 more

       

      I am at a loss as to what to try, I've tried adding the directory to the classpath when I run the JAR (with -cp /opt/config/hornetq), I've tried putting the files in the same folder as the JAR I am executing. The only thing that works is to keep those files in the /resources directory of the module where the HornetQ code resides. I would very much like to keep those files in /opt because then I can change the configs and restart my JAR without having to recompile it.

       

      Any help would be very appreciated.

       

      Thanks