Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Urgent: Problem with JNDI and data source

 
Ronak Parekh
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I am getting this error for the last few days and I don't know how to solve it.
I have checked all the active pools and example-oraclePool is active. Do let me know the
reason for still getting the error? I have tried all the ways to solve it but have not been
able to get the solution. Please do get back to me on this as soon as anyone can find a
reply.
Thank you
Ronak Parekh
My Error is:
preparing application app73 on ronserver
prepared application app73 on ronserver
activating application app73 on ronserver
Exception caught for task Activate application app73 on ronserver: activate failed
forsempire_bc.jar
Module, sempire_bc.jar, reported error: Exception activating module:
EJBModule(sempire_bc.jar,status=PREPARED)

Unable to deploy EJB: OrganizationEJB from sempire_bc.jar:
weblogic.ejb20.WLDeploymentException: The DataSource with the JNDI name: example-oraclePool
could not be located. Please ensure that the DataSource has been deployed successfully and
that the JNDI name in your EJB Deployment descriptor is correct.
at
weblogic.ejb20.cmp.rdbms.RDBMSPersistenceManager.setup(RDBMSPersistenceManager.java:130)
at weblogic.ejb20.manager.BaseEntityManager.setupPM(BaseEntityManager.java:214)
at weblogic.ejb20.manager.BaseEntityManager.setup(BaseEntityManager.java:186)
at weblogic.ejb20.manager.DBManager.setup(DBManager.java:161)
at
weblogic.ejb20.deployer.ClientDrivenBeanInfoImpl.activate(ClientDrivenBeanInfoImpl.java:936)
at weblogic.ejb20.deployer.EJBDeployer.activate(EJBDeployer.java:1302)
at weblogic.ejb20.deployer.EJBModule.activate(EJBModule.java:342)
at
weblogic.j2ee.J2EEApplicationContainer.activateModule(J2EEApplicationContainer.java:1534)
at
weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:991)
at
weblogic.j2ee.J2EEApplicationContainer.activate(J2EEApplicationContainer.java:978)
at
weblogic.management.deploy.slave.SlaveDeployer.processPrepareTask(SlaveDeployer.java:1104)
at
weblogic.management.deploy.slave.SlaveDeployer.prepareUpdate(SlaveDeployer.java:724)
at
weblogic.drs.internal.SlaveCallbackHandler$1.execute(SlaveCallbackHandler.java:24)
at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:152)
at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:133)
failed application app73 on ronserver
My weblogic-cmp-rdbms-jar.xml
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE weblogic-rdbms-jar PUBLIC
'-//BEA Systems, Inc.//DTD WebLogic 7.0.0 EJB RDBMS Persistence//EN'
'http://www.bea.com/servers/wls700/dtd/weblogic-rdbms20-persistence-700.dtd'>
<weblogic-rdbms-jar>
<weblogic-rdbms-bean>
<ejb-name>GangsterEJB</ejb-name>
<data-source-name>example-oraclePool</data-source-name>
<table-map>
<table-name>GANGSTER</table-name>
<field-map>
<cmp-field>iD</cmp-field>
<dbms-column>ID</dbms-column>
</field-map>
<field-map>
<cmp-field>name</cmp-field>
<dbms-column>NAME</dbms-column>
</field-map>
<field-map>
<cmp-field>nickname</cmp-field>
<dbms-column>NICKNAME</dbms-column>
</field-map>
<field-map>
<cmp-field>badness</cmp-field>
<dbms-column>BADNESS</dbms-column>
</field-map>
</table-map>
<weblogic-query>
<query-method>
<method-name>findAll</method-name>
<method-params></method-params>
</query-method>
</weblogic-query>
</weblogic-rdbms-bean>
<weblogic-rdbms-bean>
<ejb-name>OrganizationEJB</ejb-name>
<data-source-name>example-oraclePool</data-source-name>
<table-map>
<table-name>ORGANIZATION</table-name>
<field-map>
<cmp-field>iD</cmp-field>
<dbms-column>ID</dbms-column>
</field-map>
<field-map>
<cmp-field>name</cmp-field>
<dbms-column>NAME</dbms-column>
</field-map>
<field-map>
<cmp-field>description</cmp-field>
<dbms-column>DESCRIPTION</dbms-column>
</field-map>
</table-map>
<weblogic-query>
<query-method>
<method-name>findAll</method-name>
<method-params></method-params>
</query-method>
</weblogic-query>
</weblogic-rdbms-bean>
<weblogic-rdbms-bean>
<ejb-name>JobEJB</ejb-name>
<data-source-name>example-oraclePool</data-source-name>
<table-map>
<table-name>JOB</table-name>
<field-map>
<cmp-field>iD</cmp-field>
<dbms-column>ID</dbms-column>
</field-map>
<field-map>
<cmp-field>name</cmp-field>
<dbms-column>NAME</dbms-column>
</field-map>
<field-map>
<cmp-field>score</cmp-field>
<dbms-column>SCORE</dbms-column>
</field-map>
<field-map>
<cmp-field>setupCost</cmp-field>
<dbms-column>SETUPCOST</dbms-column>
</field-map>
</table-map>
<weblogic-query>
<query-method>
<method-name>findAll</method-name>
<method-params></method-params>
</query-method>
</weblogic-query>
</weblogic-rdbms-bean>
<weblogic-rdbms-relation>
<relation-name>organization-memberGangsters</relation-name>
<weblogic-relationship-role>
<relationship-role-name>memberGangsters--
-organization</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>iD</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>

