aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes Exception at client side EJB program Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Exception at client side EJB program" Watch "Exception at client side EJB program" New topic
Author

Exception at client side EJB program

Deepa Raghuraman
Greenhorn

Joined: Nov 26, 2001
Posts: 13
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

Joined: Feb 22, 2002
Posts: 1551
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

Joined: Nov 26, 2001
Posts: 13
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
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Exception at client side EJB program