Hi Friends
I deployed the ejb jar file successfully in JBOSS app server. But when I run the client file (compiled successfully) displays the following exception :-
Exception in thread "main" javax.naming.NamingException: [LDAP: error code 15 - unknown directory attribute name]; remaining name 'HelloHome'
at com.sun.jndi.ldap.LdapCtx.mapErrorCode(LdapCtx.java:3087)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2931)
at com.sun.jndi.ldap.LdapCtx.processReturnCode(LdapCtx.java:2737)
at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:993)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup(ComponentContext.java:526)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:159)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:148)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
at HelloClientNew.main(HelloClientNew.java:17)
My HelloClient.java file code is :-
import examples.*;
import javax.naming.Context;
import javax.naming.InitialContext;
import java.util.Properties;
public class HelloClientNew
{
public static void main(String args[]) throws Exception
{
Properties env = new Properties();
env.setProperty("java.naming.factory.initial","com.sun.jndi.ldap.LdapCtxFactory");
env.setProperty("java.naming.provider.url","ldap://localhost:389");
env.setProperty("java.naming.factory.url.pkgs","org.jboss.naming");
Context ctx=new InitialContext(env);
Object obj=ctx.lookup("HelloHome");
HelloHome home=(HelloHome)javax.rmi.PortableRemoteObject.narrow(obj,HelloHome.class);
Hello hello=home.create();
System.out.println(hello.hello());
hello.remove();
}
}
The package "examples" contains the Hello,HelloHome,HelloLocal,HelloLocalHome and HelloBean source and class files
I tried a lot but still am stuck to this problem. If anybody can tell me the solution then I will be very thankful to him.
Thanks
Bhoopender
You are using the wrong properties to access JBoss JNDI.
Have a look at: -
http://wiki.jboss.org/wiki/Wiki.jsp?page=AccessEJBsRemotely