<weblogic-rdbms-relation>
<relation-name>gangsters-jobs</relation-name>
<table-name>JOBS</table-name>
<weblogic-relationship-role>
<relationship-role-name>gangsters---jobs</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>iD</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
<weblogic-relationship-role>
<relationship-role-name>jobs---gangsters</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>iD</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
<weblogic-rdbms-relation>
<relation-name>organization-theBoss</relation-name>
<weblogic-relationship-role>
<relationship-role-name>organization---theBoss</relationship-role-name>
<relationship-role-map>
<column-map>
<foreign-key-column>iD</foreign-key-column>
<key-column>ID</key-column>
</column-map>
</relationship-role-map>
</weblogic-relationship-role>
</weblogic-rdbms-relation>
</weblogic-rdbms-jar>
 
Dave Landers
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
This is the third time you have posted this question. From now on, please reply to this post if you have more information.
And it would also be nice if you would change your name to the format you agreed to when you signed up here.
So -
Make sure you have mapped your data source to the jndi name of the data source, not the name of the jdbc connection pool (using data-source-name in the weblogic-rdbms-jar.xml and in resource-description in weblogic-ejb-jar.xml).
Also, make sure your connection pool and your datasource have their Target set to your server (in the console).
Then, make sure you are using the right names for env-ref's in your EJB code. If your env-ref is "jdbc/Foo", use the jndi name "java:comp/env/jdbc/Foo" in your EJB code.
 
abhi zulu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
you have to do a few things ..
Make sure that u have a connection pool ready
1) create a datasource if ur using wl6.1 link to connection pool
2)specify this name using default weblogic context
like java:comp\env\jdbc\datasourcename
link this datasource to jndi name.
3)specify this datasource in ejb-jar.xml & jndi name with datasource in ejb-weblogic-jar.xml
 
abhi zulu
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok fine , java:comp\env is the default context
for weblogic. what ever resource u create on ur
server must be registered by a name like
java:comp\env\jdbc\name .This u have to list
n ur ejb-jar.xml as a resource ref.
now in webligic-jar.xml u have to specify
what type of resource this is example ataSource in ur case.
Now if ur using BMP u have to get the connection
in ur bean by calling this (java:comp/env/jdbc/name)
if its a CMP the weblogic server will do this work for u.

i hope this helps
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic