Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Exception at client side EJB program

 
Deepa Raghuraman
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I am new to JNDI. I am working on EJB stateless session.
I am using J2EE as EJB Server. When i try to run the client side program in different machime
it gives me the following exception :
javax.naming.CommunicationException: Request: 1 cancelled
at com.sun.jndi.ldap.LdapRequest.getReplyBer(LdapRequest.java:47)
at com.sun.jndi.ldap.Connection.readReply(Connection.java:396)
at com.sun.jndi.ldap.LdapClient.ldapBind(LdapClient.java:315)
at com.sun.jndi.ldap.LdapClient.authenticate(LdapClient.java:146)
at com.sun.jndi.ldap.LdapCtx.connect(LdapCtx.java:2516)
at com.sun.jndi.ldap.LdapCtx.<init>(LdapCtx.java:263)
at com.sun.jndi.ldap.LdapCtxFactory.getInitialContext(LdapCtxFactory.java:76)
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:62)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:24)
at javax.naming.InitialContext.init(InitialContext.java:219)
at javax.naming.InitialContext.<init>(InitialContext.java:195)
at HelloClient.main(HelloClient.java:40)


But if i run it in same machine where the J2EE server is, it works fine.
This exception is raise when i create an instance of Context class.

I am setting the initial context factory to com.sun.jndi.ldap.LdapCtxFactory and
provide url to ldap://mymachinename ort as follows :

/*
* Get System properties for ?JNDI initialisation
*/
Properties props = System.getProperties();

/*
* Set the inital context factory
*/
props.put(Context.INITIAL_CONTEXT_FACTORY,"com.sun.jndi.ldap.LdapCtxFactory");

/*
* Set the provider url
*/
props.put(Context.PROVIDER_URL,"ldap://itws2:1050");
/*
* Form an initial context
*/
Context ctx = new InitialContext(props);

Can anyone help me it is urgent

regards,
Deepa Raghuraman
 
Rufus BugleWeed
Ranch Hand
Posts: 1551
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What version of the JRE are you running on the
client?
Have you loaded directory information into the
client's LDAP service?
[ June 04, 2002: Message edited by: Rufus Bugleweed ]
 
Deepa Raghuraman
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I got the solution. Iam using jdk1.4 and j2ee1.3.1. I changed the initial context factory to com.sun.jndi.cosnaming.CNCtxFactory and protocol to iiop. It works for Session bean.
But I have one more problem. Now i am trying out Entity bean for which database is needed. I am using the existing one(Cloudscape) in J2ee.
Now i need to use Entity bean in client, do i need to connect to database and then do lookup.
and what does "java:comp/env/jdbc/Cloudscape" means?
Please help me. I need it urgently
regards,
Deepa Raghuraman
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic