cancel
Showing results for 
Search instead for 
Did you mean: 

Exception in JCo used in EJB (WebService)

Former Member
0 Kudos

Hi,

I'm trying to create a webservice of an EJB that has JCo code to call an RFC.

The EJB has no syntactical errors. The WebService generation as well as the EAR deployment is successful.

When trying to test the WebService from WebServices Navigator, I'm getting an exception (SOAP response)

"com.sap.engine.services.ejb.exceptions.BaseEJBException" within the (WS) method.

What can be the possible cause for the JCo code that throws this exception when running in an EJB?

I tried the same method from a standalone JCo Client class and it connects the RFC successfully.

Also when the definition of the method is empty with only one statement as return "hai"; then webservice has no errors.

This is my code... only with "mConnection.connect();" throwing the exception

-


import com.sap.mw.jco.*;

public class JCo_Connect extends Object {

JCO.Client mConnection;

JCO.Repository mRepository;

public JCo_Connect() {

try {

// Change the logon information to your own system/user

mConnection =

JCO.createClient("001", // SAP client

"<userid>", // userid

"****", // password

"en", // language

"<hostname>", // application server host name

"00"); // system number

mConnection.connect();

mRepository = new JCO.Repository("SAP", mConnection);

}

catch (Exception ex) {

ex.printStackTrace();

System.exit(1);

}

mConnection.disconnect();

}

public static void main (String args[]) {

JCo_Connect app = new JCo_Connect();

}

}

Any help is highly appreciated.

Thanks in advance.

Regards,

Vijay Kalyan G.

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

It seems that your code is throwing a runtime exception that you don't catch. So the session bean throws an BaseEJBException.

Try to catch full Exceptions in the EJB code and throw a new EJBException with the full trace, so you can look for the real cause.

try {

<jco code>

} catch (Exception e) {

throw new EJBException(e.getLocalizedMessage(), e);

}

Regards.

Former Member
0 Kudos

Oops, I have pasted my client code program... with the main() method.

Kindly look into the JCo_Connect() method which is actually causing problem in EJB.

Thanks,

Vijay Kalyan G.