Common Bean Configuration

Both JBoss and JOnAS support a number of configuration options that can be used on any type of EJB regardless of whether it is an entity, session, or message driven bean. These options include:

Example 2-4 and Example 2-5 describe the JBoss and corresponding JOnAS schema for the above configuration options.

In the example below, <bean-type> may be replaced with "<entity>", "<session>", "<message-driven>".

Example 2-4. JBoss Bean Configuration

<jboss>
  ...
  <enterprise-beans>
    ...
    <bean-type>
      <ejb-name>EJB Name</ejb-name>
      <jndi-name>JNDI Name</jndi-name>
      <local-jndi-name>Local JNDI Name</local-jndi-name>
      ...
      <security-identity>
        <run-as-principal>Run As Principal</run-as-principal>
      </security-identity>
      ...
      <resource-ref>
        <res-ref-name>Internal Resource Name</res-ref-name>
        <resource-name>External Resource Name</resource-name>
        <!-- The tag above could also be jndi-name or res-url. -->
      </resource-ref>
      ...
      <ejb-ref>
        <ejb-ref-name>Internal Reference Name</ejb-ref-name>
        <jndi-name>Referenced JNDI Name</jndi-name>
      </ejb-ref>
      ...
      <resource-env-ref>
        <resource-env-ref-name>Resource Env Ref Name</resource-env-ref-name>
        <jndi-name>Resource Env Ref JNDI Name</jndi-name>
      </resource-env-ref>
      ...
    </bean-type>
    ...
  </enterprise-beans>
  ...
</jboss>

In the example below, <jonas-bean-type> may be replaced with "<jonas-entity>", "<jonas-session>", or "<jonas-message-driven>".

Example 2-5. JOnAS Bean Configuration

<jonas-ejb-jar>
  ...
  <jonas-bean-type>
    <ejb-name>EJB Name</ejb-name>
    <jndi-name>JNDI Name</jndi-name>
    <jndi-local-name>Local JNDI Name</jndi-local-name>
    ...
    <run-as>Run As Principal</run-as>
    ...
    <jonas-resource>
      <res-ref-name>Internal Resource Name</res-ref-name>
      <jndi-name>External Resource Name</jndi-name>
    </jonas-resource>
    ...
    <jonas-ejb-ref>
      <ejb-ref-name>Internal Reference Name</ejb-ref-name>
      <jndi-name>Referenced JNDI Name</jndi-name>
    </jonas-ejb-ref>
    ...
    <jonas-resource-env-ref>
      <resource-env-ref-name>Resource Env Ref Name</resource-env-ref-name>
      <jndi-name>Resource Env Ref JNDI Name</jndi-name>
    </jonas-resource-env-ref>
    ...
  </jonas-bean-type>
  ...
</jonas-ejb-jar>