最佳答案
我只是花了太多的时间试图在连接一些 JNDI 工厂 bean 时找出一些错误。问题是,不是这个。
<bean id="someId" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/loc"/>
</bean>
我其实写了这个..。
<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?
如果值中没有 java:comp/env/
前缀,就会得到一个表示 “ Name jdbc 不在此上下文中绑定”的错误。