| Author |
BMP Deployment descriptors
|
Saritha Penumudi
Ranch Hand
Joined: Aug 18, 2003
Posts: 146
|
|
Hi, I was trying a sample BMP bean. I am using Weblogic8.1 application server and MsSql as by database. I have created datasource and connection pool using admin console. I named datasource as "MyDatasource". Now i wanted to use this datasource in getConnection() method of my entity bean. To do this I have lookup for this datasource from JNDI. My problem is I am not sure where I have to define data-source JNDI name in deployment descriptors. It will be great help to me if anyone would give me detailed steps to write deployment descriptors for BMP entity beans. The descriptors which i have used are given below. ejb-jar.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN' 'http://java.sun.com/dtd/ejb-jar_2_0.dtd'> <!-- Generated XML! --> <ejb-jar> <enterprise-beans> <session> <ejb-name>AgencyEJB</ejb-name> <home>agency.server.AgencyHome</home> <remote>agency.server.Agency</remote> <ejb-class>agency.server.AgencyBean</ejb-class> <session-type>Stateless</session-type> <transaction-type>Bean</transaction-type> <!-- <env-entry> <env-entry-name>AgencyName</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>sari</env-entry-value> </env-entry> <env-entry> <env-entry-name>AgencyPwd</env-entry-name> <env-entry-type>java.lang.String</env-entry-type> <env-entry-value>sari</env-entry-value> </env-entry> --> </session> <entity> <ejb-name>LogonEJB</ejb-name> <home>agency.db.LogonLocalHome</home> <remote>agency.db.LogonLocal</remote> <ejb-class>agency.db.LogonLocalBean</ejb-class> <persistence-type>Bean</persistence-type> <prim-key-class>java.lang.String</prim-key-class> <reentrant>False</reentrant> </entity> </enterprise-beans> </ejb-jar> weblogic-ejb-jar.xml: <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-ejb-jar.dtd'> <!-- Generated XML! --> <weblogic-ejb-jar> <weblogic-enterprise-bean> <ejb-name>AgencyEJB</ejb-name> <stateless-session-descriptor> <pool></pool> <stateless-clustering> </stateless-clustering> </stateless-session-descriptor> <transaction-descriptor></transaction-descriptor> <jndi-name>AgencyHome</jndi-name> </weblogic-enterprise-bean> <weblogic-enterprise-bean> <ejb-name>LogonEJB</ejb-name> <entity-descriptor> <persistence> <persistence-use> <type-identifier>WebLogic_BMP_RDBMS</type-identifier> <type-version>6.0</type-version> <type-storage>META-INF/weblogic-rdbms-jar.xml</type-storage> </persistence-use> </persistence> </entity-descriptor> <jndi-name>LogonHome</jndi-name> </weblogic-enterprise-bean> </weblogic-ejb-jar> weblogic-rdbms-jar.xml <?xml version="1.0" encoding="UTF-8"?> <!DOCTYPE weblogic-rdbms-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 8.1.0 EJB RDBMS Persistence//EN' 'http://www.bea.com/servers/wls810/dtd/weblogic-rdbms20-persistence-810.dtd'> <weblogic-rdbms-jar> <weblogic-rdbms-bean> <ejb-name>LogonEJB</ejb-name> <data-source-name>MyDataSource</data-source-name> </weblogic-rdbms-bean> <!--<create-default-dbms-tables>CreateOnly</create-default-dbms-tables>--> </weblogic-rdbms-jar> I did read that weblogic-rdbms-jar.xml should be defined for CMP but not for BMP. I am not sure how i should go about refering datasource that i have created from my entitybean. Please reply me ASAP. Thank you saritha
|
 |
Chris Mathews
Ranch Hand
Joined: Jul 18, 2001
Posts: 2712
|
|
|
You are correct in thinking that you do not need to provide a weblogic-rdbms-jar.xml for your BMP. In fact, it will just be ignored. To access a datasource within your BMP all you need to do is look it up via JNDI. This can be done by using the JNDI name you configured in WebLogic or by setting a resource-ref to the datasource in your ejb-jar.xml descriptor.
|
 |
Saritha Penumudi
Ranch Hand
Joined: Aug 18, 2003
Posts: 146
|
|
Hi, Thank you very much for the response. In my bean I was looking for a datasource using JNDI lookup. My problem is I was not able to configure the JNDI name in deployment descriptor. I think I am not much clear in this concept. I would appreciate if you could explain me how whole thing works. U have sighted two ways to do this "This can be done by using the JNDI name you configured in WebLogic or by setting a resource-ref to the datasource in your ejb-jar.xml descriptor". I would appreciate if you could give me a sample on how both of the proposed solutions can be acheived. Thank you very much for your help Saritha
|
 |
 |
|
|
subject: BMP Deployment descriptors
|
|
|