Note that there are some explanatory texts on larger screens.

plurals
  1. POEJB exception while try to run the client
    primarykey
    data
    text
    <p>I created a bean object and encountered this error at run time,</p> <pre><code>java.lang.ClassCastException at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(Unknown Source) at javax.rmi.PortableRemoteObject.narrow(Unknown Source) at Client_TestPortal.main Client_TestPortal.java:71) Caused by: java.lang.ClassCastException: javax.naming.Reference ... 3 more </code></pre> <p>How to create bean object in my client? I have, a bean Interface, <code>TestPortal</code>, and a bean class, <code>TestPortalBean</code>, in an ear, <code>PortalEJB</code>.</p> <p>Here is the code, I am using to create EJB instance in client,</p> <pre><code>String sEjbRemote = "PortalEJB/TestPortalBean/remote"; Properties pProp = new Properties(); pProp.put("java.naming.factory.initial",sInitCtxtCls); pProp.put("java.naming.provider.url", sUrl); javax.naming.InitialContext initialContext = new InitialContext(pProp); Object ref = initialContext.lookup(sEjbRemote); System.out.println("\n\n \t Source :::"+ref.toString()); test.ejb.TestPortal testportal = (test.ejb.TestPortal)PortableRemoteObject.narrow(ref,test.ejb.TestPortal.class); </code></pre> <p>Object ref = initialContext.lookup(sEjbRemote);</p> <p>When i print the object in SOP ref.toString();</p> <p>i got the following information but i am not able to create object for TestPortal which is in the PoratlEJB.ear which is deployed in JBOSS- AS version : Jboss-5.0.1.GA </p> <pre><code> Source :::Reference Class Name: Proxy for: test.ejb.TestPortal </code></pre> <p>Type: ProxyFactoryKey Content: ProxyFactory/TestPortalBean/PortalEJB/TestPortalBean/remote Type: EJB Container Name Content: jboss.j2ee:ear=PortalEJB.ear,jar=PortalEJB.jar,name=TestPortalBean,serv ice=EJB3 Type: Proxy Factory is Local Content: false Type: Remote Business Interface Content: test.ejb.TestPortal Type: Remoting Host URL Content: socket://s9458:3973/</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload