9 Replies Latest reply on Apr 22, 2010 10:56 AM by Daniel Teixeira

    Embedded instance: NullPointerException on load xml configuration

    Daniel Teixeira Newbie

      HI all,

       

      I'm trying to up the server in a embedded instance, loading the configuration from xml files.

      I got NullPointerException on configuration.start();

       

      Does anybody face the same problem?

      I already put the xml files on classpath (Eclipse).

      Any clue?

       

      Code:

       


      import org.hornetq.core.config.impl.FileConfiguration;
      import org.hornetq.core.server.HornetQServer;
      import org.hornetq.core.server.HornetQServers;
      import org.hornetq.jms.server.JMSServerManager;
      import org.hornetq.jms.server.impl.JMSServerManagerImpl;

      public class EmbeddedServer {
          public static void main(String[] args) throws Exception {
              try {
                  FileConfiguration configuration = new FileConfiguration();
                  configuration.setConfigurationUrl("hornetq-configuration.xml");
                  configuration.start();

                  HornetQServer server = HornetQServers.newHornetQServer(configuration);
                  JMSServerManager jmsServerManager = new JMSServerManagerImpl(server, "hornetq-jms.xml");

                  jmsServerManager.setContext(null);
                  jmsServerManager.start();
                  System.out.println("STARTED::");
              } catch (Throwable e) {
                  System.out.println("FAILED::");
                  e.printStackTrace();
              }
          }
      }

       

      Regards,

       

      Daniel