We are deploying worklight application on Worklight 6.1, Oracle 11g, and Tomcat 7.0.42.
we are following manual procedure to deploy worklight application on Tomcat we configured following files: Adapter.xml
<connectivity>
<connectionPolicy xsi:type="sql:SQLConnectionPolicy">
<dataSourceJNDIName>${DataSource-jndi-Local}</dataSourceJNDIName>
</connectionPolicy>
worklight.properties
DataSource-jndi-Local = jdbc/WorklightAppDS
server.xml(Tomcat 7)
<Context path="/App_Name" docBase="App_Name">
<Resource name="jdbc/WorklightAppDS"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@domain:1521:ORCL"
username="DBUSER"
password="DBPASS"/>
<Resource name="jdbc/WorklightDS"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@domain:1521:ORCL"
username="DBUSERWORKLIGHT"
password="DBUSERWORKLIGHTPASS"/>
<Resource name="jdbc/WorklightReportsDS"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.driver.OracleDriver"
url="jdbc:oracle:thin:@domain:1521:ORCL"
username="DBUSERWORKLIGHTREPORTS"
password="DBUSERWORKLIGHTREPORTSPASS"/>
<Manager pathname="" />
</Context>
after doing the above configuration, Worklight application was deployed and we were able to access worklight console on context "/App_Name/console". we deployed .wlapp and .wladapter on the worklight console and when we invoke worklight adapter through application it says "Runtime: Datasource jdbc/WorklightAppDS not found in jndi".
we tried another two approaches to configure datasource:
Added datasource configuration in
<GlobalNamingResources>
tag in server.xml:<Resource name="UserDatabase" auth="Container" type="org.apache.catalina.UserDatabase" description="User database that can be updated and saved" factory="org.apache.catalina.users.MemoryUserDatabaseFactory" pathname="conf/tomcat-users.xml" /> <Resource name="jdbc/WorklightAppDS" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@domain:1521:ORCL" username="DBUSER" password="DBPASS"/> </GlobalNamingResources>
Added datasource configuration in context.xml file :
WEB-INF/web.xml
<Resource name="jdbc/WorklightAppDS" auth="Container" type="javax.sql.DataSource" driverClassName="oracle.jdbc.driver.OracleDriver" url="jdbc:oracle:thin:@domain:1521:ORCL" username="DBUSER" password="DBPASS"/> <!-- <Manager pathname="" /> --> </Context>
In these two approaches we are facing same error. i.e. "Runtime: Datasource jdbc/WorklightAppDS not found in jndi"
Try with java:comp/env/${DataSource-jndi-Local} in dataSourceJNDIName.