cancel
Showing results for 
Search instead for 
Did you mean: 

JNDI name

Former Member
0 Kudos

Im trying to deploy an EAR onto SAP Web AS. It has an ejb.jar file with ejb-jar.xml and the ejb-j2ee-engine.xml. ive given my beans their JNDI names in the ejb-j2ee-engine.xml file.

But when i deploy it, it comes back with SAP's default JNDI names instead of the ones ive given there. Can someone please tell me if we can supply our own JNDI names and if there is a work around for this.I use ant to build by EAR file. Any help would be greatly appreciated.

thanks

-RD

Accepted Solutions (1)

Accepted Solutions (1)

htammen
Active Contributor
0 Kudos

Hi RD,

this should be no problem. Here is an extract of one of my jeb-j2ee-engine.xml's generated by SAP Dev. Studio.


<ejb-j2ee-engine>
  <enterprise-beans>
    <enterprise-bean>
      <ejb-name>BeanName</ejb-name>
      <jndi-name>MyBean</jndi-name>
      ...
      <session-props/>
    </enterprise-bean>
  </enterprise-beans>
<ejb-j2ee-engine>

Answers (2)

Answers (2)

Vlado
Advisor
Advisor
0 Kudos

Hi RD,

As Helmut already wrote this shouldn't be a problem. Can you paste the parts of ejb-jar.xml and ejb-j2ee-engine.xml relevant to your EJB? Also the path where you find it in the JNDI tree.

Best regards,

Vladimir

Former Member
0 Kudos

thanks for all your replies,

Firstly, Iam NOT using the SAP dev studio.

Iam pasting the contents for one bean

ejb-jar.xml

<enterprise-beans>

<!-- Session Beans -->

<session >

<description><![CDATA[]]></description>

<ejb-name>MyBean</ejb-name>

<home>com.myapp.ejb.MyBeanRemoteHome</home>

<remote>com.myapp.ejb.MyBeanRemote</remote>

<local-home>com.myapp.ejb.MyBeanLocalHome</local-home>

<local>com.myapp.ejb.MyBeanLocal</local>

<ejb-class>com.myapp.ejb.MyBean</ejb-class>

<session-type>Stateless</session-type>

<transaction-type>Container</transaction-type>

<ejb-local-ref >

<ejb-ref-name>ejb/ABean</ejb-ref-name>

<ejb-ref-type>Session</ejb-ref-type>

<local-home>com.myapp.ejb.ABeanLocalHome</local-home>

<local>com.myapp.ejb.ABeanLocal</local>

<ejb-link>ABean</ejb-link>

</ejb-local-ref>

<security-role-ref>

<role-name>user</role-name>

<role-link>user</role-link>

</security-role-ref>

<security-role-ref>

<role-name>dev</role-name>

<role-link>dev</role-link>

</security-role-ref>

<security-role-ref>

<role-name>admin</role-name>

<role-link>admin</role-link>

</security-role-ref>

<resource-ref >

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

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

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

<res-sharing-scope>Shareable</res-sharing-scope>

</resource-ref>

</session>

ejb-j2ee-engine.xml

<enterprise-beans>

<enterprise-bean>

<ejb-name>MyBean</ejb-name>

<jndi-name>com.myapp.ejb.MyBean<jndi-name/>

</enterprise-bean>

I also noticed a <session-props/> entry in the ejb-j2ee-engine.xml file contents you had sent. Can you please tell me what it is.

Aprreciate all your help and thanks

RD

viliana
Advisor
Advisor
0 Kudos

Hi RD,

In the <session-props> tag you can define some additional properties for your session beans, such as passivation of bean instances, pool properties, stateful session failover, etc. For more information, see

http://help.sap.com/saphelp_nw04/helpdata/en/37/30c557fad05341a951cfd051bf0b44/content.htm

For the JNDI name, your JNDI name should be as defined in ejb-j2ee-engine.xml: com.myapp.ejb.MyBean.

Hint: The local interface of the bean are registered in the JNDI with a localejbs/ prefix in front of the JNDI name. When you want to look up the local interface of the bean, you must specify this prefix in front of the JNDI name.

See also: http://help.sap.com/saphelp_nw04/helpdata/en/86/2ccbdefb8f5843958a11062e19fc1d/content.htm

By the way, it is not recommended to use the JNDI names to look up your beans. This should be a solution only if the clients of the EJB are non-J2EE components, for example you are trying to look up your bean from WebDynpro. Otherwise, if the EJB clients are J2EE components, you should use the standard lookup as defined by the specification. See http://help.sap.com/saphelp_nw04/helpdata/en/56/c8633e0084e946e10000000a114084/content.htm

Best regards,

Viliana

Former Member
0 Kudos

thanks for the answer.

I had made a mistake in my build process. ive corrected it now and i see my JNDI name now.

-RD

Former Member
0 Kudos

Hi RD,

to add a new jndi name for your bean class open the ejb-j2ee-engine.xml, click on the 'Enterprise Beans tab. Click on your bean name, it should be listed under session or entity or message dirven bean node as per the bean type. You will get a field to enter the JNDI name corresponding to the bean you have selected. Enter the jndi name, save it, you will get the required entry in the xml file. The resultant xml file will look like this...

<enterprise-beans>

<enterprise-bean>

<ejb-name>MyTestSessionBean</ejb-name>

<jndi-name>myTestSession</jndi-name>

<session-props/>

</enterprise-bean>

</enterprise-beans>

hope it helps...

shubhadip