posted 22 years ago
Thanks for all your help.
Could you please suggest me where to specify this datasource in ejb-jar.xml & jndi name with datasource in ejb-weblogic-jar.xml
Following is my ejb-jar.xml:
<?xml version="1.0"?>
<!DOCTYPE ejb-jar PUBLIC '-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 1.1//EN' 'http://java.sun.com/j2ee/dtds/ejb-jar_1_1.dtd'>
<ejb-jar>
<enterprise-beans>
<session>
<ejb-name>statelessSession</ejb-name>
<home> myapp.MYAPPWebServiceHome</home>
<remote> myapp.MYAPPWebService</remote>
<ejb-class> myapp.MYAPPWebServiceBean</ejb-class>
<session-type>Stateless</session-type>
<transaction-type>Container</transaction-type>
</session>
</enterprise-beans>
<assembly-descriptor>
<container-transaction>
<method>
<ejb-name>statelessSession</ejb-name>
<method-intf>Remote</method-intf>
<method-name>*</method-name>
</method>
<trans-attribute>Required</trans-attribute>
<container-transaction>
</assembly-descriptor>
</ejb-jar>
following is my ejb-weblogic-jar.xml :
<?xml version="1.0"?>
<!DOCTYPE weblogic-ejb-jar PUBLIC '-//BEA Systems, Inc.//DTD WebLogic 5.1.0 EJB//EN' 'http://www.bea.com/servers/wls510/dtd/weblogic-ejb-jar.dtd'>
<weblogic-ejb-jar>
<weblogic-enterprise-bean>
<ejb-name>statelessSession</ejb-name>
<caching-descriptor>
<max-beans-in-free-pool>100</max-beans-in-free-pool>
</caching-descriptor>
<jndi-name>stateless.MYAPPWebServiceHome</jndi-name>
</weblogic-enterprise-bean>
</weblogic-ejb-jar>
Following is my code in the ejb method:
Hashtable ht = new Hashtable();
ht.put(Context.INITIAL_CONTEXT_FACTORY,
"weblogic.jndi.WLInitialContextFactory");
ht.put(Context.PROVIDER_URL,
"t3://hostName:7001");
// Get a context for the JNDI look up
ctx = new InitialContext(ht);
javax.sql.DataSource ds
= (javax.sql.DataSource) ctx.lookup ("mydataSource-OracleThinDriverPool");
conn = ds.getConnection();
Thanks,
smita