File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/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


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
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
     
     
    subject: ClassCastException: java.naming.Reference can not be cast to Ejb
     
    Similar Threads
    Can't run first Session Bean : NameNotFoundException
    Failed to connect to server localhost:1099, RemoteAccessException, SocketException
    javax.naming.Reference cannot be cast to org.omg.CORBA.Object
    EJB Standalone Client Remote Lookup Problem
    Pass security context to JBoss