geronimo-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From atul12345 <atul.i...@gmail.com>
Subject Re: how to run Ejb program on geronimo
Date Tue, 01 Apr 2008 10:32:16 GMT

Thanks.................

manucet wrote:
> 
> Hi,
>     The JNDI Name that you have given is not correct. If you see the
> log files you can find the correct JNDI Name. You will get lines
> similar to the one below where ejb/mgmt/MRCLocal is the JNDI Name
> 21:38:02,125 INFO  [startup] Jndi(name=ejb/mgmt/MRCLocal) -->
> Ejb(deployment-id=agent-ejb.jar/ejb/mgmt/MRC)
> 
> I am guessing that in your case it will be DemoRemote or DemoBeanRemote
> You just need to lookup ctx.lookup("DemoRemote");
> 
> I believe there is a bug in openejb whereby it doesn't pick the value
> in the jndi-name tag and instead uses 3.0 style name generation .
> 
> Regards
> Manu
> 
> On Mon, Mar 31, 2008 at 1:22 PM, atul12345 <atul.iims@gmail.com> 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-tp16392851s134p16392851.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-tp16392851s134p16417869.html
Sent from the Apache Geronimo - Users mailing list archive at Nabble.com.


Mime
View raw message