cancel
Showing results for 
Search instead for 
Did you mean: 

Cannot connect java to SAP via JCo.......

PAL14
Participant
0 Kudos

On calling an ABAP application from java via JCo there was an error saying

Exception in thread "main" com.sap.conn.jco.JCoException: (102) RFC_ERROR_COMMUN

ICATION: Connect to SAP gateway failed

Connection parameters: TYPE=A DEST=ABAP_AS_WITHOUT_POOL ASHOST= SYSNR= GWH

OST=JCO_SAP GWSERV=SAPGW00 PCS=1

LOCATION CPIC (TCP/IP) on local host with Unicode

ERROR hostname 'JCO_SAP' unknown

TIME Thu May 07 17:45:07 200

RELEASE 711

COMPONENT NI (network interface)

VERSION 39

RC -2

MODULE ninti.c

LINE 895

DETAIL NiPGetHostByName: 'JCO_SAP' not found

SYSTEM CALL getaddrinfo

COUNTER 2

where 'JCO_SAP' was my RFC destination.

i have hardcoded ASHOST, SYSNR,CLIENT, USER,PASSWD,GWHOST,GWSERV,TPNAME and LANG in my java program.

Is this the correct way to pass these parameters or is there any way to these values via SAP.

how to create program ID in rfc destination??????

I have given the activation type as Registered Server Program, should i need to do anything more to establish rfc connection..........

Accepted Solutions (1)

Accepted Solutions (1)

ravindra_bollapalli2
Active Contributor
0 Kudos

hi,

refer this link

http://www.vogella.de/articles/SAPJCo/article.html

let me know u need any further infor

bvr

PAL14
Participant
0 Kudos

hi thks for the link......

i have already written the similar code in java yet connect not established with SAP. is anything i have to do to configure in SAP side to get the connection?

ravindra_bollapalli2
Active Contributor
0 Kudos

hi,

are u able to ping the r3 system system ...

like you keep the control points so that where the error is getting

let me know u need any further infor

bvr

l

Former Member
0 Kudos

Edit your host file. Host file path for window Start-> select run enter drivers in run edit host file in folder etc by notepad and enter your sap ip and host name as follows.

Copyright (c) 1993-1999 Microsoft Corp.

#

  1. This is a sample HOSTS file used by Microsoft TCP/IP for Windows.

#

  1. This file contains the mappings of IP addresses to host names. Each

  2. entry should be kept on an individual line. The IP address should

  3. be placed in the first column followed by the corresponding host name.

  4. The IP address and the host name should be separated by at least one

  5. space.

#

  1. Additionally, comments (such as these) may be inserted on individual

  2. lines or following the machine name denoted by a '#' symbol.

#

  1. For example:

#

  1. 102.54.94.97 rhino.acme.com # source server

  2. 38.25.63.10 x.acme.com # x client host

127.0.0.1 localhost

124.153.68.161 nmsapdev

192.168.75.4 nmsapqas

192.168.75.5 NMSAPPRD1

Answers (0)