I am new to EJB3 and trying to run an application based on tutorial
http://www.laliluna.de/download/first-ejb3-tutorial-en.pdf
1) The JNDI name is defined in a file bookstore-ds.xml which is in ....jboss/server/deploy directory
2) The JNDI name is being referenced like :
public static final
String RemoteJNDIName = BookTestBean.class.getSimpleName() + "/remote";
3) When I try to run the Client program as below:
Properties properties = new Properties();
properties.put("java.naming.factory.initial","org.jnp.interfaces.NamingContextFactory");
properties.put("java.naming.factory.url.pkgs","=org.jboss.naming:org.jnp.interfaces");
properties.put("java.naming.provider.url","localhost:1099");
Context context;
try
{
context = new InitialContext();
BookTestBeanRemote beanRemote = (BookTestBeanRemote) context.lookup(BookTestBean.RemoteJNDIName);
beanRemote.test();
} catch (NamingException e)
{
e.printStackTrace();
/* I rethrow it as runtimeexception as there is really no need to continue if an exception happens and I
* do not want to catch it everywhere.
*/
throw new RuntimeException(e);
}
I get following 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
at javax.naming.spi.NamingManager.getInitialContext(NamingManager.java:645)
at javax.naming.InitialContext.getDefaultInitCtx(InitialContext.java:247)
at javax.naming.InitialContext.getURLOrDefaultInitCtx(InitialContext.java:284)
at javax.naming.InitialContext.lookup(InitialContext.java:351)
When I look into Namespace view using JNDIView service ,it seems like JNDI name is not bound
Failed to lookup: timedCacheFactory, errmsg=org.jboss.util.TimedCachePolicy
+-
bookDatasource (class: org.jboss.resource.adapter.jdbc.WrapperDataSource)
+- TransactionPropagationContextExporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- StdJMSPool (class: org.jboss.jms.asf.StdServerSessionPoolFactory)
+- Mail (class: javax.mail.Session)
+- comp.ejb3 (class: javax.naming.Context)
| NonContext: null
+- TransactionPropagationContextImporter (class: com.arjuna.ats.internal.jbossatx.jta.PropagationContextManager)
+- TransactionManager (class: com.arjuna.ats.jbossatx.jta.TransactionManagerDelegate)
Any suggestions ?
Thanks.