1 Reply Latest reply on Nov 21, 2012 11:16 AM by ansur

    Context Lookup and Reflection

    ansur

      At my company, we're currently into looking how we can migrate from JBoss 5.1 to JBoss 7.1.1

       

      We currently have different teams from different companies supplying their modules, so we make extensive usage of the AS.
      Because of all these different modules, we've created a small framework which gives us an overview of the different services (EJBs, MDBs, WebServices...) and with the possibility to execute some QA-related methods.

       

      To invoke methods on let's say an EJB, we'd look it up through the InitialContext and afterwards call something to the extent of:

       

      Proxy.getInvocationHandler(instance).invoke(instance, method, new Object[0]);
      

       

      Important to know is that the deployment doing the above, doesn't explicitly know about the other deployments inside the AS. We don't need to know, which is the whole reason for this feature in the first place. Also, depending on the customer some modules might be installed, some won't.

       

      Now with JBoss7 we're stumbling on some problems here.

      I can retrieve a handle with the EJB3 notation of "java:global/X/Y/Z", but the Proxy-invocation doesn't quite work since the returned object isn't a Proxy.

       

      Does Jboss7 supply a way of interacting with this returned object, which would allow me to do something to the extent of the Proxy/InvocationHandler call?

        • 1. Re: Context Lookup and Reflection
          ansur

          Some further investigation yields:

          using the jboss-specific "java:jboss/exported/..." lookup I'm actually able to get a Proxy instance, fetch the (interface) method and call it through the Proxy.getInvocationHandler(...).invoke(...).

           

          While I'm a nit disappointed to have to resolve to a jboss-specific lookup name I do consider this resolved.