dayse rivera [https://community.jboss.org/people/dayserivera] created the discussion
"Re: Problems with JBoss 7 and remote-interface lookup with context" To view the discussion, visit: https://community.jboss.org/message/756260#756260 -------------------------------------------------------------- I'm facing the same problem. I'm developing my first ejb 3 client on jboss 7.1. But, I can't make a lookup. After EJB deploy the following message is shown on console: *11:48:33,718 INFO [org.jboss.as.ejb3.deployment.processors.EjbJndiBindingsDeploymentUnitProcessor] (MSC service thread 1- http://www.guj.com.br/images/smilies/b2eb59423fbf5fa39342041237025880.gif (http://www.guj.com.br/images/smilies/b2eb59423fbf5fa39342041237025880.gif) JNDI bindings for session bean named CalculatorBean in deployment unit subdeployment "EJB3_Chap02.jar" of deployment "TesteEar.ear" are as follows: java:global/TesteEar/EJB3_Chap02/CalculatorBean!calc.CalculatorRemote java:app/EJB3_Chap02/CalculatorBean!calc.CalculatorRemote java:module/CalculatorBean!calc.CalculatorRemote java:jboss/exported/TesteEar/EJB3_Chap02/CalculatorBean!calc.CalculatorRemote java:global/TesteEar/EJB3_Chap02/CalculatorBean java:app/EJB3_Chap02/CalculatorBean java:module/CalculatorBean* I try to lookup as follow, but it isn't work: *package calc.client; import java.util.Hashtable; import javax.naming.Context; import javax.naming.InitialContext; import javax.naming.NamingEnumeration; import javax.naming.NamingException; import calc.CalculatorRemote; public class CalculatorClient { private static CalculatorRemote remote; public static void main(String[] args) { try{ remote = lookupRemoteStatelessCalculator(); //context.lookup("EJB3_Chap02/" + CalculatorBean.class.getSimpleName() + "/remote"); System.out.println(remote.add(1, 1)); }catch (Exception e) { e.printStackTrace(); } } private static CalculatorRemote lookupRemoteStatelessCalculator() throws NamingException { 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://127.0.0.1:4447"); //jndiProperties.put("remote.connection.default.username","dayserivera"); //jndiProperties.put("remote.connection.default.password", "dayse"); jndiProperties.put(Context.SECURITY_PRINCIPAL, "dayserivera"); jndiProperties.put(Context.SECURITY_CREDENTIALS, "dayse"); /* jndiProperties.put("endpoint.name", "client-endpoint"); jndiProperties.put("remote.connectionprovider.create.options.org.xnio.Options.SSL_ENABLED", "false"); jndiProperties.put("remote.connections", "default"); jndiProperties.put("remote.connection.default.port", "4447"); jndiProperties.put("remote.connection.default.host", "localhost"); */ jndiProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_DISALLOWED_MECHANISMS", "JBOSS-LOCAL-USER"); jndiProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOANONYMOUS", "false"); jndiProperties.put("remote.connection.default.connect.options.org.xnio.Options.SASL_POLICY_NOPLAINTEXT", "false"); //jndiProperties.put("jboss.naming.client.ejb.context", true); final Context context = new InitialContext(jndiProperties); NamingEnumeration<?> namingEnum = context.list("java"); while(namingEnum.hasMoreElements()){ Object obj = namingEnum.nextElement(); System.out.println(obj); } System.out.println(context.lookup("ejb:TesteEar/EJB3_Chap02//CalculatorBean!calc.CalculatorRemote")); // The app name is the application name of the deployed EJBs. This is typically the ear name // without the .ear suffix. However, the application name could be overridden in the application.xml of the // EJB deployment on the server. // Since we haven't deployed the application as a .ear, the app name for us will be an empty string final String appName = ""; // This is the module name of the deployed EJBs on the server. This is typically the jar name of the // EJB deployment, without the .jar suffix, but can be overridden via the ejb-jar.xml // In this example, we have deployed the EJBs in a jboss-as-ejb-remote-app.jar, so the module name is // jboss-as-ejb-remote-app final String moduleName = "EJB3_Chap02"; // AS7 allows each deployment to have an (optional) distinct name. We haven't specified a distinct name for // our EJB deployment, so this is an empty string final String distinctName = ""; // The EJB name which by default is the simple class name of the bean implementation class //final String beanName = CalculatorBean.class.getSimpleName(); // the remote view fully qualified class name final String viewClassName = CalculatorRemote.class.getName(); // let's do the lookup //return (CalculatorRemote) context.lookup("ejb:" + appName + "/" + beanName); //return (CalculatorRemote) context.lookup("ejb:" + appName + "/" + moduleName + "/" + distinctName + "/" + beanName + "!" + viewClassName); return (CalculatorRemote) context.lookup("ejb:TesteEar/EJB3_Chap02//CalculatorBean!calc.CalculatorRemote"); } } * -------------------------------------------------------------- Reply to this message by going to Community [https://community.jboss.org/message/756260#756260] Start a new discussion in Beginner's Corner at Community [https://community.jboss.org/choose-container!input.jspa?contentType=1&containerType=14&container=2075]
_______________________________________________ jboss-user mailing list [email protected] https://lists.jboss.org/mailman/listinfo/jboss-user
