yep,mine is working on postgresql.
Alexandros Kotsiras wrote:
>
> BTW have you been able to run the examples with a database other then
> InstandDB/Hypersonic SQL ? ?
> Because this is where i am really stuck !!
>
> pranab wrote:
>
> > Ken,
> > Here is the code which worked for me.
> > package com.ebd.ejb;
> >
> > import com.ebd.ejb.CabinHome;
> > import com.ebd.ejb.Cabin;
> > import com.ebd.ejb.CabinPK;
> >
> > import javax.naming.InitialContext;
> > import javax.naming.Context;
> > import javax.naming.NamingException;
> > import java.rmi.RemoteException;
> > import javax.rmi.PortableRemoteObject;
> > import java.util.Properties;
> > import javax.ejb.CreateException;
> >
> > public class CabinSessionClient
> > {
> >
> > public static int SHIP_ID = 2;
> > public static int BED_COUNT = 3;
> >
> > public static void main(String [] args)
> > {
> > try
> > {
> > Context jndiContext = getInitialContext();
> > Object ref = (TravelAgentHome)
> > jndiContext.lookup("TravelAgentBean");
> > TravelAgentHome home = (TravelAgentHome)
> > PortableRemoteObject.narrow(ref,TravelAgentHome.class);
> > TravelAgent reserve = (TravelAgent) home.create();
> > String [] list = reserve.listCabins(SHIP_ID,BED_COUNT);
> > System.out.println("Results ="+list.length);
> > for(int i=0;i<list.length;i++)
> > {
> > System.out.println(list[i]);
> > }
> > }
> > catch(java.rmi.RemoteException re)
> > {
> > re.printStackTrace();
> > }
> > catch( Throwable t)
> > {
> > t.printStackTrace();
> > }
> > }
> > public static Context getInitialContext() throws
> > javax.naming.NamingException
> > {
> > Properties p = new Properties();
> >
> > p.put(Context.INITIAL_CONTEXT_FACTORY,"org.jnp.interfaces.NamingContextFactory");
> > p.put(Context.PROVIDER_URL,"localhost");
> > p.put(Context.URL_PKG_PREFIXES, "org.jboss.naming");
> > System.setProperty("java.naming.factory.initial",
> > "org.jnp.interfaces.NamingContextFactory");
> > System.setProperty("java.naming.provider.url",
> > "localhost:1099");
> > Context ctx = new javax.naming.InitialContext();
> > return ctx;
> > }
> > }
> >
> > Ken Jenks wrote:
> > >
> > > Not there yet.
> > >
> > > This command:
> > >
> > > java -classpath
> > > /usr/local/jboss/lib/ext/ejb.jar:/usr/local/jboss/client/jnp-client.jar:/usr
> > > /local/jboss/client/jboss-client.jar:. com.titan.travelagent.jBossClient_1
> > >
> > > ...gives this error:
> > >
> > > java.rmi.ServerException: RemoteException occurred in server thread; nested
> > > exception is:
> > > java.rmi.ServerException: Exception occurred; nested exception is:
> > > javax.ejb.EJBException
> > > java.rmi.ServerException: Exception occurred; nested exception is:
> > > javax.ejb.EJBException
> > > javax.ejb.EJBException
> > > at
> > > sun.rmi.transport.StreamRemoteCall.exceptionReceivedFromServer(Stream
> > > RemoteCall.java:245)
> > > at
> > > sun.rmi.transport.StreamRemoteCall.executeCall(StreamRemoteCall.java:220)
> > > at sun.rmi.server.UnicastRef.invoke(UnicastRef.java:122)
> > > at
> > > org.jboss.ejb.plugins.jrmp.server.JRMPContainerInvoker_Stub.invoke(Un
> > > known Source)
> > > at
> > > org.jboss.ejb.plugins.jrmp.interfaces.StatelessSessionProxy.invoke(St
> > > atelessSessionProxy.java:87)
> > > at $Proxy1.listCabins(Unknown Source)
> > > at com.titan.travelagent.jBossClient_1.main(jBossClient_1.java:48)
> > >
> > > Here's the client listing, jBossClient_1.java:
> > >
> > > package com.titan.travelagent;
> > >
> > > import com.titan.cabin.CabinHome;
> > > import com.titan.cabin.Cabin;
> > > import com.titan.cabin.CabinPK;
> > >
> > > import javax.naming.InitialContext;
> > > import javax.naming.Context;
> > > import javax.naming.NamingException;
> > > import javax.ejb.CreateException;
> > > import java.rmi.RemoteException;
> > > import java.util.Properties;
> > >
> > > public class jBossClient_1 {
> > > public static int SHIP_ID = 1;
> > > public static int BED_COUNT = 3;
> > >
> > > public static void main(String [] args){
> > > try {
> > > /* COMMENTED OUT FOR jBoss
> > > Context jndiContext = getInitialContext();
> > > Object obj = jndiContext.lookup("ejb/TravelAgentHome");
> > > COMMENTED OUT FOR jBoss */
> > >
> > > /* BEGIN SECTION ADDED FOR jBoss */
> > > // Set up the naming provider; this may not always be necessary,
> > > depending
> > >
> > > // on how your Java system is configured.
> > > System.setProperty("java.naming.factory.initial",
> > > "org.jnp.interfaces.NamingContextFactory");
> > > System.setProperty("java.naming.provider.url",
> > > "localhost:1099");
> > >
> > > // Get a naming context
> > > InitialContext jndiContext = new InitialContext();
> > >
> > > // Get a reference to the TravelAgentBean
> > > Object obj = jndiContext.lookup("TravelAgentBean");
> > >
> > > // Get a reference from this to the Bean's Home interface
> > >
> > > /* END SECTION ADDED FOR jBoss */
> > >
> > > TravelAgentHome home = (TravelAgentHome)
> > > javax.rmi.PortableRemoteObject.narrow(obj, TravelAgentHome.class);
> > >
> > > TravelAgent reserve = home.create();
> > >
> > > // Get a list of all cabins on ship 1 with a bed count of 3.
> > > String list [] = reserve.listCabins(SHIP_ID,BED_COUNT); // LINE 48 HERE!
> > >
> > > for(int i = 0; i < list.length; i++){
> > > System.out.println(list[i]);
> > > }
> > >
> > > } catch(java.rmi.RemoteException re){re.printStackTrace();}
> > > catch(Throwable t){t.printStackTrace();}
> > > }
> > > static public Context getInitialContext() throws Exception {
> > > Properties p = new Properties();
> > > // ... Specify the JNDI properties specific to the vendor.
> > > return new InitialContext();
> > > }
> > > }
> > >
> > > So the client compiles and runs, but after it creates the connection with
> > > home.create() (which succeeds), the next call to the bean,
> > > String list [] = reserve.listCabins(SHIP_ID,BED_COUNT); // LINE 48 HERE!
> > > fails.
> > >
> > > It seems strange to lookup TravelAgentBean to get the home interface. Maybe
> > > that's my problem.
> > >
> > > Any suggestions?
> > >
> > > -- Ken Jenks, http://abiblion.com/
> > >
> > > Tools for reading.
> > >
> > > --
> > > --------------------------------------------------------------
> > > To subscribe: [EMAIL PROTECTED]
> > > To unsubscribe: [EMAIL PROTECTED]
> > > Problems?: [EMAIL PROTECTED]
> >
> > --
> > --------------------------------------------------------------
> > To subscribe: [EMAIL PROTECTED]
> > To unsubscribe: [EMAIL PROTECTED]
> > Problems?: [EMAIL PROTECTED]
>
> --
> --------------------------------------------------------------
> To subscribe: [EMAIL PROTECTED]
> To unsubscribe: [EMAIL PROTECTED]
> Problems?: [EMAIL PROTECTED]
--
--------------------------------------------------------------
To subscribe: [EMAIL PROTECTED]
To unsubscribe: [EMAIL PROTECTED]
Problems?: [EMAIL PROTECTED]