[jboss-user] [EJB 3.0] - WebApplication fails to lookup SessionBean

masoodah@mdsit.com do-not-reply at jboss.com
Tue Apr 1 10:05:08 EDT 2008


Hi,
 
I have an ear application that runs under jboss 4.2.0.GA version. I have implemented EJB3 session bean.
The AdSetSchedule Session Bean is bound as shown below in jndi view
 
+- DPDS-Enterprise (class: org.jnp.interfaces.NamingContext)
  |   
  |   +- AdSetScheduleBean (class: org.jnp.interfaces.NamingContext)
  |   |   +- local (proxy: $Proxy99 implements interface com.dreamplay.dpds.ejb.AdSetScheduleLocal,interface org.jboss.ejb3.JBossProxy,interface javax.ejb.EJBLocalObject)
  |   |   +- remote (proxy: $Proxy98 implements interface com.dreamplay.dpds.ejb.AdSetScheduleRemote

The war application that uses JavaServer Faces calls the session bean like so.

try {
            InitialContext ctx = new InitialContext();
 
            System.out.println("Lookup AdSetScheduleBean");
            Object o = ctx.lookup("DPDS-Enterprise/AdSetScheduleBean/local");
            System.out.println("Done Lookup");
            System.out.println("class name " + o.toString());
            System.out.println("-----------");
 
            com.dreamplay.dpds.ejb.AdSetScheduleLocal ad = (com.dreamplay.dpds.ejb.AdSetScheduleLocal) o;
            System.out.println("-----Done Lookup");
            System.out.println("class name " + ad.toString());
           
        } catch (NamingException e) {
            System.out.println("Naming Error occurred: " + e.toString());
        } catch (ClassCastException e) {
            System.out.println("ClassCast Error occurred: " + e.toString());
        }
 
In my log I get the following error.
09:47:38,181 INFO  [STDOUT] Lookup AdSetScheduleBean
09:47:38,181 INFO  [STDOUT] Done Lookup
09:47:38,181 INFO  [STDOUT] class name AdSetScheduleBean
09:47:38,181 INFO  [STDOUT] -----------
09:47:38,181 INFO  [STDOUT] ClassCast Error occurred: java.lang.ClassCastException: $Proxy247 cannot be cast to com.dreamplay.dpds.ejb.AdSetScheduleLocal


I tried casting the object like
com.dreamplay.dpds.ejb.AdSetScheduleLocal ad = (com.dreamplay.dpds.ejb.AdSetScheduleBean)o;

Even this gives me the error
10:04:21,506 INFO  [STDOUT] ClassCast Error occurred: java.lang.ClassCastException: $Proxy247 cannot be cast to com.dreamplay.dpds.ejb.AdSetScheduleBean


What am I doing wrong.
Can anybody help.
Thanks
Masoodah





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

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4140531



More information about the jboss-user mailing list