Version 17

    MISC

     

    • Check bound ports

     

       netstat -ao

     

    • Make Http Calls from within EJBs or any Java Resource

     

       The only standard way is to use the java.net.URL class and parse the result yourself. The better approach is to use the commons HttpClient framework.

     

    • Obtaining Client IP in Server Side Interceptor

     

       There is no portable way to do this. You would have to write your own invoker that associated the request endpoint address with each request. Look at the org.jboss.invocation.pooled.server.PooledInvoker code.

     

    • Web based JNDI Browser

     

      http://www.ejtools.org/applications/jndi.browser/index.html

     

    • How do I get a reference to an MBean?

     

      You do not need a reference to the MBean. You simply need a reference to the JMX agent (MBeanServer). You can then invoke calls to the MBean through the agent.

      Get the MBeanServer like this:
    
    MBeanServer mbeanServer = 
    (MBeanServer) MBeanServerFactory.findMBeanServer(null).iterator().next();
    
    Create an ObjectName for your MBean like this:
    ObjectName objectName = new ObjectName("<mydomain>:<myname>");
    
    e.g. ObjectName objectName = new ObjectName("com.example:service=myservice");
    Check the JMX Console for the name of your MBean.
    Then, invoke methods against your mbean as follows:
    
    mbeanServer.invoke(objectName, "<method name>",  new Object[]{<array of object params>}, new String[]{<array of class types of objects>}  );