I just spent too much time of my day trying to figure out some errors when hooking up some JNDI factory bean. The problem turned out to be that instead of this...
<bean id="someId" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/loc"/>
</bean>
I had actually written this...
<bean id="someId" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="jdbc/loc"/>
</bean>
I infer that the java:comp/env/
perhaps references some environment variable and makes it so that, ultimately, my context file is looked at. The only difference is java:comp/env/
. From an expert's mouth, what does that do?
Without the java:comp/env/
prefix in the value, I would get an error that said "Name jdbc is not bound in this Context".
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…