Java Mailing List Archive

http://www.junlu.com/

Home » Home (12/2007) » JBoss User »

[JBoss-user] [EJB 3.0] - Fail to try first example in "Enterprise
 JavaBean 3.0"

scott.stark@jboss.org

2006-07-07


Hi,

I am trying the first example in "Enterprise JavaBeans 3.0" / chapter 4 and for some reason I am keep getting the following error message: "TravelAgentBean not bound".


package titan.Clients;

import titan.travelagent.TravelAgentRemote;
import titan.domain.Cabin;

import javax.naming.InitialContext;
import javax.naming.Context;
import javax.naming.NamingException;
import java.util.Properties;
import javax.rmi.PortableRemoteObject;

public class Clients {
public static void main(String[] args) {
try{
Context jndiContext = getInitialContext();
Object ref = jndiContext.lookup("TravelAgentBean/remote");
TravelAgentRemote dao = (TravelAgentRemote) PortableRemoteObject.narrow(ref, TravelAgentRemote.class);

Cabin cabin_1 = new Cabin();
cabin_1.setId(1);
cabin_1.setName("Master Suite");
cabin_1.setDeckLevel(1);
cabin_1.setShipId(1);
cabin_1.setBedCount(3);

dao.createCabin(cabin_1);

Cabin cabin_2 = dao.findCabin(1);
System.out.println(cabin_2.getName());
System.out.println(cabin_2.getDeckLevel());
System.out.println(cabin_2.getShipId());
System.out.println(cabin_2.getBedCount());
}
catch(NamingException ne) {ne.printStackTrace();}
}

public static Context getInitialContext() throws NamingException {
Properties p = new Properties();
p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
p.put(Context.URL_PKG_PREFIXES,"org.jboss.naming:org.jnp.interfaces");
p.put(Context.PROVIDER_URL,"jnp://localhost:1099");
return new InitialContext(p);
}
}


Also, I would like to mention that when I run JBoss I see the following error message: "No ClassLoaders for titan.travelagent.TravelAgentBean"

Please Helpppppp....


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

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

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
JBoss-user mailing list
JBoss-user@(protected)
https://lists.sourceforge.net/lists/listinfo/jboss-user
©2008 junlu.com - Jax Systems, LLC, U.S.A.