Im having trouble mapping a Weblogic (12c) defined JNDI Datasource to a local jndi name.
I have a datasource in weblogic mysql datasource defined as "mysqltestds", and I want to map i within a web application to a local name "localds"
My web.xml properties are
<resource-ref>
<res-ref-name>localds</res-ref-name>
<res-type>javax.sql.DataSource</res-type>
<res-auth>Container</res-auth>
</resource-ref>
with the weblogic.xml
<weblogic-web-app>
<resource-description>
<res-ref-name>localds</res-ref-name>
<jndi-name>mysqltestds</jndi-name>lls
</resource-description>
</weblogic-web-app>
When I get the datasource using the global name "mysqltestds" it works correctly.
Context initialContext = new InitialContext();
Object resource = initialContext.lookup("mysqltestds");
dataSource = (DataSource) resource;
However, when I try "localds" it fails with the error:
Context initialContext = new InitialContext();
Object resource = initialContext.lookup("localds");
dataSource = (DataSource) resource;
javax.naming.NameNotFoundException: Unable to resolve 'localds'. Resolved ''; remaining name 'localds'
Can anyone help. I followed the directions in this stackOverflow question Tomcat vs Weblogic JNDI Lookup , but I haven't had any success.