JBoss Community

Re: Custom jdbc login module for remoting

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

No changes after adding the NO_PLAIN_TEXT to false.

I've attached a stripped down ear with the login module embedded in it and a standalone.xml configuration.

This is my client code:

 

 

public class JndiTest {
          public static void main(String[] args) throws NamingException,
                              AppException, RemoteException {
                    final Hashtable<String, Object> jndiProperties = new Hashtable<String, Object>();
 
 
                    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, "daniel");
                    jndiProperties.put(Context.SECURITY_CREDENTIALS,
                                        "c4ca4238a0b923820dcc509a6f75849b");
                    jndiProperties.put("jboss.naming.client.ejb.context", true);
                    jndiProperties
                                        .put("jboss.naming.client.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT",
                                                            false);
                    final Context context = new InitialContext(jndiProperties);
                    final String appName = "myear";
                    final String moduleName = "myejb3";
                    final String distinctName = "";
                    final String beanName = "CalculatorBean";
                    final String viewClassName = RemoteCalculator.class.getName();
                    String lookup = "ejb:" + appName + "/" + moduleName + "/"
                                        + distinctName + "/" + beanName + "!" + viewClassName;
                    System.out.println("lookup name: " + lookup);
                    RemoteCalculator facade = (RemoteCalculator) context.lookup(lookup);
                    System.out.println(facade);
                    System.out.println("test: " + facade.add(2, 2));
            }
}
 

Reply to this message by going to Community

Start a new discussion in JBoss AS 7 Development at Community