7 Replies Latest reply on Jul 25, 2013 1:27 PM by jamesviet

    org.jboss.invocation.Invocation in Jboss 7

    jamesviet

      Hi all,

       

      In Jboss 5, org.jboss.invocation.Invocation class packaged in jboss-as-server-5.1.0.GA-client.jar

       

      But when I moved to Jboss 7.1.1, I could not find it in any package of Jboss 7.1.1.

       

      Could you please let me know where is org.jboss.invocation.Invocation class in Jboss 7.1.1?

       

      Thanks,

        • 1. Re: org.jboss.invocation.Invocation in Jboss 7
          jaikiran

          Although a same named class exists in AS7, it's not meant as a copy of the earlier version. Why do you need that class?

          • 2. Re: org.jboss.invocation.Invocation in Jboss 7
            jamesviet

            Hi jaikiran,

             

             

            In Jboss 5, I compile successfully with org.jboss.invocation.Invocation class.

             

            But when I move to Jboss 7, I met compile failure.

             

            Do you know the package contains this class?

             

             

            Thanks,

            • 3. Re: org.jboss.invocation.Invocation in Jboss 7
              jaikiran

              Can you tell us how and why you are using that class? Like I said, the AS7 one isn't meant to be the same as the AS5 one and in fact, when I checked yesterday it didn't have public visibility. It's just that it's named the same.

              • 4. Re: org.jboss.invocation.Invocation in Jboss 7
                jamesviet

                Hi jaikiran,

                 

                Here is my class:

                 

                package test;

                 

                import java.net.DatagramSocket;

                import java.net.InetAddress;

                import java.net.SocketException;

                import java.net.UnknownHostException;

                 

                import org.jboss.invocation.Invocation;

                import org.jboss.invocation.InvocationKey;

                import org.jboss.invocation.jrmp.interfaces.JRMPInvokerProxy;

                import org.jboss.proxy.Interceptor;

                import org.jboss.util.id.ID;

                 

                public class ClientInterceptor extends Interceptor {

                 

                    /**

                     *

                     */

                    private static final long serialVersionUID = 1L;

                 

                    private String cachedAddress;

                 

                    public ClientInterceptor() {

                        super();

                    }

                 

                    private synchronized String getClientIPAddress(Invocation invocation) {

                        if (cachedAddress == null) {

                            try {

                                // make sure we get the ip address to talk to the server

                                JRMPInvokerProxy proxy = (JRMPInvokerProxy) invocation.getInvocationContext().context.get(InvocationKey.INVOKER);

                 

                                // something this is a name which is only known at the server

                                // side

                                String serverHostName = proxy.getServerHostName();

                 

                                if (isServerSide()) {

                                    cachedAddress = InetAddress.getLocalHost().getHostAddress();

                                } else {

                                   cachedAddress = getAddressToReachServer(InetAddress.getByName(serverHostName)).getHostAddress();

                                }

                            } catch (Exception e) {

                              //

                            }

                        }

                        return cachedAddress;

                    }

                }

                 

                I think it may be moved to another package.

                • 5. Re: org.jboss.invocation.Invocation in Jboss 7
                  jaikiran

                  That interceptor isn't going to work in AS7. AS7 is a completely different code base. I don't know where you are using that interceptor but it looks like you are looking for the server's address in that interceptor? What exactly are you doing in there and what do you need it for? Maybe we might have a different way of doing it in AS7 or maybe you won't need it in AS7.

                  • 6. Re: org.jboss.invocation.Invocation in Jboss 7
                    jamesviet

                    Hi,

                     

                    In JBoss 5, if you want to get information from client (ex: host ip, user name, pass word) in server, you must use JRMPInvokerProxy. JRMPInvokerProxy got from org.jboss.invocation.Invocation

                     

                    Ex:

                    JRMPInvokerProxy proxy = (JRMPInvokerProxy) invocation.getInvocationContext().context.get(InvocationKey.INVOKER);

                    // something this is a name which is only known at the server side

                    String serverHostName = proxy.getServerHostName();

                     

                    How about JBoss 7, do we have way to do that?

                     

                    Thank very much.

                    • 7. Re: org.jboss.invocation.Invocation in Jboss 7
                      jamesviet

                      Someone can help me?