FreeKB - Map an application to a JNDI during deployment
Map an application to a JNDI during deployment

Home > Search


The web.xml and ibm-web-bnd.xml files can be used to map an application to a JNDI when the application is being deployed to a WebSphere application server. Both web.xml and ibm-web-bnd.xml are in the WEB-INF folder of the application. For example, let's say you want to map the application to a JNDI of "jdbc/mySQL".

 

First, you would define the resource reference in web.xml.

<resource-ref>
  <res-ref-name>jdbc/mySQL</res-ref-name>
  <res-type>javax.sql.DataSource</res-type>
  <res-auth>Container</res-auth>
</resource-ref>

 

Then, you would use the following ibm-web-bnd.xml file.

<?xml version="1.0" encoding="UTF-8"?>
<web-bnd 
	xmlns="http://websphere.ibm.com/xml/ns/javaee"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xsi:schemaLocation="http://websphere.ibm.com/xml/ns/javaee http://websphere.ibm.com/xml/ns/javaee/ibm-web-bnd_1_0.xsd"
	version="1.0">

	<resource-ref name="jdbc/mySQL" binding-name="jdbc/mySQL" />

</web-bnd>

 

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 151e6 in the box below so that we can be sure you are a human.




Comments