cancel
Showing results for 
Search instead for 
Did you mean: 

EJB Connection

Former Member
0 Kudos

Hello,

I have programmed JSP application with EJB that is using BAPI's and it is running on SAP J2EE server.

I have no idea how to use remote EJB on simple Java application.

can anybody help?.

Thank you in advance.

Thamas.

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

see the following link:

Kind Regards,

S.Saravanan.

suresh_krishnamoorthy
Active Contributor
0 Kudos

Hi,

Create simple java applcation do the following steps:

public class SSample {

public static void main(String[] args) {

SampleEJB remote = null;

try {

Context ctx = new InitialContext();

SampleEJBHome home = (SampleEJBHome) ctx.lookup("SampleJNDI");

remote = home.create();

} catch (Exception e) {

System.out.println("Exception:" + e.getLocalizedMessage());

}

String result = remote.add(aFirst,aSecond,);

System.out.print("Result:" + result);

} catch (Exception ex) {

System.out.println("Exception:" + ex.getLocalizedMessage());

}

}

}

Go To Run > choose your program(client program to call ejb method) >

Arguments : VM Environment

paste the following code

-Djava.naming.factory.initial=com.sap.engine.services.jndi.InitialContextFactoryImpl -Djava.naming.provider.url=192.168.0.100:50004

replace the server IP address with your server IP address where your ejbs are running.

Under Class path settings for the program put the following jar files.

You can search for them from net weaver soruce folders

or copy from c:\usr\... (search under this folder)

connector.jar

activation.jar

ejb20.jar

ogging.jar

exception.jar

sapj2eeclient.jar

sapj2eenginedeploy.jar

and RUN >>>

this makes testing of your client programs easier, you can find the error trace on which line and saves lot of time.

Regards

Suresh KB

Former Member
0 Kudos

Thanks,

My problem solved.

Answers (0)