Hello biondo79, Attached is my example client, that I got to work, with JBOSS-3.2.3RC1 And mySQL. I wish someone, would have helped me I spent a lot of time Guessing.
Joe Fraser -----Original Message----- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of biondo79 Sent: Monday, March 01, 2004 7:44 AM To: [EMAIL PROTECTED] Subject: [JBoss-dev] [Javassist development Forum] - Set initial context Hi! I�m a rookie on JBoss and I�would like to know the specific JNDI properties to set the InitialContext. I�m following the Titan Cruiser example. The JBoss EJB workbook doesn�t set anything, but at RunTime I got an exception: "javax.naming.NoInitialContextException: Need to specify class name in environment or system property, or as an applet parameter, or in an application resource file: java.naming.factory.initial" Is there any Java .property file that I need to configure? Here is the class code: package com.titan.cabin; import javax.naming.InitialContext; import javax.naming.Context; import javax.naming.NamingException; import java.rmi.RemoteException; import javax.ejb.CreateException; import javax.ejb.FinderException; import java.util.Properties; import javax.rmi.PortableRemoteObject; public class Client_1 { public static void main(String[] args){ try{ Context jndiContext = getInitialContext(); Object ref = jndiContext.lookup("CabinRemote"); CabinHomeRemote home = (CabinHomeRemote) PortableRemoteObject.narrow(ref, CabinRemote.class); CabinRemote cabin_1 = home.create(new Integer(1)); cabin_1.setName("Master Suite"); cabin_1.setDeckLevel(1); cabin_1.setShipId(1); cabin_1.setBedCount(3); Integer pk = new Integer(1); CabinRemote cabin_2 = home.findByPrimaryKey(pk); System.out.println(cabin_2.getName()); System.out.println(cabin_2.getDeckLevel()); System.out.println(cabin_2.getShipId()); System.out.println(cabin_2.getBedCount()); }catch(RemoteException re){re.printStackTrace();} catch(NamingException ne){ne.printStackTrace();} catch(CreateException ce){ce.printStackTrace();} catch(FinderException fe){fe.printStackTrace();} } public static Context getInitialContext() throws NamingException{ Properties p = new Properties(); // Here is where my doubt is... return new InitialContext(p); } } View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=3823607#3823607 Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=382360 7 ------------------------------------------------------- SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with a free DVD software kit from IBM. Click Now! http://ads.osdn.com/?ad_id56&alloc_id438&op=ick _______________________________________________ JBoss-Development mailing list [EMAIL PROTECTED] https://lists.sourceforge.net/lists/listinfo/jboss-development
Client.java
Description: Binary data
