2 Replies Latest reply on Sep 12, 2002 8:29 PM by Jaime Torres C.

    jboss-3.0.2 HTTP to JMX invoker  - external client problem

    Jaime Torres C. Newbie

      Hello:

      When we use the HTTP to JMX invoker (in jboss-3.0.2), that allows for RMI/HTTP for the JNDI service, from the jboss-server machine it works fine; but when we try the same program from another computer it is unabled to get (cast) the RMI adaptor whith the following message
      java.lang.reflect.UndeclaredThrowableException
      at $Proxy0.lookup(Unknown Source)

      It seems as if the invokerServletPath system property, could be obtained only when we are running the program on the jboss-server machine.

      We tried setting the property without luck, may be we are missing something really silly?, like what?

      Any help is very much appreciated.

      Thanks very much.

      Jaime Torres C.


      Following is the code used and the execption;

      Program code

      import java.io.*;
      import java.net.*;
      import java.rmi.*;
      import java.util.*;
      import javax.management.*;
      import javax.naming.*;
      import com.techtrader.modules.tools.bytecode.BCEntity;
      import org.jboss.jmx.connector.ConnectorFactoryImpl.*;
      import org.jboss.jmx.connector.notification.ClientNotificationListener;
      import org.jboss.jmx.connector.rmi.*;
      import org.jboss.jmx.adaptor.rmi.*;
      import org.apache.log4j.Priority;
      import org.apache.axis.client.Call;
      import org.apache.commons.logging.LogFactory;
      import org.jboss.net.jmx.adaptor.*;
      import org.jboss.net.jmx.*;
      //import org.jboss.invocation.http.interfaces.*;

      public class ConnectorEnlaceAPB{

      String adaptorJNDIName="jmx:XXX:rmi";//as appears in jboss.jmx JNDIName
      Hashtable env = new Hashtable();
      String invokerServletPath = "http://my_jboss_server:8080/invoker/JMXInvokerServlet";
      String initial_context = "org.jboss.naming.HttpNamingContextFactory";
      Properties props;
      String provider_url =
      "http://my_jboss_server:8080/invoker/JNDIFactory";
      RMIConnectorImpl server;
      String url_pkg = "org.jboss.naming:org.jnp.interfaces";

      public ConnectorEnlaceAPB(){
      this.props = System.getProperties();
      }

      public void setServer(){
      env.put(Context.INITIAL_CONTEXT_FACTORY,initial_context);
      env.put(Context.URL_PKG_PREFIXES,url_pkg);
      env.put(Context.PROVIDER_URL, provider_url);
      props.put("invokerServletPath",invokerServletPath);
      System.setProperties(props);
      System.out.println("Modificado \n invokerServletPath="+
      System.getProperty("invokerServletPath"));

      try{
      Context ic=new InitialContext(env);

      System.err.println("ConnectorEnlaceAPB.setServer getEnviroment="+ic.getEnvironment()); //// works till here

      RMIAdaptor adaptor =(RMIAdaptor)
      (ic.lookup(
      adaptorJNDIName)); /// crashes here

      System.err.println("ConnectorEnlaceAPB.setServer adaptor="+adaptor.toString());


      server= new RMIConnectorImpl(adaptor);
      .....
      .....
      .....
      .....

      }
      .....
      .....
      .....
      .....
      }

      Crash message:
      java.lang.reflect.UndeclaredThrowableException
      at $Proxy0.lookup(Unknown Source)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:445)
      at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:429)
      at javax.naming.InitialContext.lookup(InitialContext.java:347)
      at jtccia.enlaceAPB.client.core.ConnectorEnlaceAPB.setServer(ConnectorEnlaceAPB.java:55)
      at jtccia.enlaceAPB.client.core.ConsIdRegisAPBClient.makeRequest(ConsIdRegisAPBClient.java:393)
      at jtccia.enlaceAPB.client.core.ConsIdRegisAPBClient.pasoJtcEvent(ConsIdRegisAPBClient.java:847)
      at jtccia.common.SetXmlCompJtc.genEvento(SetXmlCompJtc.java:63)
      at jtccia.common.SetXmlCompComm.navigaForwd(SetXmlCompComm.java:1117)
      at jtccia.common.SetXmlCompComm.actionPerformed(SetXmlCompComm.java:971)
      at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1767)
      at javax.swing.AbstractButton$ForwardActionEvents.actionPerformed(AbstractButton.java:1820)
      at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:419)
      at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:257)
      at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:258)
      at java.awt.Component.processMouseEvent(Component.java:5021)
      at java.awt.Component.processEvent(Component.java:4818)
      at java.awt.Container.processEvent(Container.java:1380)
      at java.awt.Component.dispatchEventImpl(Component.java:3526)
      at java.awt.Container.dispatchEventImpl(Container.java:1437)
      at java.awt.Component.dispatchEvent(Component.java:3367)
      at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:3214)
      at java.awt.LightweightDispatcher.processMouseEvent(Container.java:2929)
      at java.awt.LightweightDispatcher.dispatchEvent(Container.java:2859)
      at java.awt.Container.dispatchEventImpl(Container.java:1423)
      at java.awt.Component.dispatchEvent(Component.java:3367)
      at java.awt.EventQueue.dispatchEvent(EventQueue.java:445)
      at java.awt.EventDispatchThread.pumpOneEventForHierarchy(EventDispatchThread.java:190)
      at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:144)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
      at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:130)
      at java.awt.EventDispatchThread.run(EventDispatchThread.java:98)
      Caused by: java.net.ConnectException: Connection refused
      at java.net.PlainSocketImpl.socketConnect(Native Method)
      at java.net.PlainSocketImpl.doConnect(PlainSocketImpl.java:295)
      at java.net.PlainSocketImpl.connectToAddress(PlainSocketImpl.java:161)
      at java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
      at java.net.Socket.connect(Socket.java:425)
      at java.net.Socket.connect(Socket.java:375)
      at sun.net.NetworkClient.doConnect(NetworkClient.java:139)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:366)
      at sun.net.www.http.HttpClient.openServer(HttpClient.java:582)
      at sun.net.www.http.HttpClient.(HttpClient.java:292)
      at sun.net.www.http.HttpClient.(HttpClient.java:253)
      at sun.net.www.http.HttpClient.New(HttpClient.java:321)
      at sun.net.www.http.HttpClient.New(HttpClient.java:306)
      at sun.net.www.http.HttpClient.New(HttpClient.java:301)
      at sun.net.www.protocol.http.HttpURLConnection.plainConnect(HttpURLConnection.java:463)
      at sun.net.www.protocol.http.HttpURLConnection.connect(HttpURLConnection.java:454)
      at sun.net.www.protocol.http.HttpURLConnection.getOutputStream(HttpURLConnection.java:510)
      at org.jboss.invocation.http.interfaces.HttpInvokerProxy.invoke(HttpInvokerProxy.java:93)
      at org.jboss.invocation.InvokerInterceptor.invoke(InvokerInterceptor.java:108)
      at org.jboss.proxy.ClientContainer.invoke(ClientContainer.java:76)
      ... 32 more

        • 1. Re: jboss-3.0.2 HTTP to JMX invoker  - external client probl
          Adrian Brock Master

          Your problem is the RMIAdaptor is a stub that
          talks back to the server via RMI.

          I guess your remote client cannot make an RMI connection
          back to the server.

          You could deploy an EJBAdaptor cofigured with a
          HTTPInvoker in jboss.xml (JBoss3.2 will make this
          config much easier.)

          Regards,
          Adrian

          • 2. Re: jboss-3.0.2 HTTP to JMX invoker  - external client probl
            Jaime Torres C. Newbie

            Hello: Adrian and every body.

            I deployed an EJBAdaptor configured as follows but still the remote client crashes doing any InitialContext.lookup.

            May be the server does not allow RMI permission to remote clients by default, and do we have to set them up ?. and how is it?

            Or only some well defined Beans are available to the remote clients, how do we identify them from the jmx-console?

            Or did I do the wrong deployment ?

            We appreciate very much any help.

            Jaime Torres C.


            <?xml version="1.0" encoding="UTF-8"?>
            <!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS 2.4//EN" "http://www.jboss.org/j2ee/dtd/jboss_2_4.dtd">
            <!-- ===================================================================== -->
            <!-- -->
            <!-- jboss.xml inside -->
            <!-- ${server}/deploy/jmx-ejb-adaptor.jar/META-INF/jboss.xml --> -->
            <!-- -->
            <!-- ===================================================================== -->



            <enterprise-beans>


            <ejb-name>jmx/ejb/Adaptor</ejb-name>
            <configuration-name>HTTP Stateless SessionBean</configuration-name>
            <jndi-name>ejb/jmx/ejb/AdaptorHttp</jndi-name>
            <local-jndi-name>jmx/ejb/AdaptorLocal</local-jndi-name>


            </enterprise-beans>

            <resource-managers>
            </resource-managers>






            <?xml version = "1.0" encoding = "UTF-8"?>

            <!-- ===================================================================== -->
            <!-- -->
            <!-- Standard JBoss Configuration -->
            <!-- -->
            <!-- ===================================================================== -->

            <!-- $Id: standardjboss.xml,v 1.37.2.6 2002/07/14 18:28:42 starksm Exp $ -->

            <enforce-ejb-restrictions>false</enforce-ejb-restrictions>
            ..........
            ..........
            ..........

            <container-configuration extends="Standard Stateless SessionBean">
            <container-name>HTTP Stateless SessionBean</container-name>
            <home-invoker>jboss:service=invoker,type=http</home-invoker>
            <bean-invoker>jboss:service=invoker,type=http</bean-invoker>
            </container-configuration>

            </container-configurations>