xmlwebsphere-libertyserver.xmlwebsphere

Can IBM WebSphere Liberty Datasource be split from the server.xml into an include file?


Can IBM WebSphere Liberty handle splitting off the datasources/jndi entries from the server.xml into an include?

When I split the datasources out of the server.xml into it's own file, and include it as an include in the server.xml file below the library tags:

<include location="${server.config.dir}/datasources-join-include.xml"/>

And the datasources-join-include.xml file:

<?xml version="1.0" encoding="UTF-8" ?>
<server description="Datasource join include file">

  <dataSource id="db" jndiName="jdbc/Config">
     <jdbcDriver libraryRef="OracleLib"/>
     <properties.oracle URL="jdbc:oracle:xxx:@hostname:port:db" password="password" user="user"/>
  </dataSource>

  <jndiEntry id="db" jndiName="database" value="jdbc/XXXX"/>

</server>

When setup this way with the include, it fails (doesn't seem to recognize the datasource). When I put the datasource and jndientry back directly into the server.xml in the exact same spot where I had the include, it works fine.


Solution

  • Yes, Liberty can handle splitting datasources out of the server.xml into it's own file and then included via <include />, that's true for any config element.

    I don't see anything wrong in your configuration, so it might be the file location or name not being correct. I'd recommend checking your log to make sure you don't see CWWKG0090E which would indicate that the server.xml can't find/resolve your include file.