JBoss Community

Re: Custom jdbc login module for remoting

created by Daniel Jipa in JBoss AS 7 Development - View the full discussion

This is the way I call the test method from EJB:

 

public class Jndi {

          public static void main(String[] args) throws NamingException,

                              AppException, RemoteException {

                    final Hashtable jndiProperties = new Hashtable();

 

 

                    jndiProperties.put(Context.URL_PKG_PREFIXES,

                                        "org.jboss.ejb.client.naming");

                     jndiProperties.put(Context.INITIAL_CONTEXT_FACTORY,

                     "org.jboss.naming.remote.client.InitialContextFactory");

                     jndiProperties.put(Context.PROVIDER_URL, "remote://localhost:4447");

                     jndiProperties.put(Context.SECURITY_PRINCIPAL, "capone");

                     jndiProperties.put(Context.SECURITY_CREDENTIALS, "1234564");

                     jndiProperties.put("jboss.naming.client.ejb.context", true);

                    

                    final Context context = new InitialContext(jndiProperties);

                    final String appName = "capone";

                    final String moduleName = "capone-EJB";

                    final String distinctName = "";

                    final String beanName = "TestControllerBean";

                    final String viewClassName = TestControllerRemote.class.getName();

                    String lookup = "ejb:" + appName + "/" + moduleName + "/"

                                        + distinctName + "/" + beanName + "!" + viewClassName;

                    System.out.println("lookup name: " + lookup);

                    TestController facade = (TestController) context.lookup(lookup);

                    System.out.println(facade);

                    System.out.println("test: " + facade.testMessage("hello"));

 

 

          }

}

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community