cancel
Showing results for 
Search instead for 
Did you mean: 

JNDI NameNotFoundException in java proxy

Former Member
0 Kudos

Hello All,

We are using a.jsp file that uses client proxy to send data to XI. We have crated the required .ear and have deployed it to the J2EE server.

The ejb-j2ee-engine.xml contains the following

<ejb-j2ee-engine>

<enterprise-beans>

<enterprise-bean>

<ejb-name>JavaProxyTest</ejb-name>

<ejb-ref>

<ejb-ref-name>ejb/JavaProxyTest</ejb-ref-name>

<jndi-name>ejb/JavaProxyTest</jndi-name>

</ejb-ref>

<session-props/>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

The java class that invokes the proxy bean has follwoing lines of code......

Context ctx = null;

Object ref = null;

Properties p = new Properties();

p.put(Context.INITIAL_CONTEXT_FACTORY,"com.sap.engine.services.jndi.InitialContextFactoryImpl");

p.put(Context.PROVIDER_URL, "zhmscad5:50000");

p.put(Context.SECURITY_PRINCIPAL, "qqsaraa");

p.put(Context.SECURITY_CREDENTIALS, "patni123");

System.out.println("1.0 -


JavaProxy_BSER cONTEXT cREATED");

ctx = new InitialContext(p);

System.out.println("1.1 -


JavaProxy_BSER cONTEXT cREATED");

queryOutLocalHome =(USERNAMESYNCABSMI_PortTypeLocalHome)ctx.lookup("/localejbs/sap.com/JavaProxyTest");

.

.

.

When we are trying to send the data through .jsp file we are getting the following error:

Error:

com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at java:comp, the whole lookup name is java:comp/env/ejb/JavaProxyTest

I am unable to figure out what should be JNDI name and how to use it in the java file

queryOutLocalHome =(USERNAMESYNCABSMI_PortTypeLocalHome)ctx.lookup("/localejbs/sap.com/JavaProxyTest");

Any help on the above issue will be appriciated.

Thanks

Abinash

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hello,

I am calling ejb from .jsp use following code

Properties props = new Properties();

InitialContext ctx = new InitialContext();

Object ob = ctx.lookup("java:comp/env/ejb/CalculatorBean");

CalculatorHome home = (CalculatorHome) PortableRemoteObject.narrow(ob, CalculatorHome.class);

calc = home.create();

I have a error:

java.lang.ClassNotFoundException: class com.sap.examples.calculator.beans.CalcProxy : com.sap.engine.services.jndi.persistent.exceptions.NameNotFoundException: Path to object does not exist at calculator, the whole lookup name is java:comp/env/ejb/CalculatorBean

My ejb-jar.xml is:

<display-name>

CalculatorEjb</display-name>

<enterprise-beans>

<session>

<icon/>

<ejb-name>Calculator</ejb-name>

<home>com.sap.examples.calculator.CalculatorHome</home>

<remote>com.sap.examples.calculator.CalculatorRemote</remote>

<local-home>com.sap.examples.calculator.CalculatorLocalHome</local-home>

<local>com.sap.examples.calculator.CalculatorLocal</local>

<service-endpoint>com.sap.examples.calculator.CalculatorServiceEndpoint</service-endpoint>

<ejb-class>com.sap.examples.calculator.CalculatorBean</ejb-class>

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

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

<ejb-ref>

<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>

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

<home>com.sap.examples.calculator.CalculatorHome</home>

<remote>com.sap.examples.calculator.CalculatorRemote</remote>

<ejb-link>Calculator</ejb-link>

</ejb-ref>

<ejb-local-ref>

<description/>

<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>

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

<local-home>com.sap.examples.calculator.CalculatorLocalHome</local-home>

<local>com.sap.examples.calculator.CalculatorLocal</local>

<ejb-link>Calculator</ejb-link>

</ejb-local-ref>

</session>

</enterprise-beans>

my ejb-j2ee-engine.xml is:

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

<ejb-j2ee-engine

xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"

xsi:noNamespaceSchemaLocation="ejb-j2ee-engine.xsd">

<enterprise-beans>

<enterprise-bean>

<ejb-name>Calculator</ejb-name>

<ejb-ref>

<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>

<jndi-name>ejb/CalculatorBean</jndi-name>

</ejb-ref>

<ejb-local-ref>

<ejb-ref-name>ejb/CalculatorBean</ejb-ref-name>

<jndi-name>ejb/CalculatorBean</jndi-name>

</ejb-local-ref>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

stefan_grube
Active Contributor
0 Kudos

The call is:

Context ctx = new InitialContext();
queryOutLocalHome =(USERNAMESYNCABSMI_PortTypeLocalHome)ctx.lookup ("java:comp/env/ejb/JavaProxyTest");

You must set the EJB reference in the <b>web.xml</b>:

<ejb-local-ref>
  <ejb-ref-name>ejb/JavaProxyTest</ejb-ref-name>
  <ejb-ref-type>Session</ejb-ref-type>
  <local-home> ... </local-home>
  <local> ... </local>
  <ejb-link> ... </ejb-link>
</ejb-local-ref>

Hope that helps

Stefan

Former Member
0 Kudos

If your ejb-j2ee-engine.xml has the following entry for JNDI name for your Java proxy,

<b><jndi-name>JavaProxyTest</jndi-name></b>

then your lookup code should be

queryOutLocalHome =(USERNAMESYNCABSMI_PortTypeLocalHome)ctx.lookup("localejbs/JavaProxyTest");

Rgds,

Amol

former_member189324
Contributor
0 Kudos

Hi Abinash,

There is a how to guide: "How To Work with XI 3.0 Java

Proxies Version 1.00 – January 2006" in Service Marketplace. Download the guide for more information.

Thanks

Prasad