Actually after resolved jndi name problem i get one new error that is

java.lang.ClassCastException: $Proxy0 cannot be cast to My.DemoHome
 if anyone have any idea what is this so please give  me 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 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
> 
> <openejb-jar xmlns="http://www.openejb.org/xml/ns/openejb-jar-2.1";
>              xmlns:naming="http://geronimo.apache.org/xml/ns/naming-1.1";
>             
> xmlns:security="http://geronimo.apache.org/xml/ns/security-1.1";
>   xmlns:sys="http://geronimo.apache.org/xml/ns/deployment-1.1";>  
>        
>   <enterprise-beans>
>     <session>
>             <ejb-name>Demo</ejb-name>
>             <jndi-name>org.geronimo.ejbsample.HomeBean</jndi-name>
>     </session>
>   </enterprise-beans>
> </openejb-jar>
> 
> 
> 
> 
> 
> 
> 
> 
>  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=new Properties();
>             properties.setProperty(Context.INITIAL_CONTEXT_FACTORY,
> "org.apache.openejb.client.RemoteInitialContextFactory");
>            
>                         properties.setProperty(Context.PROVIDER_URL,
> "ejbd://localhost:4201" );
>                        
>             Context ctx=new InitialContext(properties);
>                        
>                  My.DemoHome
> home=(My.DemoHome)ctx.lookup("java:org.geronimo.ejbsample.HomeBean");
>          
>   My.DemoInter object =home.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-tp16392851s134p16417878.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.

Reply via email to