I have a Liferay 6.2 hook and I am trying to get the JNDI datasource configured in the Weblogic 12c container running Liferay.
The datasource is configured correctly and is accessible to other web apps running in the same Weblogic managed server so I know that is not the problem.
I am using Spring to retrieve the datasource using the exact same config that is working for the other web apps running on the server.
I have declared the datasource as a resource-ref in the web.xml using the exact same config that is working for the other web apps running on the server.
The error message I am seeing is:
javax.naming.NameNotFoundException: While trying to look up comp/env/jdbc/bootstrap in /app/webapp/liferay-portal-6.2.0-ce-ga1.war/1037207272.; remaining name 'comp/env/jdbc/bootstrap'
It is as if Weblogic's JNDI context is not available to the hook.
spring-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:jdbc="http://www.springframework.org/schema/jdbc"
xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd
http://www.springframework.org/schema/jdbc http://www.springframework.org/schema/jdbc/spring-jdbc-3.0.xsd">
<bean id="bootstrapDataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/bootstrap"/>
</bean>
</beans>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app
version="2.5"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<resource-ref>
<description>Datasource</description>
<res-ref-name>jdbc/bootstrap</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
</web-app>
Thanks Paul