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=3823607


-------------------------------------------------------
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=click
_______________________________________________
JBoss-Development mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/jboss-development

Reply via email to