• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Rob Spoor
  • Bear Bibeault
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:
  • Frits Walraven
  • Himai Minh

NamingException: Could not dereference object - EJB 3.0 workbook ex05-2

 
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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:



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
 
Jack Bush
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

I managed to overcome this issue with the following syntax when using Sun System Java Application Server PE 9.0:



The Client output from Netbeans is:

no cabin should be null: null
Master Suite
1
1
3
Updating detached cabin instance with new bed count of 4
Finding cabin to see it has been updated with a merge() on server
new bed count is: 4
Set up transaction persistence context stateful bean
Cabin bed count will still be 4: 4
Set up extended persistence context stateful bean
Cabin bed count will be 5: 5

However, I still could not find a solution when running in JBoss AS 4.0.5.

Thanks,

Henry
 
Jack Bush
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All,

Could someone please help me with this issue on the JBoss platform?

I still could not identify what the problem for so many weeks.

Thanks,

Henry
 
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You are having problems looking up the TransactionPersistenceContextBean/remote and the other bean on JBoss? Can you post the code for this bean? Especially the annotations on each of these beans.
 
Jack Bush
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,

Here are the codes as requested:













I did not have any problem running them using SJAS PE 9.0 by modifying the JNDI lookup to use "travelagent.TransactionPersistenceContextRemote" as opposed to "TransactionPersistenceContextBean/remote".

The Client code looks like this:





The main() method in amy1client runs first to setup the Cabin table prior to running amy2client.

Here is the detail on JMX-Console:

jboss.j2ee
jar=amy.jar,name=ExtendedPersistenceContextBean,service=EJB3
jar=amy.jar,name=TransactionPersistenceContextBean,service=EJB3
jar=amy.jar,name=TravelAgentBean,service=EJB3
module=amy.jar,service=EJB3

Jndi View
ExtendedPersistenceContextBean (class: org.jnp.interfaces.NamingContext)
| +- remote (class: java.lang.Object)
| +- remoteStatefulProxyFactory (proxy: $Proxy74 implements interface org.jboss.ejb3.ProxyFactory)
+- JBossClient (class: org.jnp.interfaces.NamingContext)
+- UILXAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
+- UIL2XAConnectionFactory[link -> XAConnectionFactory] (class: javax.naming.LinkRef)
+- queue (class: org.jnp.interfaces.NamingContext)
| +- A (class: org.jboss.mq.SpyQueue)
| +- testQueue (class: org.jboss.mq.SpyQueue)
| +- ex (class: org.jboss.mq.SpyQueue)
| +- DLQ (class: org.jboss.mq.SpyQueue)
| +- D (class: org.jboss.mq.SpyQueue)
| +- C (class: org.jboss.mq.SpyQueue)
| +- B (class: org.jboss.mq.SpyQueue)
+- topic (class: org.jnp.interfaces.NamingContext)
| +- testDurableTopic (class: org.jboss.mq.SpyTopic)
| +- testTopic (class: org.jboss.mq.SpyTopic)
| +- securedTopic (class: org.jboss.mq.SpyTopic)
+- amy2-Client (class: org.jnp.interfaces.NamingContext)
+- console (class: org.jnp.interfaces.NamingContext)
| +- PluginManager (proxy: $Proxy46 implements interface org.jboss.console.manager.PluginManagerMBean)
+- UIL2ConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
+- HiLoKeyGeneratorFactory (class: org.jboss.ejb.plugins.keygenerator.hilo.HiLoKeyGeneratorFactory)
+- TravelAgentBean (class: org.jnp.interfaces.NamingContext)
| +- remote (proxy: $Proxy88 implements interface travelagent.TravelAgentRemote,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBObject)
+- UILConnectionFactory[link -> ConnectionFactory] (class: javax.naming.LinkRef)
+- TransactionPersistenceContextBean (class: org.jnp.interfaces.NamingContext)
| +- remote (class: java.lang.Object)
| +- remoteStatefulProxyFactory (proxy: $Proxy74 implements interface org.jboss.ejb3.ProxyFactory)

I have been trying to setup these beans to run as local just to see whether it make any difference. However, it has been slow since I am still learning to ropes of EJB 3.0 Session Beans.

Thanks again,

Henry
 
Jaikiran Pai
Sheriff
Posts: 10445
227
IntelliJ IDE Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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



Hmmmm.... I shouldn't have ignored this earlier Looks like this is an issue with JDK1.6 with JBoss. Here's a similar issue. The solution for this appears to be to use JDK5 instead of JDK6
 
Jack Bush
Ranch Hand
Posts: 235
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Jaikiran,

The recommendation from http://jboss.com/index.html?module=bb&op=viewtopic&t=98072&view=previous was correct.

By only running the Client program (EJB3ex512-Client)using SDK 1.5 solved this issue.

All session beans and other clients are still using SDK 1.6 without a problem.

Thanks again,

Henry
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic