7 Replies Latest reply on Jan 15, 2009 5:25 PM by Andy Taylor

    Do you have example code embeding JBMBootstrapServer for JBM

    glm Newbie

      I am able to run the JBMBootstrapServer from the command line using the run.bat that comes with JMB 2.0.0Alpha but when I create my own Main() program that embeds JBMBootstrapServer I get some unusual behavior where I get a JMSSecurity exception stating unable to validate user.

      package com.nichpro.jms;
      
      import java.util.HashMap;
      import java.util.Map;
      
      import org.jboss.kernel.spi.deployment.KernelDeployment;
      import org.jboss.messaging.microcontainer.JBMBootstrapServer;
      
      
      /**
       * Main Class : [Description Goes Here]
       *
       *
       * @author gary.v.marsh
       *
       */
      public class Main {
      
       private JBMBootstrapServer bootstrapServer ;
       private KernelDeployment deployment;
       private static Main bootMain;
       private Map<String, KernelDeployment> deployedMap;
       /**
       * main performs {input functionality here}
       *
       * @param args
       */
       public static void main( String[ ] args ) {
      
       bootMain = new Main();
       bootMain.configure(args);
      
       }
      
       protected void configure(String[] args)
       {
       int index = 0;
       String[] bootargs = null;
      
       deployedMap = new HashMap<String, KernelDeployment>();
      
       try
       {
       String[] argString = {"/NichPro/MDS_POJO_With_JBM/config/jbm-standalone-beans.xml"};
      
       bootstrapServer = new JBMBootstrapServer(argString);
       bootstrapServer.run();
       System.out.println("Using JBMBootstrapServer to deploy : " + argString);
      
       }
       catch (Throwable t)
       {
       t.printStackTrace();
       }
       }
      
      
       private static Main getMain()
       {
       if (bootMain == null)
       throw new IllegalArgumentException("Main in not initialized, should run Main.main()!");
      
       return bootMain;
       }
      
      
      


      The Error Message with full path to xml file:

      java.lang.RuntimeException: Unable to find resource:/NichPro/MDS_POJO_With_JBM/config/jbm-standalone-beans.xml
      at org.jboss.messaging.microcontainer.JBMBootstrapServer.deploy(JBMBootstrapServer.java:148)
      at org.jboss.messaging.microcontainer.JBMBootstrapServer.bootstrap(JBMBootstrapServer.java:107)
      at org.jboss.kernel.plugins.bootstrap.AbstractBootstrap.run(AbstractBootstrap.java:89)
      at org.jboss.messaging.microcontainer.JBMBootstrapServer.run(JBMBootstrapServer.java:73)
      at com.nichpro.jms.Main.configure(Main.java:57)
      at com.nichpro.jms.Main.main(Main.java:37)
      11:35:18,021 INFO @Thread-0 [JBMBootstrapServer] Shutting down



      Now when I just pass the file name jbm-standalone-bean.xml I get the following error :


      11:41:02,911 INFO @main [XmlDeployer] deploying ConnectionFactory
      11:41:02,911 WARN @main [JMSServerManagerImpl] Binding for /ConnectionFactory already exists
      11:41:02,911 WARN @main [JMSServerManagerImpl] Binding for java:/ConnectionFactory already exists
      11:41:02,911 WARN @main [JMSServerManagerImpl] Binding for java:/XAConnectionFactory already exists
      11:41:02,911 INFO @main [XmlDeployer] deploying ClusteredConnectionFactory
      11:41:02,927 WARN @main [JMSServerManagerImpl] Binding for java:/ClusteredConnectionFactory already exists
      11:41:02,927 WARN @main [JMSServerManagerImpl] Binding for java:/ClusteredXAConnectionFactory already exists
      11:41:02,927 INFO @main [XmlDeployer] deploying MyExampleConnectionFactory
      Starting MonitorMgrImpl...
      javax.jms.JMSSecurityException: Unable to validate user: null
      at org.jboss.messaging.core.remoting.impl.wireformat.MessagingExceptionMessage.decodeBody(MessagingExceptionMessage.java:60)
      at org.jboss.messaging.core.remoting.impl.wireformat.EmptyPacket.decode(EmptyPacket.java:183)
      at org.jboss.messaging.core.remoting.impl.mina.MessagingCodec.doDecode(MessagingCodec.java:430)
      at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:173)
      at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:170)
      at org.apache.mina.common.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:405)
      at org.apache.mina.common.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:40)
      at org.apache.mina.common.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:823)
      at org.apache.mina.common.DefaultIoFilterChain$HeadFilter.messageReceived(DefaultIoFilterChain.java:607)
      at org.apache.mina.common.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:405)
      at org.apache.mina.common.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:399)
      at org.apache.mina.common.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:434)
      at org.apache.mina.common.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:396)
      at org.apache.mina.common.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:388)
      at org.apache.mina.common.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:43)
      at org.apache.mina.common.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:706)
      at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: MessagingException[errorCode=105 message=Unable to validate user: null]
      ... 20 more
      MonitorMgrInpl stop() was called..

      Starting DataProcAgentImpl...

      javax.jms.JMSSecurityException: Unable to validate user: null
      at org.jboss.messaging.core.remoting.impl.wireformat.MessagingExceptionMessage.decodeBody(MessagingExceptionMessage.java:60)
      at org.jboss.messaging.core.remoting.impl.wireformat.EmptyPacket.decode(EmptyPacket.java:183)
      at org.jboss.messaging.core.remoting.impl.mina.MessagingCodec.doDecode(MessagingCodec.java:430)
      at org.apache.mina.filter.codec.CumulativeProtocolDecoder.decode(CumulativeProtocolDecoder.java:173)
      at org.apache.mina.filter.codec.ProtocolCodecFilter.messageReceived(ProtocolCodecFilter.java:170)
      at org.apache.mina.common.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:405)
      at org.apache.mina.common.DefaultIoFilterChain.access$1200(DefaultIoFilterChain.java:40)
      at org.apache.mina.common.DefaultIoFilterChain$EntryImpl$1.messageReceived(DefaultIoFilterChain.java:823)
      at org.apache.mina.common.DefaultIoFilterChain$HeadFilter.messageReceived(DefaultIoFilterChain.java:607)
      at org.apache.mina.common.DefaultIoFilterChain.callNextMessageReceived(DefaultIoFilterChain.java:405)
      at org.apache.mina.common.DefaultIoFilterChain.fireMessageReceived(DefaultIoFilterChain.java:399)
      at org.apache.mina.common.AbstractPollingIoProcessor.read(AbstractPollingIoProcessor.java:434)
      at org.apache.mina.common.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:396)
      at org.apache.mina.common.AbstractPollingIoProcessor.process(AbstractPollingIoProcessor.java:388)
      at org.apache.mina.common.AbstractPollingIoProcessor.access$400(AbstractPollingIoProcessor.java:43)
      at org.apache.mina.common.AbstractPollingIoProcessor$Worker.run(AbstractPollingIoProcessor.java:706)
      at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
      at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:886)
      at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:908)
      at java.lang.Thread.run(Thread.java:619)
      Caused by: MessagingException[errorCode=105 message=Unable to validate user: null]
      ... 20 more
      Starting DataDirMonitor...
      DirMonitorImpl setupTopic() ....
      11:41:03,068 INFO @main [JBMBootstrapServer] JBM Server Started
      Using JBMBootstrapServer to deploy : [Ljava.lang.String;@30c963



      A good embedded example would be very helpful.

      Regards,

      GMarsh