Search code examples
datasourcejndiwso2

WSO2 AS JDNI lookup


In WSO2 AS 5.0.1 I deploy a webapp which should use a datasource. I can configure the datasource in tomcat-server.xml or any other place in the WAR, but is it possible to use a datasource that is configured in the Carbon Management Console through JNDI?

Steps taken:

  1. Configure datasource in Management Console, export it as JNDI as jdbc/platform

  2. ResourceLink in META-INF/context.xml to link the global resource:

    < ResourceLink name="jdbc/platform" global="jdbc/platform" type="javax.sql.DataSource" />

  3. Reference the resource in web.xml

    < resource-ref> < res-ref-name>jdbc/platform < res-type>javax.sql.DataSource < res-auth>Application

However trying to lookup jdbc/platform or java:comp/env/jdbc/platform does not resolve into an object. The lookup files with messages like: Name [java:jdbc/platform] is not bound in this Context. Unable to find [java:jdbc]. or, when using comp/env as prefix it will complain that 'comp' is not available.

Is this kind of configuration supported by WSO2 Carbon?


Solution

  • Currently this is not supported see https://wso2.org/jira/browse/CARBON-13908.