[jboss-dev] Howto debug jndi lookup issues?

Andrew Lee Rubinger andrew.rubinger at redhat.com
Mon Dec 7 12:55:06 EST 2009


Yep, catch CCE and grab the factory class name from the Reference:

http://java.sun.com/javase/6/docs/api/javax/naming/Reference.html#getFactoryClassName()

...then rethrow something that's more informative to the user.

S,
ALR

On 12/07/2009 12:09 PM, Thomas Diesler wrote:
> Still, is there a way to know what class is missing exactly?
>
> On 12/07/2009 05:29 PM, Thomas Diesler wrote:
>> Folks,
>>
>> java.lang.ClassCastException: javax.naming.Reference cannot be cast to
>> org.jboss.test.osgi.jbosgi58.ejb.StatelessBean
>>        at
>> org.jboss.test.osgi.jbosgi58.OSGI58TestCase.testEJB(OSGI58TestCase.java:54)
>>
>> a JNDI client lookup may fail for various reasons . AFAIK, the above CCE
>> happens because there is some calss missing on the client classpath.
>> JNDI gives up internally and simply returns the reference.
>>
>> To solve the problem I could do
>>
>> <dependency>
>> <groupId>org.jboss.jbossas</groupId>
>> <artifactId>jboss-as-client</artifactId>
>> <version>6.0.0.M1</version>
>> <type>pom</type>
>> </dependency>
>>
>> but this gives me an insanely big dependency tree
>> (http://pastebin.com/m3776fc85). I'd much rather find out, what exactly
>> is missing and use a client that contains just that.
>>
>> Is there a way to debug these kind of JNDI client issues?
>>
>> cheers
>> -thomas
>>
>>
>

-- 
Andrew Lee Rubinger
Sr. Software Engineer
JBoss by Red Hat
http://exitcondition.alrubinger.com
http://twitter.com/ALRubinger



More information about the jboss-development mailing list