cancel
Showing results for 
Search instead for 
Did you mean: 

Calling Java API from ABAP using JCo

Former Member
0 Kudos

I need to call Java API from ABAP & BSP also. For this I have got useful information related to JCo from following blog:

/people/gregor.wolf3/blog/2004/08/26/setup-and-test-sap-java-connector-outbound-connection

But, I am facing one problem. On executing Java program myExample5.java (recommended by Gregor Wolf) from command line I get following error message:

Server JCOSERVER01 changed state from [ STOPPED ] to [ STARTED ]

Exception in server JCOSERVER01:

com.sap.mw.jco.JCO$Exception: (129) JCO_ERROR_SERVER_STARTUP: Server startup failed at Thu Apr 26 13:46:32 IST 2007.

This is caused by either a) erroneous server settings, b) the backend system has

been shutdown, c) network problems. Will try next startup in 1 seconds.

Connect to SAP gateway failed

Connect_PM TPNAME=JCOSERVER01, GWHOST=gateway, GWSERV=3300

LOCATION CPIC (TCP/IP) on local host

ERROR hostname 'gateway' unknown

TIME Thu Apr 26 13:46:32 2007

RELEASE 640

COMPONENT NI (network interface)

VERSION 37

RC -2

MODULE ninti.c

LINE 336

DETAIL NiPGetHostByName2: hostname 'gateway' not found

SYSTEM CALL gethostbyname_r

COUNTER 1.

Can anyone please help me out. Do I need to do any setting?

I'll surely reward points.

Thanks & Regards,

Nilesh Kumar

Accepted Solutions (1)

Accepted Solutions (1)

prashil
Advisor
Advisor
0 Kudos

Hi Nilesh,

From the error i think that the error is with the hostname.

Please enter the the Application Server IP/Hostname.

If you are loggin to SAP System "XX1" from SAP GUI. Then click the change Item tab and see Application server name/IP let say "XX2" for hostname or "xx.xx.xx.xx" for IP.

Replace <i>srv[0] = new Server("gateway","sapgw00","JCOSERVER01",repository);</i>

with <i>srv[0] = new Server("XX2","sapgw00","JCOSERVER01",repository);</i>

If App Server is IP then replace with

<i>srv[0] = new Server("xx.xx.xx.xx","sapgw00","JCOSERVER01",repository);</i>

Let me know if it is throwing any error.

Thanks,

Prashil

Answers (2)

Answers (2)

Benny
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Nilesh,

Gregor has already given you the right answer. Nevertheless it may be a good idea to read the docs on this also:

http://help.sap.com/saphelp_nw2004s/helpdata/en/6c/934a4278bbb56be10000000a155106/frameset.htm

Former Member
0 Kudos

Thanks Prashil.

This has worked. I am awarding you points.

Regards,

Nilesh Kumar