[jboss-user] [JNDI/Naming/Network] - Exception javax.naming.NameNotFoundException

ganesh.pol do-not-reply at jboss.com
Mon May 21 10:42:21 EDT 2007


I am new to EJB and trying on EJB sample application in 
EJB 2.0
JBOSS Server 4.0.1


______________________________________________________________
my  code for getting remote object is

public IUserSessionEJBObject getUserRemoteObject(String jndiName){
		System.out.println("looking for JNDI name "+jndiName);
		InitialContext context=null;
		Object obj=null;
		IUserSessionEJBObject userRemoteObject=null;
		IUserSessionEJBHome userSessionEJBHome=null;
		
		try{
			 context= new InitialContext();
			 obj=context.lookup(jndiName);
			 userSessionEJBHome=(IUserSessionEJBHome)PortableRemoteObject.narrow(obj,IUserSessionEJBHome.class);
			 System.out.println("USer EJB HOME Object"+userSessionEJBHome);
		}catch(NamingException namingEx){
			System.err.println("naming Exception occured");
			namingEx.printStackTrace();
		}
		try{
			userRemoteObject=userSessionEJBHome.create();
		}catch(CreateException creEx){
			System.err.println("create Exception occured");
			creEx.printStackTrace();
		}catch(RemoteException reEx){
			System.err.println("Remote Ex occured");
			reEx.printStackTrace();
		}
		 System.out.println("USer EJB HOME Object"+userSessionEJBHome);
		
		return userRemoteObject;
	}

________________________________________________________
ejb-jar.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>

   mfsc
   <display-name>mfsc</display-name>

   <enterprise-beans>

      <!-- Session Beans -->
      
         <display-name>UserSession</display-name>
         <ejb-name>UserSession</ejb-name>
         com.pspl.common.admin.user.components.IUserSessionEJBHome
         com.pspl.common.admin.user.components.IUserSessionEJBObject
         <ejb-class>com.pspl.common.admin.user.components.UserSessionBean</ejb-class>
         <session-type>Stateless</session-type>
         <transaction-type>Container</transaction-type>
      

   </enterprise-beans>

   <assembly-descriptor>

   </assembly-descriptor>

</ejb-jar>
_____________________________________________________________
jboss.xml

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE jboss PUBLIC "-//JBoss//DTD JBOSS//EN" "http://www.jboss.org/j2ee/dtd/jboss.dtd">



   <enterprise-beans>

      
         <ejb-name>UserSession</ejb-name>
         <jndi-name>ejb/UserSession</jndi-name>
      

   </enterprise-beans>

   <resource-managers>
   </resource-managers>


_______________________________________________________

but i got following Exception

19:29:13,120 INFO  [STDOUT] looking for JNDI name ejb/UserSession
19:29:13,135 INFO  [STDOUT] naming Exception occured
19:29:13,135 INFO  [STDOUT] javax.naming.NameNotFoundException: UserSession not bound
19:29:13,135 INFO  [STDOUT]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:491)
19:29:13,135 INFO  [STDOUT]     at org.jnp.server.NamingServer.getBinding(NamingServer.java:499)
19:29:13,135 INFO  [STDOUT]     at org.jnp.server.NamingServer.getObject(NamingServer.java:505)
19:29:13,135 INFO  [STDOUT]     at org.jnp.server.NamingServer.lookup(NamingServer.java:278)
19:29:13,135 INFO  [STDOUT]     at org.jnp.server.NamingServer.lookup(NamingServer.java:252)
19:29:13,135 INFO  [STDOUT]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:544)
19:29:13,135 INFO  [STDOUT]     at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:520)
19:29:13,135 INFO  [STDOUT]     at javax.naming.InitialContext.lookup(InitialContext.java:351)
19:29:13,135 INFO  [STDOUT]     at com.pspl.common.delegate.CommonDelegate.getUserRemoteObject(CommonDelegate.java:46)


I am not getting where i did mistake????

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4047262#4047262

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4047262



More information about the jboss-user mailing list