I'm using Spring 1.1.1, and have some trouble with ref, because I want share some properties to all my JndiObject. my applicationContext-jms.xml
when i run some test:Code:<bean id="QMTestCF" class="org.springframework.jndi.JndiObjectFactoryBean"> <property name="jndiEnvironment"><ref local="ref"/></property> <property name="jndiName"><value>cn=QM_Test,cn=jms,cn=thailh</value></property> </bean> <bean id="ref" class="java.util.Properties"> <constructor-arg> <props> <prop key="java.naming.factory.initial">com.sun.jndi.ldap.LdapCtxFactory</prop> <prop key="java.naming.provider.url">ldap://192.100.100.12:389/dc=cicat,dc=com</prop> </props> </constructor-arg> </bean>
i've got Exception:Code:FileSystemXmlApplicationContext context = new FileSystemXmlApplicationContext("/Web Content/WEB-INF/classes/applicationContext-jms.xml");
Oct 4, 2004 2:53:04 PM org.springframework.beans.factory.support.Abstract BeanFactory getBean
INFO: Creating shared instance of singleton bean 'QMTestCF'
Oct 4, 2004 2:53:05 PM org.springframework.beans.factory.support.Abstract BeanFactory getBean
INFO: Creating shared instance of singleton bean 'ref'
Oct 4, 2004 2:53:05 PM org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory autowireConstructor
INFO: Bean 'ref' instantiated via constructor [public java.util.Properties(java.util.Properties)]
Oct 4, 2004 2:53:05 PM org.springframework.beans.factory.support.Abstract BeanFactory destroySingletons
INFO: Destroying singletons in factory {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [QMTestCF,reply,request,test,ref]; Root of BeanFactory hierarchy}
Oct 4, 2004 2:53:05 PM org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory destroySingletons
INFO: Destroying inner beans in factory {org.springframework.beans.factory.support.Default ListableBeanFactory defining beans [QMTestCF,reply,request,test,ref]; Root of BeanFactory hierarchy}
Exception in thread "main" org.springframework.beans.factory.BeanCreationExce ption: Error creating bean with name 'QMTestCF' defined in file [D:\eclipse\workspace\mqdemo\Web Content\WEB-INF\classes\applicationContext-jms.xml]: Initialization of bean failed; nested exception is 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
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(N amingManager.java:653)
at javax.naming.InitialContext.getDefaultInitCtx(Init ialContext.java:257)
at javax.naming.InitialContext.getURLOrDefaultInitCtx (InitialContext.java:294)
at javax.naming.InitialContext.lookup(InitialContext. java:361)
at org.springframework.jndi.JndiTemplate$1.doInContex t(JndiTemplate.java:123)
at org.springframework.jndi.JndiTemplate.execute(Jndi Template.java:85)
at org.springframework.jndi.JndiTemplate.lookup(JndiT emplate.java:121)
at org.springframework.jndi.JndiLocatorSupport.lookup (JndiLocatorSupport.java:71)
at org.springframework.jndi.JndiObjectLocator.lookup( JndiObjectLocator.java:85)
at org.springframework.jndi.JndiObjectFactoryBean.aft erPropertiesSet(JndiObjectFactoryBean.java:59)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.invokeInitMethods(Abstr actAutowireCapableBeanFactory.java:1057)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:287)
at org.springframework.beans.factory.support.Abstract AutowireCapableBeanFactory.createBean(AbstractAuto wireCapableBeanFactory.java:205)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:204)
at org.springframework.beans.factory.support.Abstract BeanFactory.getBean(AbstractBeanFactory.java:136)
at org.springframework.beans.factory.support.DefaultL istableBeanFactory.preInstantiateSingletons(Defaul tListableBeanFactory.java:230)
at org.springframework.context.support.AbstractApplic ationContext.refresh(AbstractApplicationContext.ja va:284)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:83)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:68)
at org.springframework.context.support.FileSystemXmlA pplicationContext.<init>(FileSystemXmlApplicationC ontext.java:59)
at com.cicat.mqdemo.test.JmsMessager.main(JmsMessager .java:33)


Reply With Quote