My project requires the initial Factory context and the URL of the vendor to be loaded from the properties file. Here is my Spring configuration
<bean id="jndiTemplate" class="org.springframework.jndi.JndiTemplate" lazy-init="true">
<property name="environment">
<props>
<prop key="java.naming.factory.initial">${initial.context.factory}</prop>
<prop key="java.naming.provider.url">${provider.url}</prop>
</props>
</property>
</bean>
<bean id="jmsQueueConnectionFactory" class="org.springframework.jndi.JndiObjectFactoryBean" lazy-init="true" depends-on="jndiTemplate">
<property name="jndiTemplate">
<ref bean="jndiTemplate"/>
</property>
<property name="jndiName">
<value>${queue.connection.factory}</value>
</property>
</bean>
And this is how my Spring container initialization
PropertyPlaceholderConfigurer ppc = new PropertyPlaceholderConfigurer();
ppc.setProperties(ConfigManager.getProperties());
AbstractApplicationContext context = new ClassPathXmlApplicationContext("spring-config.xml");
context.addBeanFactoryPostProcessor(ppc);
context.refresh();
QueueConnectionFactory initialization throws an exception
An exception in the stream "main" org.springframework.beans.factory.BeanCreationException: an error occurred while creating a bean named 'jmsQueueConnectio nFactory' defined in the key path resource [spring -config.xml]: the init method call failed; The nested exception is javax.naming.Com municationException [The root exception is java.net.ConnectException: http://maven.apache.org/ingestionservices-core: t : ' [http]: http (http): null: -1:192.168.50.160: -1'; ] org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFa ctory.java:1412) at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFact ory.java:519) org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactor y.java:456) at org.springframework.beans.factory.support.AbstractBeanFactory $1.getObject(AbstractBeanFactory.java:291) at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222 ) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:281) org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190) org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1075) at com.quickplay.ingestionservices.poolmgr.PoolManager.initialize(PoolManager.java:143) com.quickplay.ingestionservices.poolmgr.PoolManager. (PoolManager.java:56) com.quickplay.ingestionservices.poolmgr.PoolManager.main(PoolManager.java:47)
, provider.url . , URL- . - , ?