jboss debugg [https://community.jboss.org/people/jmsdebug] created the 
discussion

"monitor Jboss queue with Java Program"

To view the discussion, visit: https://community.jboss.org/message/759101#759101

--------------------------------------------------------------
using Java program able to connect jmx/rmi/RMIAdapto, but ran into below 
exception in further deep into MBeanServerConnection ,
-------------------------
org.jboss.invocation.jrmp.interfaces.jrmpinvokerpr...@7b1a9eabjava.lang.SecurityException:
 Failed to authenticate principal=null, securityDomain=jmx-console
    at 
org.jboss.jmx.connector.invoker.AuthenticationInterceptor.invoke(AuthenticationInterceptor.java:89)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:90)
    at 
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
    at 
org.jboss.invocation.jrmp.server.JRMPProxyFactory.invoke(JRMPProxyFactory.java:180)
    at sun.reflect.GeneratedMethodAccessor279.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at 
org.jboss.mx.interceptor.ReflectedDispatcher.invoke(ReflectedDispatcher.java:157)
    at org.jboss.mx.server.Invocation.dispatch(Invocation.java:96)
    at org.jboss.mx.server.Invocation.invoke(Invocation.java:88)
    at 
org.jboss.mx.server.AbstractMBeanInvoker.invoke(AbstractMBeanInvoker.java:264)
    at org.jboss.mx.server.MBeanServerImpl.invoke(MBeanServerImpl.java:668)
    at 
org.jboss.invocation.jrmp.server.JRMPInvoker$MBeanServerAction.invoke(JRMPInvoker.java:855)
    at org.jboss.invocation.jrmp.server.JRMPInvoker.invoke(JRMPInvoker.java:422)
---------------------


public class MBeanMonitor
    {
        private static MBeanServerConnection connection;


        public static void connectJNDI() throws Exception{
            Properties enviornment = new Properties();
            
enviornment.setProperty("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
            
enviornment.setProperty("java.naming.provider.url","jnp://localhost:1099");
            
enviornment.setProperty("java.naming.factory.url.pkgs","org.jboss.naming 
rg.jnp.interfaces");
            enviornment.setProperty(Context.SECURITY_PRINCIPAL, "admin");
            enviornment.setProperty(Context.SECURITY_CREDENTIALS, "admin"); 

            InitialContext initialContext = new InitialContext(enviornment);
            connection = (MBeanServerConnection) 
initialContext.lookup("jmx/rmi/RMIAdaptor");

            System.out.print(connection.toString());
        }

          public static void monitorJMS() throws Exception
          {
                         ObjectName objectName=new 
ObjectName("jboss.messaging.destination:name=DLQ,service=Queue");
                         System.out.println("Queue  = "+ 
(String)connection.getAttribute(new 
ObjectName("jboss.messaging.destination:name=DLQ,service=Queue"), new 
String("Name"))); 

          }



        public static void main(String[] args) throws Exception
        {
            process();
        }
        public static void process() {
            try {

                connectJNDI();
                monitorJMS();
            }catch (Exception e) {
                e.printStackTrace();
            }
        }

    }
--------------------------------------------------------------

Reply to this message by going to Community
[https://community.jboss.org/message/759101#759101]

Start a new discussion in JBoss Messaging at Community
[https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2042]

_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to