Return-Path: Delivered-To: apmail-geronimo-user-archive@www.apache.org Received: (qmail 24605 invoked from network); 4 Apr 2008 04:52:16 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 4 Apr 2008 04:52:16 -0000 Received: (qmail 65903 invoked by uid 500); 4 Apr 2008 04:52:16 -0000 Delivered-To: apmail-geronimo-user-archive@geronimo.apache.org Received: (qmail 65341 invoked by uid 500); 4 Apr 2008 04:52:14 -0000 Mailing-List: contact user-help@geronimo.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: Reply-To: user@geronimo.apache.org List-Id: Delivered-To: mailing list user@geronimo.apache.org Received: (qmail 65330 invoked by uid 99); 4 Apr 2008 04:52:14 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 03 Apr 2008 21:52:14 -0700 X-ASF-Spam-Status: No, hits=4.8 required=10.0 tests=DEAR_SOMETHING,DNS_FROM_OPENWHOIS,SPF_HELO_PASS,SPF_PASS,WHOIS_MYPRIVREG X-Spam-Check-By: apache.org Received-SPF: pass (nike.apache.org: domain of lists@nabble.com designates 216.139.236.158 as permitted sender) Received: from [216.139.236.158] (HELO kuber.nabble.com) (216.139.236.158) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 04 Apr 2008 04:51:21 +0000 Received: from isper.nabble.com ([192.168.236.156]) by kuber.nabble.com with esmtp (Exim 4.63) (envelope-from ) id 1Jhdts-0002ls-JS for user@geronimo.apache.org; Thu, 03 Apr 2008 21:51:40 -0700 Message-ID: <16482909.post@talk.nabble.com> Date: Thu, 3 Apr 2008 21:51:40 -0700 (PDT) From: atul12345 To: user@geronimo.apache.org Subject: Re: how to run Ejb program on geronimo In-Reply-To: <747B0F3C-0853-44C1-B5B0-218E6DC751B3@yahoo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable X-Nabble-From: atul.iims@gmail.com References: <16392851.post@talk.nabble.com> <16417878.post@talk.nabble.com> <466797bd0804010414h2daeae7cq9af565b530bb6310@mail.gmail.com> <16442215.post@talk.nabble.com> <16444488.post@talk.nabble.com> <16465788.post@talk.nabble.com> <747B0F3C-0853-44C1-B5B0-218E6DC751B3@yahoo.com> X-Virus-Checked: Checked by ClamAV on apache.org Dear sir, I am sure, when i running the client code, got that Exception. I have already mentioned all exception which throw during the execution of client program. if u want again so that is.... please sir provide me write solution to resolve this problem becoz i have already spent two to three days resolve it problem. java.lang.ClassCastException at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableR at javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:137) at HelloWorld.main(HelloWorld.java:31) Caused by: java.lang.ClassCastException: $Proxy0 cannot be cast to org.omg.CORBA at com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow(PortableR ... 2 more Could anyone tell me what I=E2=80=99m doing wrong? Thanks a lot. Looking fo= rward to hearing from you. djencks wrote: >=20 > Are you sure you are running the client code you show? The error =20 > indicates you are using PortableRemoteObject.narrow() rather than the =20 > simple cast in the client code you showed earlier. >=20 > Is the CCE happening on the client? >=20 > I'm unable to see how the exception you show can be coming from the =20 > code you show. More of the exception stack trace might possibly be =20 > helpful. >=20 > david jencks >=20 >=20 > On Apr 2, 2008, at 10:05 PM, atul12345 wrote: >=20 >> >> >> Thanks for help but this is not problem that is when i run my =20 >> client >> program that time i get error....... >> java.lang.ClassCastException: $Proxy0 cannot be cast to >> My.DemoInter >> >> Actually sir i have already mentioned interfaces,bean class and my =20 >> client >> and xml. so please check that code and tell me what i am doing wrong. >> Actually sir i had spent already three days to run one simple ejb =20 >> program i >> think geronimo server is not good for ejb. >> >> >> please help me to give suitable response.......... >> >> >> vhnguy2 wrote: >>> >>> Hi Atul, >>> >>> It looks like you're doing a remote lookup. I think your client code >>> should look something similar to >>> >>> My.DemoInter remoteObj =3D(My.DemoInter)ctx.lookup(>> interface>); >>> >>> Let me know if this works. >>> >>> Thanks, >>> Viet >>> >>> >>> On Wed, Apr 2, 2008 at 4:12 AM, atul12345 =20 >>> wrote: >>>> >>>> >>>> >>>> atul12345 wrote: >>>>> >>>>> >>>>> >>>>> Hi Sir, >>>>> Thanks for help. I appreciate your attention. See ya! >>>>> This is my ejb-jar.xml file here i do have all the classes >>>> means >>>>> interface name. >>>>> >>>>> >>>> xmlns:xsi=3D"http://www.w3.org/2001/XMLSchema-instance" >>>>> xsi:schemaLocation=3D"http://java.sun.com/xml/ns/j2ee >>>>> http://java.sun.com/xml/ns/j2ee/ejb-jar_2_1.xsd" =20 >>>>> version=3D"2.1"> >>>>> Example of a session bean >>>>> MyTimeBeanEJBName >>>>> >>>>> >>>>> >>>>> My.DemoEJB >>>>> My.DemoHome >>>>> My.DemoInter >>>>> My.DemoBean >>>>> >>>>> Stateful >>>>> Container>>>> type> >>>>> >>>>> >>>>> >>>>> >>>>> When I try to execute my client , I receive this error message: >>>>> java.lang.ClassCastException. >>>>> >>>>> java.lang.ClassCastException >>>>> at >>>>> com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow=20 >>>>> (PortableR >>>>> at >>>>> javax.rmi.PortableRemoteObject.narrow(PortableRemoteObject.java:=20 >>>>> 137) >>>>> at HelloWorld.main(HelloWorld.java:31) >>>>> Caused by: java.lang.ClassCastException: $Proxy0 cannot be cast to >>>>> org.omg.CORBA >>>>> at >>>>> com.sun.corba.se.impl.javax.rmi.PortableRemoteObject.narrow=20 >>>>> (PortableR >>>>> ... 2 more >>>> >>>> >>>>> >>>>> Could anyone tell me what I'm doing wrong? Thanks a lot. Looking >>>> forward >>>>> to hearing from you. >>>>> >>>>> >>>>> >>>>> >>>>> manucet wrote: >>>>>> >>>>>> Hi Atul, >>>>>> I am not sure but did you specify the home and remote >>>>>> interfaces in the ejb-jar.xml file? If yes it will be helpful =20 >>>>>> if you >>>>>> can provide a test case. >>>>>> >>>>>> Regards >>>>>> Manu >>>>>> >>>>>> On Tue, Apr 1, 2008 at 4:33 PM, atul12345 >>>> wrote: >>>>>>> >>>>>>> Actually after resolved jndi name problem i get one new error =20 >>>>>>> that >>>> is >>>>>>> >>>>>>> java.lang.ClassCastException: $Proxy0 cannot be cast to =20 >>>>>>> My.DemoHome >>>>>>> if anyone have any idea what is this so please give me =20 >>>>>>> suitable >>>>>>> soluation >>>>>>> to resolve that problem......... >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> >>>>>>> atul12345 wrote: >>>>>>>> >>>>>>>> Dear Sir, >>>>>>>> >>>>>>>> I am new programmer to Geronimo and EJB which are >>>>>>> running on >>>>>>>> gentoo. i am createing stateful session bean like that........ >>>>>>>> This is remote Interface.......... >>>>>>>> package My; >>>>>>>> >>>>>>>> import java.rmi.*; >>>>>>>> >>>>>>>> import javax.ejb.*; >>>>>>>> >>>>>>>> public interface DemoInter extends EJBObject >>>>>>>> { >>>>>>>> public int add(int a,int b) throws RemoteException; >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> This is Home Interface.......... >>>>>>>> package My; >>>>>>>> >>>>>>>> import javax.ejb.*; >>>>>>>> import java.rmi.*; >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> public interface DemoHome extends EJBHome >>>>>>>> { >>>>>>>> public DemoInter create() throws =20 >>>>>>>> CreateException,RemoteException; >>>>>>>> } >>>>>>>> >>>>>>>> This is Bean class............ >>>>>>>> >>>>>>>> package My; >>>>>>>> >>>>>>>> import java.rmi.*; >>>>>>>> >>>>>>>> import javax.ejb.*; >>>>>>>> >>>>>>>> public class DemoBean implements SessionBean >>>>>>>> { >>>>>>>> public DemoBean() { >>>>>>>> // TODO Auto-generated constructor stub >>>>>>>> } >>>>>>>> public void ejbCreate() >>>>>>>> { >>>>>>>> System.out.println("ejbCreate()"); >>>>>>>> } >>>>>>>> >>>>>>>> public void ejbRemove() >>>>>>>> { >>>>>>>> System.out.println("ejbRemove()"); >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> public void ejbActivate() >>>>>>>> { >>>>>>>> System.out.println("ejbActivate()"); >>>>>>>> } >>>>>>>> >>>>>>>> public void ejbPassivate() >>>>>>>> { >>>>>>>> System.out.println("ejbPassivate()"); >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> public void setSessionContext(SessionContext ctx){} >>>>>>>> >>>>>>>> >>>>>>>> public int add(int a,int b) throws RemoteException >>>>>>>> { >>>>>>>> return (a+b); >>>>>>>> } >>>>>>>> >>>>>>>> } >>>>>>>> >>>>>>>> >>>>>>>> open-ejb.xml is where i specified the jndi name >>>>>>>> >>>>>>>> >>> xmlns=3D"http://www.openejb.org/xml/ns/openejb-jar-2.1" >>>>>>>> >>>>>>> xmlns:naming=3D"http://geronimo.apache.org/xml/ns/naming-1.1" >>>>>>>> >>>>>>>> xmlns:security=3D"http://geronimo.apache.org/xml/ns/security-1.1" >>>>>>>> xmlns:sys=3D"http://geronimo.apache.org/xml/ns/deployment-1.1"> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> Demo >>>>>>>> >>>> org.geronimo.ejbsample.HomeBean >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> >>>>>>>> and this is my client code........... >>>>>>>> >>>>>>>> import java.util.*; >>>>>>>> import javax.naming.*; >>>>>>>> import javax.rmi.*; >>>>>>>> import My.*; >>>>>>>> >>>>>>>> >>>>>>>> public class Client { >>>>>>>> >>>>>>>> /** >>>>>>>> * @param args >>>>>>>> */ >>>>>>>> public static void main(String[] args) { >>>>>>>> // TODO Auto-generated method stub >>>>>>>> try { >>>>>>>> >>>>>>>> Properties properties=3Dnew Properties(); >>>>>>>> >>>> properties.setProperty(Context.INITIAL_CONTEXT_FACTORY, >>>>>>>> "org.apache.openejb.client.RemoteInitialContextFactory"); >>>>>>>> >>>>>>>> >>>> properties.setProperty(Context.PROVIDER_URL, >>>>>>>> "ejbd://localhost:4201" ); >>>>>>>> >>>>>>>> Context ctx=3Dnew InitialContext(properties); >>>>>>>> >>>>>>>> My.DemoHome >>>>>>>> >>>> home=3D(My.DemoHome)ctx.lookup=20 >>>> ("java:org.geronimo.ejbsample.HomeBean"); >>>>>>>> >>>>>>>> My.DemoInter object =3Dhome.create(); >>>>>>>> System.out.println(object.add(12,22)); >>>>>>>> >>>>>>>> that is my code, everything is ok means deploy successfully but >>>>>>> problem is >>>>>>>> when i execute client program, that time i get error that is >>>>>>>> >>>>>>>> javax.naming.NameNotFoundException: >>>> org.geronimo.ejbsample.HomeBean >>>>>>> does >>>>>>>> not exist in the system. Check that the app was successfully >>>>>>> deployed. >>>>>>>> So if anybody know how to resolve this problem then please give >>>> me >>>>>>>> suitable suggestion to resolve this problem.. >>>>>>>> >>>>>>>> >>>>>>> >>>>>>> -- >>>>>>> View this message in context: >>>>>>> >>>> http://www.nabble.com/how-to-run--Ejb-program-on-geronimo-=20 >>>> tp16392851s134p16417878.html >>>>>>> >>>>>>> >>>>>>> Sent from the Apache Geronimo - Users mailing list archive at >>>>>>> Nabble.com. >>>>>>> >>>>>>> >>>>>> >>>>>> >>>>> >>>>> >>>> >>>> -- >>>> View this message in context: >>>> http://www.nabble.com/how-to-run--Ejb-program-on-geronimo-=20 >>>> tp16392851s134p16444488.html >>>> >>>> >>>> Sent from the Apache Geronimo - Users mailing list archive at =20 >>>> Nabble.com. >>>> >>>> >>> >>> >> >> --=20 >> View this message in context: http://www.nabble.com/how-to-run--Ejb-=20 >> program-on-geronimo-tp16392851s134p16465788.html >> Sent from the Apache Geronimo - Users mailing list archive at =20 >> Nabble.com. >> >=20 >=20 >=20 --=20 View this message in context: http://www.nabble.com/how-to-run--Ejb-program= -on-geronimo-tp16392851s134p16482909.html Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.