aspose file tools*
The moose likes EJB and other Java EE Technologies and the fly likes ClassCastException: java.naming.Reference can not be cast to Ejb Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "ClassCastException: java.naming.Reference can not be cast to Ejb" Watch "ClassCastException: java.naming.Reference can not be cast to Ejb" New topic
Author

ClassCastException: java.naming.Reference can not be cast to Ejb

Vish Shukla
Ranch Hand

Joined: Oct 12, 2008
Posts: 111
Hi,

I am using JBoss as EJB container and my web application is deployed in the Tomcat in same machine. I am trying to call remote stateless session bean method. But context.lookup("") returns object of type java.naming.Reference rather than business interface. I think something is going horribly wrong here. Please help what can be the possible issue?

In one of the forum I read that it may be because of unnecessary jars present in the classpath. I am having following jars in the class path.
  • jboss-logging-spi.jar
  • jnp-client.jar
  • jbossall-client.jar


  • I also tried by removing jnp-client.jar but in vain. Here is my client code.



    Thanks in advance.


    Thanks & Regards,
    Vishal S Shukla (SCJP 93%, SCWCD 94%, SCBCD 100%)
    Vish Shukla
    Ranch Hand

    Joined: Oct 12, 2008
    Posts: 111
    Hello all,

    Got this issue solved. This helped me.
    http://www.coderanch.com/t/454071/EJB-Certification-SCBCD/certification/javax-naming-Reference-cannot-cast#2022716
     
    With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
     
    subject: ClassCastException: java.naming.Reference can not be cast to Ejb