8 Replies Latest reply on May 20, 2003 9:24 AM by Adrian Brock

    Remote NotificationFilter with RMIConnector...

    janny77 Newbie

      Hi all,

      I'm a newbie and I'm using JBoss 3.2.1.
      I have a problem with RMIConnector and the remote notification mechanism. I successfully instantiate a RemoteMBeanServer and added a listener to a remote MBean without using any filter (null in addNotificationListener statement), all works fine and I rightly catch all notifications. But when I try to use a personalized filter I encounter in this exception:

      ////////////////////////////////////////////////////////////
      RuntimeMBeanException: null
      Cause: org.jboss.util.NestedRuntimeException: error marshalling arguments; nested exception is:
      java.io.NotSerializableException: org.jboss.jmx.connector.TestClient; - nested throwable: (java.rmi.MarshalException: error marshalling arguments; nested exception is:
      java.io.NotSerializableException: org.jboss.jmx.connector.TestClient)
      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.addNotificationListener(RMIConnectorImpl.java:431)
      at org.jboss.jmx.connector.notification.ClientNotificationListener.addNotificationListener(ClientNotificationListener.java:95)
      at org.jboss.jmx.connector.notification.RMIClientNotificationListener.(RMIClientNotificationListener.java:54)
      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.addNotificationListener(RMIConnectorImpl.java:445)
      at org.jboss.jmx.connector.TestClient.run(TestClient.java:136)
      at org.jboss.jmx.connector.TestClient.main(TestClient.java:65)
      ///////////////////////////////////////////////////////////

      I used an inline declaration for the filter:

      lConnector.addNotificationListener(
      myXMBean,
      listener,
      new NotificationFilter(){
      public boolean isNotificationEnabled(Notification notification) {
      return true;
      }
      },
      myXMBean
      );

      I also try to use an explicit external class implementing the filter logic:

      class InternalFilter implements NotificationFilter{
      public InternalFilter(){}

      public boolean isNotificationEnabled(Notification notification) {
      return true;
      }
      }

      ...
      ...

      lConnector.addNotificationListener(myXMBean,listener,new InternalFilter(),myXMBean);

      with a different result...

      ////////////////////////////////////////////////////////////
      RuntimeMBeanException: null
      Cause: org.jboss.util.NestedRuntimeException: RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.lang.ClassNotFoundException: org.jboss.jmx.connector.InternalFilter (no security manager: RMI class loader disabled); - nested throwable: (java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
      java.lang.ClassNotFoundException: org.jboss.jmx.connector.InternalFilter (no security manager: RMI class loader disabled))
      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.addNotificationListener(RMIConnectorImpl.java:431)
      at org.jboss.jmx.connector.notification.ClientNotificationListener.addNotificationListener(ClientNotificationListener.java:95)
      at org.jboss.jmx.connector.notification.RMIClientNotificationListener.(RMIClientNotificationListener.java:54)
      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.addNotificationListener(RMIConnectorImpl.java:445)
      at org.jboss.jmx.connector.TestClient.run(TestClient.java:146)
      at org.jboss.jmx.connector.TestClient.main(TestClient.java:65)
      ////////////////////////////////////////////////////////////

      What's wrong???
      I known that many improvements will be made in JBoss 4.0 in remoting, but at the moment I need to stay with 3.2!

      Thanks

        • 1. Re: Remote NotificationFilter with RMIConnector...
          Adrian Brock Master

          NotificationFilter does not implement Serializable.

          You'll have to create a Filter class that implements
          both NotificationFilter and Serializable.

          Regards,
          Adrian

          • 2. Re: Remote NotificationFilter with RMIConnector...
            janny77 Newbie

            Thanks Adrian,
            but NotificationFilter class already extends Serializable. However, I've tried to explicitly implements Serializable in my filter class but the result is the same (adding also a default, no parameter constructor)...

            IMHO there is a problem with the security manager, but I'm not skilled in RMI architecture!

            Bye,

            Gianni

            • 3. Re: Remote NotificationFilter with RMIConnector...
              Adrian Brock Master

              It is actually complaining about the outer class
              not being serializable.

              Regards,
              Adrian

              • 4. Re: Remote NotificationFilter with RMIConnector...
                janny77 Newbie

                Sorry Adrian, I cannot see your last reply in this thread...

                • 5. Re: Remote NotificationFilter with RMIConnector...
                  janny77 Newbie

                  I don't understand what you mean with "outer class not being serializable". I've just tried to serialize my filter class into a file without problems, so seems to be serializable. Is there something wrong with RMI and JBoss 3.2.1 security settings??

                  • 6. Re: Remote NotificationFilter with RMIConnector...
                    Adrian Brock Master

                    RMI is trying to serialize this class

                    java.io.NotSerializableException: org.jboss.jmx.connector.TestClient

                    Regards,
                    Adrian

                    • 7. Re: Remote NotificationFilter with RMIConnector...
                      janny77 Newbie

                      I moved the filter class in a distinct file:

                      public class InternalFilter implements NotificationFilter extends Serializable {
                      public InternalFilter() {
                      }

                      public boolean isNotificationEnabled(Notification notification) {

                      return true;
                      }

                      }

                      ..but the problem is still the same!

                      /////////////////////////
                      RuntimeMBeanException: null
                      Cause: org.jboss.util.NestedRuntimeException: RemoteException occurred in server thread; nested exception is:
                      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
                      java.lang.ClassNotFoundException: com.esempio.InternalFilter (no security manager: RMI class loader disabled); - nested throwable: (java.rmi.ServerException: RemoteException occurred in server thread; nested exception is:
                      java.rmi.UnmarshalException: error unmarshalling arguments; nested exception is:
                      java.lang.ClassNotFoundException: com.esempio.InternalFilter (no security manager: RMI class loader disabled))
                      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.addNotificationListener(RMIConnectorImpl.java:431)
                      at org.jboss.jmx.connector.notification.ClientNotificationListener.addNotificationListener(ClientNotificationListener.java:95)
                      at org.jboss.jmx.connector.notification.RMIClientNotificationListener.(RMIClientNotificationListener.java:54)
                      at org.jboss.jmx.connector.rmi.RMIConnectorImpl.addNotificationListener(RMIConnectorImpl.java:445)
                      at com.esempio.TestClient.run(TestClient.java:184)
                      at com.esempio.TestClient.main(TestClient.java:73)
                      ///////////////////////////

                      I think that JBoss is not able to load my Remote filter class because it can't use RMI ClassLoader. I suspect that the Security Manager is the responsible!

                      • 8. Re: Remote NotificationFilter with RMIConnector...
                        Adrian Brock Master

                        You need to add your filter class to the server.

                        Regards,
                        Adrian