[jboss-user] [EJB/JBoss] - Basic EJB3 with JBOSS

ghosh007 do-not-reply at jboss.com
Thu Aug 23 13:54:01 EDT 2007


I have jboss 4.2.1 GA with Eclipse 5.5 and trying to run the calculator example given on the jboss site. I have created the bin and here is my client:
public static void main(String[] args) {
		try { 
			
			
		    Context context=new InitialContext();
	        AdviceRemote bean = ( AdviceRemote) context.lookup("com.andy.ejb3.AdviceRemote/remote"); 
	         System.err.println(bean.getAdvice()); 
	    } catch (NamingException e) { 
	        e.printStackTrace(); 
	    } 

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

If I use something like,

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=new InitialContext(properties);

I get:
javax.naming.NoInitialContextException: Cannot instantiate class: org.jnp.interfaces.NamingContextFactory [Root exception is java.lang.ClassNotFoundException:


Please help!

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4077472#4077472

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4077472



More information about the jboss-user mailing list