我已经成功注册并从 LDAP 服务器检索了连接工厂对象。但是当我尝试从 LDAP 服务器查找队列时,它给出了 NPE。我将 OracleAQ 与 ApacheDS 一起使用。
我的代码是;
DirContext destctxQF = (DirContext) inictx.lookup("cn=OracleDBQueues");
System.out.println("OracleDBQueues look up success " + destctxQF.toString());
Queue queue = (Queue) destctxQF.lookup("cn=ratha.test");
我对队列的 LDIF 定义是;
dn: cn=ratha.test,cn=OracleDBQueues,cn=ORCL,cn=OracleContext,ou=Services,o=s
gi,c=us
objectClass: javaContainer
objectClass: orclDBAQObject
objectClass: javaNamingReference
objectClass: javaObject
objectClass: top
cn: ratha.test
javaClassName: oracle.jms.AQjmsDestination
orcldbaqobjtype: Queue
javaFactory: oracle.jms.AQjmsDestinationFactory
orcldbaqobjname: test
orcldbaqobjowner: ratha
orcldbaqpointerattr: cn=ratha.test_table,cn=OracleDBQueuesTables,cn=ORCL,cn=
OracleContext,ou=Services,o=sgi,c=us
对此有任何线索吗?完整的错误堆栈是;
javax.naming.NamingException: problem generating object using object factory [Root exception is java.lang.NullPointerException]; remaining name 'cn=ratha.test'
at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:1070)
at com.sun.jndi.toolkit.ctx.ComponentContext.p_lookup(ComponentContext.java:526)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:159)
at com.sun.jndi.toolkit.ctx.PartialCompositeContext.lookup(PartialCompositeContext.java:148)
at OracleAQJNDIClient.get_Factory_from_LDAP(OracleAQJNDIClient.java:93)
at OracleAQJNDIClient.main(OracleAQJNDIClient.java:142)
Caused by: java.lang.NullPointerException
at oracle.jms.AQjmsDestinationFactory.getObjectInstance(AQjmsDestinationFactory.java:120)
at javax.naming.spi.DirectoryManager.getObjectInstance(DirectoryManager.java:176)
at com.sun.jndi.ldap.LdapCtx.c_lookup(LdapCtx.java:1063)
... 5 more
谢谢,-拉萨