The version for JBoss originally was
datasource.jndi=java:/comp/env/jdbc/ourDS
The new one in use for WebSphere will be
datasource.jndi=jdbc/ourDS
Jetty that ran on my development localhost machine, found both versions acceptable without complaining. Thus, I sought to level the playing field such that our project could comfortably support either Application Server without too big a variation.
A number of solutions I'd found catered to the older versions of JBoss 4/5. They are not applicable because of the major change of the configuration XML since AS7. This is how the datasource configuration looks like for AS7.
Initially, I found this, and then this. It led me to conclude that there is a "resourceRef" flag that I could use. I tested adding the
<property name="resourceRef" value="true"/>
into the XML to no avail. As I began learning more about this topic, I gathered from the hints that a reference anchor was needed. I just had to figure out the correct place to do this. Since our configuration for JBoss required a standalone.xml to be located on the application server, I started digging there. And from my recent experiences, this was the biggest game-changer since earlier versions of JBoss.An official documentation I found pointed to usage of naming bindings. I tried locating the detailed configuration for this Naming subsystem. Taking a potshot, I added this line:
<subsystem xmlns="urn:jboss:domain:naming:1.1">
<bindings>
<lookup name="jdbc/ourDS" lookup="java:/comp/env/jdbc/ourDS"/>
</bindings>
</subsystem>
And it worked!
Note that there was already a separate configuration of the datasources in the Datasources subsystem configuration within this XML file. And with this, the properties file for the JDBC setup will not require the additional java:/comp context that only JBoss is looking for. Have fun!
No comments:
Post a Comment