cancel
Showing results for 
Search instead for 
Did you mean: 

"JCO.Server cound not find sever function 'Z_sampleBean'"

Former Member
0 Kudos

On the Web As side, I have created an RFC-enabled function named "Z_sampleBean" which I am attempting to call. This a stateless session bean which has been successfully deployed, and the RFC destination has been set up correctly and tests ok.

The JNDI directory contains an entry at the root level for the bean name. (Visual Administrator display shows a little red box icon and under that entries for [class name] and [object value] - not sure what the icons or the specific entries mean...)

When I make the ABAP call to the JCO Provider Service, I get a dump as shown in the subject line.

Is JCO.server saying he can't find it in the JNDI directory, or that he can't find it in the Web AS repository?

I feeel like I must be missing something pretty obvious, but I don't know what.

I note that case is apparently preserved across the RFC call - are there any case considerations?

Any ideas?

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

Well, with the help of all the good forum folks, I see what was happening: even though I had deployed the bean, I had to ue Visual Administrator to Start the Application. Once I did that, the appropriate entries showed up in the JNDI directory, and I was off and running.

Yee-hah!

Former Member
0 Kudos

Well, I've got to tell you - this is agonizing!

I've modified my bean and projects, etc. to parallel those that Piers listed. It deploys OK, but after the deployment there's NOTHING in the JNDI directory that refers to either the bean name or the JNDI name associated with the bean.

Now what?

Former Member
0 Kudos

Piers: I forgot to answer your question: the signature of the method I'm using is a little different than yours - it returns a JCO.Function object. However, these methods were all generated by the EJB wizard in NetWeaver Dev. Studio - I'm just tkaing them the way they were generated...

Former Member
0 Kudos

Hi David,

My gut reaction is that you must have a void return on that function, and that it is possible that the Server is checking the complete function signature and not finding one that matches even though one of the name processFunction() exists.

My complete example is:

Ejb1Bean.java:

package p1;

import javax.ejb.SessionBean;

import javax.ejb.SessionContext;

import javax.ejb.CreateException;

import com.sap.mw.jco.*;

public class Ejb1Bean implements SessionBean {

public void ejbRemove() {

}

public void ejbActivate() {

}

public void ejbPassivate() {

}

public void setSessionContext(SessionContext context) {

myContext = context;

}

private SessionContext myContext;

/**

  • Business Method.

*/

public void processFunction(JCO.Function function) {

System.err.println("inside processFunction() " + function.getName());

}

public void ejbCreate() throws CreateException {

System.err.println("inside ejbCreate()");

}

}

Ejb1.java:

package p1;

import javax.ejb.EJBObject;

import com.sap.mw.jco.*;

import java.rmi.RemoteException;

public interface Ejb1 extends EJBObject {

public void processFunction(JCO.Function function) throws RemoteException;

}

Ejb1Home.java:

package p1;

import javax.ejb.EJBHome;

import java.rmi.RemoteException;

import javax.ejb.CreateException;

public interface Ejb1Home extends EJBHome {

public Ejb1 create() throws CreateException, RemoteException;

}

Ejb1Local.java:

package p1;

import javax.ejb.EJBLocalObject;

import com.sap.mw.jco.*;

public interface Ejb1Local extends EJBLocalObject {

public void processFunction(JCO.Function function);

}

Ejb1LocalHome.java:

package p1;

import javax.ejb.EJBLocalHome;

import javax.ejb.CreateException;

public interface Ejb1LocalHome extends EJBLocalHome {

public Ejb1Local create() throws CreateException;

}

Thats it! And it works:

The only other thing I would add, is that my ejb-j2ee-engine.xml looks like:

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

<!DOCTYPE ejb-j2ee-engine SYSTEM "ejb-j2ee-engine.dtd">

<ejb-j2ee-engine>

<enterprise-beans>

<enterprise-bean>

<ejb-name>Ejb1Bean</ejb-name>

<jndi-name>RFC_READ_TABLE</jndi-name>

<session-props/>

</enterprise-bean>

</enterprise-beans>

</ejb-j2ee-engine>

Cheers,

Piers Harding.

Former Member
0 Kudos

Hi Piers,

just a hint: The return type and exception list of a method don't matter if this method is searched via Java reflection. So:

public void methodA(String name)
and
public int methodA(String name) throws RuntimeException

are identical for the search, since it's not possible in Java to define two methods with the same name and parameters, but different return type in a single class.

Best regards

Stefan

Former Member
0 Kudos

Ah - thanks for that. I didn't know about return types, but then I don't know much about Java :-).

Cheers,

Piers Harding.

Former Member
0 Kudos

...then i suggest to learn it. It will become more and more important in the future and the best fact is, it doesn't bite

Cheers

Stefan

PS: I would definitely enjoy to see one of your next blogs describing some hack in the J2EE world

Former Member
0 Kudos

Well, I got it so that I have an entry in JNDI in the root, and it's all in caps, so apparetnly the TFC engine can find it when I call the RFM. (At least it doesn't ay it can't find it!)

Now it complains about not my not having a processFunction() method in my bean. This is patetnly untrue - it's there and I'm looking at it.

So I still think my problem is tied up the JNDI somehow. I'm going to start a new thread on this to see what I can find out.

Thanks for your help!

Former Member
0 Kudos

Well, I've regressed, so I can't test your latest suggestion.

It's my fault, of course, because I've been changing stuff around, but he seems to ignore my specification of a JNDI name in the session been specification.

It's in the ejb-j2ee-engine.xml file:

<jndi-name>Z_SAMPLE_RFC</jndi-name>

but it doesn't seem to get into the JNDI directory - either at the root or anywhere else. It's really making me mad, because I had that working ok an hour ago! Someplace, I found a secret for getting stuff into the JNDI directory, and now I can't find it!

Got any idea how to do that? Do you have to enable JNDI naming or soemthing, to get a name other than the bean name put into the directory?

Former Member
0 Kudos

I changed everything in sight to upper case (but I still don't think that's necessary - I'm just too lazy to find the correct combination of JNDI names, functions names in ABAP, bean names, etc.) and he now appears to find the bean in the JNDI.

However, it now complains that the bean is of the wrong type, because it doesn't have a 'processFunction' method. However, I'm sitting here looking right at it - it's a method on the bean class. Am I missing something simple?

Former Member
0 Kudos

Hi David,

I push my luck, and maybe give another suggestion.

What is the signature of the processFunction() method you have defined?

the test one that I last used looked like:

in Ejb1Bean.java ->

public void processFunction(JCO.Function function) {

System.err.println("inside processFunction() " + function.getName());

}

and it had the corresponding definitions in:

Ejb1.java

Ejb1Local.java

I'm sure that there are more qualified people than me to help you with this one though.

Regards,

Piers Harding.

Former Member
0 Kudos

Thanks, Piers - I'll change some stuff to se if it makes any difference. However, I not the the JCO.Server reported his problem in mixed case, so he apparently saw upper and lower?

I'll change everything in sight to upper and we'll see what happens.

Former Member
0 Kudos

Hi David,

I could be way off the mark, but from an SAP R/3 point of view, RFC names are case sensitive, and are allways in Upper Case, so I would have thought that you had to have a JNDI entry for Z_SAMPLEBEAN.

Regards,

Piers Harding.