Skip to Content
author's profile photo Former Member
Former Member

Please help me: Problem in Deploying CMP Entity Bean!!!

While deploying an .ear-Archive with CMP Entity Bean archive and webarchive containing Servletclass extending ServletTestCase for running EJB-Tests with Cactus I get the following error.

Reason: Application sap.com/bank_ear cannot be started, because it has hard reference to resource CONFIG_DB with type javax.sql.DataSource, but it is not active on the server.

I already checked my application for references to CONFIG_DB as suggested in other threads.

I created a data-source-alias:

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE data-source-aliases SYSTEM "data-source-aliases.dtd">

<data-source-aliases>

<aliases>

<data-source-name>${com.sap.datasource.default}</data-source-name>

<alias>DB_BANK</alias>

</aliases>

</data-source-aliases>

and refer it in

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE persistent-ejb-map SYSTEM "persistent.dtd">

<persistent-ejb-map>

<locking

type="Table"/>

<db-properties>

<data-source-name>DB_BANK</data-source-name>

<database-vendor

name="SAPDB"/>

</db-properties>

<entity-beans>

<entity-bean>

<ejb-name>AccountBean</ejb-name>

<table-name>BA_ACCOUNT</table-name>

<field-map

key-type="NoKey">

<field-name>holderId</field-name>

<column>

<column-name>HOLDER_ID</column-name>

</column>

</field-map>

<field-map

key-type="NoKey">

<field-name>balance</field-name>

<column>

<column-name>BALANCE</column-name>

</column>

</field-map>

<field-map

key-type="PrimaryKey">

<field-name>ejb_pk</field-name>

<column>

<column-name>ACCOUNT_ID</column-name>

</column>

</field-map>

</entity-bean>

</entity-beans>

<relationships/>

</persistent-ejb-map>

Also I created resource-refs in the bean`s DDs.

<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">

<ejb-j2ee-engine>

<description>

</description>

<enterprise-beans>

<enterprise-bean>

<ejb-name>AccountBean</ejb-name>

<jndi-name>Accounting</jndi-name>

<resource-ref>

<res-ref-name>jdbc/DB_BANK</res-ref-name>

<res-link>DB_BANK</res-link>

</resource-ref>

<entity-props/>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

<?xml version="1.0" encoding="UTF-8"?>

http://java.sun.com/dtd/ejb-jar_2_0.dtd">

<ejb-jar>

<description>EJB JAR description</description>

<display-name>EJB JAR</display-name>

<enterprise-beans>

<entity>

<ejb-name>AccountBean</ejb-name>

<home>com.plecto.admin.account.AccountHome</home>

<remote>com.plecto.admin.account.Account</remote>

<ejb-class>com.plecto.admin.account.AccountBean</ejb-class>

<persistence-type>Container</persistence-type>

<prim-key-class>java.lang.Object</prim-key-class>

<reentrant>False</reentrant>

<cmp-version>2.x</cmp-version>

<abstract-schema-name>AccountSchema</abstract-schema-name>

<cmp-field>

<description>

</description>

<field-name>holderId</field-name>

</cmp-field>

<cmp-field>

<description>

</description>

<field-name>balance</field-name>

</cmp-field>

<resource-ref>

<res-ref-name>jdbc/DB_BANK</res-ref-name>

<res-type>javax.sql.DataSource</res-type>

<res-auth>Container</res-auth>

</resource-ref>

</entity>

</enterprise-beans>

</ejb-jar>

<b></b>

Add a comment
10|10000 characters needed characters exceeded

Related questions

1 Answer

  • author's profile photo Former Member
    Former Member
    Posted on Dec 15, 2004 at 02:32 PM

    Hello Werner,

    The mappings seem to be alright at a first glance.

    Have you tried out un- and redeploying your application? Sometimes values appear to be cached in the server. So if you have deployed the application before you entered DB_BANK as alias this might solve the problem...

    BR

    Daniel

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.