Discussions

EJB design: BMP deployment problem in Weblogic 8.1

  1. I have a problem deploying BMP entity and session beans in Weblogic 8.1. When deploying the beans through the console, the server says the beans are succesfully deployed but gives error while testing them. The error is as following:

    "The EJB GradeBean has not been tested successfully. There was a problem determining the JNDI Name of the given bean."

    I feel that there is some problem with the deployment descriptors that I am using. Can anyone tell me where exactly the problem is.

    The following are the deployment descriptors that I am using:

    <!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>GradeManagerBean</ejb-name>
          <local-home> stepejb.grade.GradeManagerLocalHome
    </local-home>
          <local>stepejb.grade.GradeManagerLocal</local>
          <ejb-class>stepejb.grade.GradeManagerBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
        </session>
        <entity>
          <ejb-name>GradeBean</ejb-name>
          <local-home>stepejb.grade.GradeLocalHome</local-home>
          <local>stepejb.grade.GradeLocal</local>
          <ejb-class>stepejb.grade.GradeBean</ejb-class>
          <persistence-type>Bean</persistence-type>
          <prim-key-class> stepejb.grade.GradeKey
    </prim-key-class>
          <reentrant>False</reentrant>
          <resource-ref>
            <res-ref-name>stepDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
          </resource-ref>
        </entity>
      </enterprise-beans>

      <assembly-descriptor>
        <container-transaction>
          <method>
            <ejb-name>GradeManagerBean</ejb-name>
            <method-name>*</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
        <container-transaction>
          <method>
            <ejb-name>GradeBean</ejb-name>
            <method-name>*</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
      </assembly-descriptor>

    </ejb-jar>



    <!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>GradeBean</ejb-name>
        <reference-descriptor>
          <resource-description>
            <res-ref-name>step2DB</res-ref-name>
            <jndi-name>stepDB</jndi-name>
          </resource-description>
        </reference-descriptor>
        <local-jndi-name>Grade</local-jndi-name>
      </weblogic-enterprise-bean>
      <weblogic-enterprise-bean>
        <ejb-name>GradeManagerBean</ejb-name>
        <stateless-session-descriptor>
          <pool></pool>
          <stateless-clustering></stateless-clustering>
        </stateless-session-descriptor>
        <transaction-descriptor></transaction-descriptor>
        <local-jndi-name>GradeManager</local-jndi-name>
      </weblogic-enterprise-bean>
    </weblogic-ejb-jar>
  2. I am no guru but I think that:
    <res-ref-name>stepDB</res-ref-name> from ejb-jar.xml should match
    <res-ref-name>step2DB</res-ref-name> from weblogic-ejb-jar.xml. Let me know if this worked.
  3. entry in MDB[ Go to top ]

    I think you are right. But one point that I have noted is that there is no need to give in ejb-jar.xml and weblogic-ejb-jar.xml Can any one tell me what is the use of these entries? What I have seen is that even without these entries my code works fine.
  4. I think it did not test correctly because it only tests EJB's via the remote interface rather than the locally as you are attempting.
  5. I think the fooolowing will solve your problem...



    <!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>GradeManagerBean</ejb-name>
          <local-home> stepejb.grade.GradeManagerLocalHome
    </local-home>
          <local>stepejb.grade.GradeManagerLocal</local>
          <ejb-class>stepejb.grade.GradeManagerBean</ejb-class>
          <session-type>Stateless</session-type>
          <transaction-type>Container</transaction-type>
        </session>

        <entity>
          <ejb-name>GradeBean</ejb-name>
          <local-home>stepejb.grade.GradeLocalHome</local-home>
          <local>stepejb.grade.GradeLocal</local>
          <ejb-class>stepejb.grade.GradeBean</ejb-class>
          <persistence-type>Bean</persistence-type>
          <prim-key-class>stepejb.grade.GradeKey
    </prim-key-class>
          <reentrant>False</reentrant>
          <resource-ref>
            <res-ref-name>stepDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
          </resource-ref>
        </entity>
      </enterprise-beans>

      <assembly-descriptor>
        <container-transaction>
          <method>
            <ejb-name>GradeManagerBean</ejb-name>
            <method-name>*</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
        <container-transaction>
          <method>
            <ejb-name>GradeBean</ejb-name>
            <method-name>*</method-name>
          </method>
          <trans-attribute>Required</trans-attribute>
        </container-transaction>
      </assembly-descriptor>
    </ejb-jar>



    <!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>GradeBean</ejb-name>
        <reference-descriptor>
          <resource-description>
            <res-ref-name>stepDB</res-ref-name>
            <jndi-name>stepDB</jndi-name>
          </resource-description>
        </reference-descriptor>
        <local-jndi-name>Grade</local-jndi-name>
      </weblogic-enterprise-bean>

      <weblogic-enterprise-bean>
        <ejb-name>GradeManagerBean</ejb-name>
        <stateless-session-descriptor>
          <pool></pool>
          <stateless-clustering></stateless-clustering>
        </stateless-session-descriptor>
        <transaction-descriptor></transaction-descriptor>
        <local-jndi-name>GradeManager</local-jndi-name>
      </weblogic-enterprise-bean>
    </weblogic-ejb-jar>