3 Replies Latest reply on Dec 13, 2002 6:37 PM by Adrian Brock

    Using Anonymous class as argument to SSB

    Mark Johnson Newbie

      I have a stateless session bean that has a single method that takes two interfaces as parameters.

      I am trying to call the method from a separate VM. The class calling the SSB creates two anonymous inner classes as the parameters for the SSB.

      When the server receives the message from the client, it throws a class not found exception on the arguments, It is looking for the inner class, as evidenced by the $ notation in the exception message.

      Shouldn't I be able to call the SSB using any parameters that conform to the interfaces? It doesn't seem right that the server would have to have access to the classpath of the client, and in most cases, it would be impossible.

      Can someone give me some pointers on how to fix this?

      Thanks,

      --Mark J.

        • 1. Re: Using Anonymous class as argument to SSB
          Adrian Brock Master

          The server needs some code to execute, it can't
          run an interface.

          You could pass a remote object that calls back on the
          client, but is that what you really want to do?

          Regards,
          Adrian

          • 2. Re: Using Anonymous class as argument to SSB
            Mark Johnson Newbie

            I'll expand a bit from my first question about the class being anonymous. That appears to be irrelevant. I made the anonymous class a named inner class and still got the same issue.... hmm, wonder if I make it a regular non-inner class this may work... I'll try that, but anyway....

            I know that the server cannot execute an interface, but the I thought the client would send across the bytecodes the server would need to operate on the object.

            However, i can see a huge security hole by doing that!

            Let me see if I can explain what I am trying to do.

            I have a Stateless Session Bean in my application that takes an argument (actually 2, but I'll simplify it for example), that is a interface. This method is called both from my application, running on JBoss, and from an ANT task, obviously running in a seperate VM.

            The J2EE application has its own object that implements the interface and passes it to the SSB. Same goes with the ANT task.

            However, the actual object .class file is only in the SSB's classpath in the first case, where my application calls it. The ANT task is in a completely seperate classpath, and the .class file is inaccessible to JBoss.

            Can I export the bytecode to the SSB somehow without adding the classpath of the ANT task?

            Or am I missing something fundamentally easy? I hope thats the case :)

            --Mark

            • 3. Re: Using Anonymous class as argument to SSB
              Adrian Brock Master

              You might want to investigate "codebase"
              in the RMI specification.

              Regards,
              Adrian