[jboss-user] [JBoss/Spring Integration] - Re: Jndi lookup on spring factory return 'null'

jissma do-not-reply at jboss.com
Thu Sep 21 09:50:29 EDT 2006


thanks but it's still not working, I try this ....


  | public class jndiLookup extends TestCase {
  | 
  | 	public void testlookup() {
  | 		try {
  | 			Properties jndiProps = new Properties();
  | 			jndiProps.setProperty(Context.INITIAL_CONTEXT_FACTORY, "org.jnp.interfaces.NamingContextFactory");
  | 			jndiProps.setProperty(Context.URL_PKG_PREFIXES, "org.jboss.naming:org.jnp.interface");
  | 			jndiProps.setProperty(Context.PROVIDER_URL, "jnp://127.0.0.1:1099");
  | 			Context context = new InitialContext(jndiProps);
  | 
  | 			BeanFactory beanFactory = (BeanFactory) org.jboss.naming.Util.lookup(context, "test3", BeanFactory.class);
  | 			
  | 		} catch (NamingException e) {
  | 			System.out.println("Naming Error " + e);
  | 
  | 		} catch (Exception e) {
  | 			 e.printStackTrace();
  | 		}
  | 
  | 	}
  | }
  | 

and the result is 



  | java.lang.NullPointerException
  | 	at org.jboss.naming.Util.checkObject(Util.java:230)
  | 	at org.jboss.naming.Util.lookup(Util.java:199)
  | 	at spring.deplyer.test.jndiLookup.testlookup(jndiLookup.java:25)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
  | 	at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
  | 	at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
  | 	at java.lang.reflect.Method.invoke(Unknown Source)
  | 	at junit.framework.TestCase.runTest(TestCase.java:154)
  | 	at junit.framework.TestCase.runBare(TestCase.java:127)
  | 	at junit.framework.TestResult$1.protect(TestResult.java:106)
  | 	at junit.framework.TestResult.runProtected(TestResult.java:124)
  | 	at junit.framework.TestResult.run(TestResult.java:109)
  | 	at junit.framework.TestCase.run(TestCase.java:118)
  | 	at junit.framework.TestSuite.runTest(TestSuite.java:208)
  | 	at junit.framework.TestSuite.run(TestSuite.java:203)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:478)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
  | 	at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
  | 

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

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



More information about the jboss-user mailing list