This forum is now a read-only archive. All commenting, posting, registration services have been turned off. Those needing community support and/or wanting to ask questions should refer to the Tag/Forum map, and to http://spring.io/questions for a curated list of stackoverflow tags that Pivotal engineers, and the community, monitor.

Comment

In my setup, I bind to <jndi-name>myDS</jndi-name> in the *-ds.xml file, and I have
<property name="jndiName"><value>java:/myDS</value></property>
in the config for my JndiObjectFactoryBean.

I'm kind of guessing here, but the error

javax.naming.NameNotFoundException: jdbc not bound

suggests that jboss may not have created the hierarchical context structure that your name suggests, and that Spring is expecting. You can see exactly what is bound to JNDI, and the context hierarchy, by looking at the url servername/jmx-console/, select service=JNDIView under jboss, and then invoke operation 'list'.

So you might try java:bhffds in your JndiObjectFactoryBean when running with jboss.

Again, you can see exactly what is bound in JNDI, and where, using jmx-console. See my post above.

I'm pretty sure you only need resource-ref stuff in web.xml and jboss-web.xml if you want to access the datasource in jsp/jstl. As long as your access to the datasource is via Spring DI, you don't need it.

So you might try java:bhffds in your JndiObjectFactoryBean when running with jboss.

Again, you can see exactly what is bound in JNDI, and where, using jmx-console. See my post above.

I'm pretty sure you only need resource-ref stuff in web.xml and jboss-web.xml if you want to access the datasource in jsp/jstl. As long as your access to the datasource is via Spring DI, you don't need it.

Comment

But you can at least abstract out the difference by putting the jndiName value in a properties file and using a PropertyPlaceholderConfigurer to set the value from the properties file. Then you only need a separate properties file for the two environments, not a whole different Spring config file. And I'm guessing there could well be other differences in configuration that could go in that properties file.