cancel
Showing results for 
Search instead for 
Did you mean: 

JNDI lookup does not work after migrating to SAP Web AS

Former Member
0 Kudos

Hello,

I have exposed a bean as a web service. The web-jar.xml created with NetWeaver looks the following:


<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE ejb-jar PUBLIC "-//Sun Microsystems, Inc.//DTD Enterprise JavaBeans 2.0//EN" "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>
		<session>
			<ejb-name>ASGDeployBean</ejb-name>
			<home>org.asgplatform.asgdeployservice.ASGDeployHome</home>
			<remote>org.asgplatform.asgdeployservice.ASGDeploy</remote>
			<local-home>org.asgplatform.asgdeployservice.ASGDeployLocalHome</local-home>
			<local>org.asgplatform.asgdeployservice.ASGDeployLocal</local>
			<ejb-class>org.asgplatform.asgdeployservice.ASGDeployBean</ejb-class>
			<session-type>Stateless</session-type>
			<transaction-type>Container</transaction-type>
			<env-entry>
				<description>Describes in which directory to store the obtained file</description>
				<env-entry-name>deploydir</env-entry-name>
				<env-entry-type>java.lang.String</env-entry-type>
				<env-entry-value>C:Temp</env-entry-value>
			</env-entry>
			<env-entry>
				<description>Another directory where to store the uploaded files</description>
				<env-entry-name>DeployDir</env-entry-name>
				<env-entry-type>java.lang.String</env-entry-type>
				<env-entry-value>C:Tmp</env-entry-value>
			</env-entry>
		</session>
	</enterprise-beans>
</ejb-jar>

In the code of my Bean, I like to retrieve the value of deploydir with the following lines:


Context ctx=new InitialContext();
deployDir=(String)ctx.lookup("java:/comp/env/deploydir");

This code worked on JBoss, WebSphere, Jonas ...,

but not on SAP.

After playing a little bit with the Visual Administrator I found out, that there are multiple contexts for my bean:

ejbcontext/sap/com/ASGDeployBeanEnterprise/ASGDeployBean/Config1/

and

webContainer/sap/com/ASGDeployBeanEnterprise/ASGDeployBean/Config1/

and I found my entries in the ejbcontext but not in the webContainer context.

I added them to the webContainer context but still nothing happens.

What is the initial context of a web service, so?

Thanks in advance

Johannes Nicolai

Accepted Solutions (1)

Accepted Solutions (1)

Opgenorth
Employee
Employee
0 Kudos

Hello Johannes,

the lookup String should be "java:comp/env/deploydir" not "java:/comp/env/deploydir".

Best regards,

Juergen

Former Member
0 Kudos

Thanks for your answer. Strange that the other containers did not recognize my typo.

Answers (0)