cancel
Showing results for 
Search instead for 
Did you mean: 

Java Proxy: Path to object does not exist...

Former Member
0 Kudos

Ciao!

I have implemented test outbound proxy scenario.

When I try to run a java test program from NWDS, i received the following error:

Path to object does not exist at java:comp, the whole lookup name is java:comp/env/ejb/MIZPROTOTIPOOUT_PortTypeBean.

count = 0, total = 11

I initialize context in this mean:

......

Properties p = new Properties();

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

p.put(Context.PROVIDER_URL, "server:50004");

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

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

Context ctx = new InitialContext(p);

// Look up jndi name of proxy bean

queryOutLocalHome = (MIZPROTOTIPOOUT_PortTypeLocalHome)ctx.lookup("java:comp/env/ejb/MIZPROTOTIPOOUT_PortTypeBean");

......

where is the error??

Thanks in advances

Ale

Accepted Solutions (1)

Accepted Solutions (1)

stefan_grube
Active Contributor
0 Kudos

When you call an EJB from outside of the server then you have to put the JNDI name directly into the query string.

An java:comp/env/ejb environment is only available, when you call an EJB from another EJB or from a servlet/jsp.

queryOutLocalHome = (MIZPROTOTIPOOUT_PortTypeLocalHome)ctx.lookup("<Your_JNDI_name>");

Look in the visual admin for the correct JNDI name.

Check out this how-to guide for further details:

https://websmp105.sap-ag.de/~form/sapnet?_SHORTKEY=01200252310000071155&_SCENARIO=011000358700000001...

Regards

Stefan

Answers (1)

Answers (1)

Former Member
0 Kudos

Ok, thanks for link.

I call proxy from an external java class.

Now i change initialization but i receive the message:

null

count = 0, total = 11

my ejb.jar.xml is:

<?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>

<display-name>MIZPROTOTIPOOUT_PortTypeBean</display-name>

<ejb-name>MIZPROTOTIPOOUT_PortTypeBean</ejb-name>

<home>prototipoIcms.MIZPROTOTIPOOUT_PortTypeHome</home>

<remote>prototipoIcms.MIZPROTOTIPOOUT_PortTypeRemote</remote>

<local-home>prototipoIcms.MIZPROTOTIPOOUT_PortTypeLocalHome</local-home>

<local>prototipoIcms.MIZPROTOTIPOOUT_PortTypeLocal</local>

<ejb-class>prototipoIcms.MIZPROTOTIPOOUT_PortTypeBean</ejb-class>

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

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

<ejb-local-ref>

<ejb-ref-name>ejb/MIZPROTOTIPOOUT_PortTypeBean</ejb-ref-name>

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

<local-home>prototipoIcms.MIZPROTOTIPOOUT_PortTypeLocalHome</local-home>

<local>prototipoIcms.MIZPROTOTIPOOUT_PortTypeLocal</local>

<ejb-link>MIZPROTOTIPOOUT_PortTypeBean</ejb-link>

</ejb-local-ref>

</session>

</enterprise-beans>

</ejb-jar>

any suggestion?

stefan_grube
Active Contributor
0 Kudos

When exactly do you get the message, what is your code?

Regards

Stefan

Former Member
0 Kudos

I receive this message when I call proxy from my external java class.

I created this class in a simple java project inside mi NWDS.

Java proxy are deployed inside J2EE server (XI).

The code of this class is the following.

public class JavaProxyCall {

public static void main(String[] args) {

MIZPROTOTIPOOUT_PortTypeLocalHome queryOutLocalHome=null;

MIZPROTOTIPOOUT_PortTypeLocal queryOutLocal=null;

String data1 = "aaaa";

String data2 = "11111";

String Out = "";

// check for EJB class on server

try {

// Get naming context

Properties p = new Properties();

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

p.put(Context.PROVIDER_URL, "server:50004");

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

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

Context ctx = new InitialContext(p);

// Look up jndi name of proxy bean

queryOutLocalHome = (MIZPROTOTIPOOUT_PortTypeLocalHome)ctx.lookup("MIZPROTOTIPOOUT_PortTypeBean");

// Cast to Home interface

queryOutLocal = queryOutLocalHome.create();

MessageSpecifier msg = queryOutLocal.$messageSpecifier();

msg.setSenderService("BS_XID_PROXY");

queryOutLocal.$messageSpecifier(msg);

DTZPROTOTIPOOUT_Type reqtype = new DTZPROTOTIPOOUT_Type();

DTZRETURN_Type ciccio = new DTZRETURN_Type();

reqtype.setData1(data1);

reqtype.setData2(data2);

.........

.........

stefan_grube
Active Contributor
0 Kudos

Hi Alessandro,

Before you deploy the EAR file make sure that proxy libraries are not contained. Remove them with WinZip if necessary.

Regards

Stefan

Former Member
0 Kudos

I removed libraries but result don't change...