Hi Everyone,

I have stucked on workbook ex05_2 that makes comparison between using the same 
entity bean in TransactionPersistenceContext & ExtendedPersistenceContext. 
Anyhow, the following error occurred when trying to access either of these 
contexts:

javax.naming.NamingException: Could not dereference object [Root exception is 
java.lang.reflect.UndeclaredThrowableException]
        at 
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1150)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:705)
        at org.jnp.interfaces.NamingContext.lookup(NamingContext.java:587)
        at javax.naming.InitialContext.lookup(InitialContext.java:392)
        at client.Main.main(Main.java:33)
Caused by: java.lang.reflect.UndeclaredThrowableException
        at $Proxy1.createProxy(Unknown Source)
        at 
org.jboss.ejb3.JndiProxyFactory.getObjectInstance(JndiProxyFactory.java:52)
        at 
javax.naming.spi.NamingManager.getObjectInstance(NamingManager.java:304)
        at 
org.jnp.interfaces.NamingContext.getObjectInstance(NamingContext.java:1125)
        at 
org.jnp.interfaces.NamingContext.getObjectInstanceWrapFailure(NamingContext.java:1142)
        ... 4 more

This message make sense considering the jndi listing as follows:

  +- ExtendedPersistenceContextBean (class: org.jnp.interfaces.NamingContext)
  |   +- remote (class: java.lang.Object)
  |   +- remoteStatefulProxyFactory (proxy: $Proxy76 implements interface 
org.jboss.ejb3.ProxyFactory)
  +- TravelAgentBean (class: org.jnp.interfaces.NamingContext)
  |   +- remote (proxy: $Proxy81 implements interface 
travelagent.TravelAgentRemote,interface org.jboss.ejb3.JBossProxy,interface 
javax.ejb.EJBObject)
  +- TransactionPersistenceContextBean (class: org.jnp.interfaces.NamingContext)
  |   +- remote (class: java.lang.Object)
  |   +- remoteStatefulProxyFactory (proxy: $Proxy76 implements interface 
org.jboss.ejb3.ProxyFactory)

 To call TravelAgentRemote interface, use 
jndiContext.lookup("TravelAgentBean/remote"). However, it appears that
 I would not get anything by calling either 
jndiContext.lookup("TransactionPersistenceContextBean/remote") or 
jndiContext.lookup("ExtendedPersistenceContextBean/remote") according to the 
above jndi table.

The client code are as follows:

try 
  |     {
  |             Context jndiContext = getInitialContext();
  |             Object ref = jndiContext.lookup("TravelAgentBean/remote");
  |             TravelAgentRemote dao = (TravelAgentRemote)ref;
  | 
  |             ref = 
jndiContext.lookup("TransactionPersistenceContextBean/remote");
  |             TransactionPersistenceContextRemote txBean = 
(TransactionPersistenceContextRemote)ref;
  | 
  |         Cabin fetchedCabin = dao.findCabin(1);
  |             int oldBedCount = fetchedCabin.getBedCount();
  | 
  |         System.out.println("Set up transaction persistence context stateful 
bean");
  |         txBean.setCabin(1);
  |         txBean.updateBedCount(5);
  | 
  |             ref = 
jndiContext.lookup("ExtendedPersistenceContextBean/remote");
  |             ExtendedPersistenceContextRemote extendedBean = 
(ExtendedPersistenceContextRemote)ref;
  | 
  |                 extendedBean.setCabin(1);
  |         extendedBean.updateBedCount(5);
  | ....
This exercise does not work as delivered on the command prompt.

I am running Netbeans 5.5, JBoss 4.0.5GA & JDK1.6.0 on Windows XP platform.

The workbook is from EJB 3.0 by Bill Burke.

Any assistance would be greatly appreciated.

Thanks,

Henry


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

Reply to the post : 
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4016737
_______________________________________________
jboss-user mailing list
jboss-user@lists.jboss.org
https://lists.jboss.org/mailman/listinfo/jboss-user

Reply via email to