cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to connect the SAP Server Using Jco

Former Member
0 Kudos

Hi Folks,

    I am having problems in getting the Jco connected to the SAP system. From the same system I'm able to logon to the respective SAP system using the SAP GUI. The below is the log.

  1. ap.conn.jco.support.JRfcServ

Syntax for start and run in registered mode or via fastrfc:

        JRfcServ [options]

options = -a<program ID>                   e.g.  <own host name>.srfcserv

        = -g<SAP gateway host name>        e.g.  hs0311

        = -x<SAP gateway service>          e.g.  sapgw53

        = -c<connection count>             e.g.  2

        = -u                               only for unicode server

        = -t<Level>    RFC/JCo-Trace on    e.g.  5

        = -L<SNC library, optional>

        = -S<SNC myname, optional>

        = -Q<SNC quality of protection, optional>

Option L, S and Q can be set if working with SNC (Secure Network

Communication). In order to register a server at a gateway use

options a, g and x. For fastrfc apply the option profile_name.

    Available server configurations:

    SAPRPR

Enter server name....................... :SAPRPR

Loaded properties for the server SAPRPR

Server configuration data

Program id..............................:PROGRAM_ID

Gateway host............................:220.XXX.XX.XX2

Gateway service.........................:sapgw02

Repository destination..................:SAPRPR

  1. Connections.............................:2

RFC trace (1/0)0........................:0

use this parameters (Y/N) [Y] :Y

Loaded properties for the destination SAPRPR

Server type :...........................:A

Logon data

  1. Client..................................:800
  2. UserID..................................:user
  3. Password................................:password
  4. Language (EN)...........................:en
  5. Destination.............................:SAPRPR

RFC trace (1/0)0........................:1

use this parameters (Y/N) [Y] :Y

           Exception

  1. com.sap.conn.jco.JCoException: (102) JCO_ERROR_COMMUNICATION: Unable to get repository

        at com.sap.conn.jco.rt.DefaultServer.update(DefaultServer.java:219)

        at com.sap.conn.jco.rt.DefaultServer.<init>(DefaultServer.java:118)

        at com.sap.conn.jco.rt.DefaultServerManager$DefaultServerFactory.createServer(DefaultServerManager.java:328)

        at com.sap.conn.jco.rt.DefaultServerManager.getServer(DefaultServerManager.java:108)

        at com.sap.conn.jco.rt.StandaloneServerFactory.update(StandaloneServerFactory.java:363)

        at com.sap.conn.jco.rt.StandaloneServerFactory.getServerInstance(StandaloneServerFactory.java:176)

        at com.sap.conn.jco.server.JCoServerFactory.getServer(JCoServerFactory.java:74)

        at com.sap.conn.jco.support.JRfcServ.startServer(JRfcServ.java:55)

        at com.sap.conn.jco.support.JRfcServ.main(JRfcServ.java:215)

Caused by: com.sap.conn.jco.JCoException: (102) JCO_ERROR_COMMUNICATION: Connect from SAP gateway to RFC server failed

Connection parameters: TYPE=A DEST=SAPRPR ASHOST=220.XXX.XX.XX1 SYSNR=05 PCS=1

LOCATION    SAP-Gateway on host TESTSAP / sapgw05

ERROR       timeout during allocate

TIME        Tue Mar 27 13:51:50 2012

RELEASE     700

COMPONENT   SAP-Gateway

VERSION     2

RC          242

MODULE      gwr3cpic.c

LINE        1973

DETAIL      no connect of TP sapdp05 from host 220.XXX.XX.X1 after 20 sec

COUNTER     3

        at com.sap.conn.jco.rt.MiddlewareJavaRfc.generateJCoException(MiddlewareJavaRfc.java:666)

        at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.connect(MiddlewareJavaRfc.java:1364)

        at com.sap.conn.jco.rt.ClientConnection.connect(ClientConnection.java:731)

        at com.sap.conn.jco.rt.PoolingFactory.init(PoolingFactory.java:103)

        at com.sap.conn.jco.rt.ConnectionManager.createFactory(ConnectionManager.java:293)

        at com.sap.conn.jco.rt.DefaultConnectionManager.createFactory(DefaultConnectionManager.java:46)

        at com.sap.conn.jco.rt.ConnectionManager.getFactory(ConnectionManager.java:262)

        at com.sap.conn.jco.rt.RfcDestination.initialize(RfcDestination.java:509)

        at com.sap.conn.jco.rt.RfcDestination.getSystemID(RfcDestination.java:533)

        at com.sap.conn.jco.rt.RepositoryManager.getRepository(RepositoryManager.java:30)

        at com.sap.conn.jco.rt.RfcDestination.getRepository(RfcDestination.java:603)

        at com.sap.conn.jco.rt.RfcDestination.getRepository(RfcDestination.java:27)

        at com.sap.conn.jco.rt.DefaultServer.update(DefaultServer.java:215)

        ... 8 more

Caused by: RfcException: [null]

    message: Connect from SAP gateway to RFC server failed

Connection parameters: TYPE=A DEST=SAPRPR ASHOST=220.XXX.XX.XX1 SYSNR=05 PCS=1

LOCATION    SAP-Gateway on host SONATASAP / sapgw05

ERROR       timeout during allocate

TIME        Tue Mar 27 13:51:50 2012

RELEASE     700

COMPONENT   SAP-Gateway

VERSION     2

RC          242

MODULE      gwr3cpic.c

LINE        1973

DETAIL      no connect of TP sapdp05 from host 220.XXX.XX.XX1 after 20 sec

COUNTER     3

    Return code: RFC_FAILURE(1)

    error group: 102

    key: RFC_ERROR_COMMUNICATION

        at com.sap.conn.rfc.engine.RfcIoControl.error_end(RfcIoControl.java:255)

        at com.sap.conn.rfc.engine.RfcIoControl.ab_rfcopen(RfcIoControl.java:94)

        at com.sap.conn.rfc.api.RfcApi.RfcOpen(RfcApi.java:86)

        at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.connect(Middlewar

  1. eJavaRfc.java:1331)

        ... 19 more

    Available server configurations:

    SAPRPR

Enter server name....................... :

Accepted Solutions (0)

Answers (8)

Answers (8)

Former Member
0 Kudos

Hi Santosh,

Just to check have you got the sapMS<SID> <Port> entries in your /etc/services file and the telnet command working.

Services file entries mustbe :-

sapms<SID> <port no>

And command to test the port connectivity using telnet.

telnet <hostname> <gateway port no,>

Do let us know the output.

Do verify the Secinfo / Reginfo as mentioned by dishant.

Let us know the outcome.

And it seems to be old thread and so guys if your facing simmilar issue do open up a new thread so that we can help you accordingly.

Regards,

Ram

Former Member
0 Kudos

Hi

you might also want to check following two files on ECC

Secinfo / Reginfo

they are related to SAP Gateway. rules in them might Blocking your jco connection

please refer following link for your reference .

https://help.sap.com/saphelp_nw73/helpdata/en/e2/16d0427a2440fc8bfc25e786b8e11c/content.htm

Regards

Dishant

Former Member
0 Kudos

Hello,

The things you need to check are:

1. Backend SLD registration is ok?

2. /etc/hosts file contains the backend systems?

3. /etc/services file contains sapmsSID of the backend systems?

4. Try to deactivate the local firewall.

5. Ping hostname and telnet gw port 33XX of the backend systems.

6. Check the gateway security settings in SMGW, maybe the configuration is blocking the connection.

Let me know how it goes.

Michael

Former Member
0 Kudos

Hi.

How can I add to the /etc/hosts file the backend system.

I have the same error, and are compiling all the solutions I read, trying each one.

i need to test these:

1. Backend SLD registration is ok?

2. /etc/hosts file contains the backend systems?

5. Ping hostname and telnet gw port 33XX of the backend systems.


I did the 5, but it returned a connection error. Should I ask for the ports to be opened?

Former Member
0 Kudos

Hi,

I am also facing similar kind of issue while we are trying to connect to SAP Box from our Java application using JCO SAP connector API. This issue is very strange as it is coming only for one SAP Box. While for other SAP Boxes it is working fine.

Please find below the error I am getting while connecting to SAP Box :

SNC Connection
[2014-04-11 16:05:39,892] [      main] AllBAPIConnectivityTest_8144  :414  ERROR Exception while executing BAPI_COSTCENTER_GETLIST1:

com.sap.mw.jco.JCO$Exception
: (102) RFC_ERROR_COMMUNICATION: SAP_CMINIT3 : rc=20 > Connect to SAP gateway failed
Connect_PM  GWHOST=/H/xxx.xxx.xxx.xxx/S/xxxx, GWSERV=sapgwxx, SYSNR=xx


LOCATION    CPIC (TCP/IP) on local host

ERROR       partner not reached (host xxx.xxx.xxx.xxx, service xxxx)

TIME        Fri Apr 11 16:05:39 201

RELEASE     640

COMPONENT   NI (network interface)

VERSION     37

RC          -10

MODULE      nixxi_r.cpp

LINE        8840

DETAIL      NiPConnect2

SYSTEM CALL SiPeekPendConn

ERRNO       10060

ERRNO TEXT  WSAETIMEDOUT: Connection timed out

COU


martin_juen2
Contributor
0 Kudos

Hi,

try to open a telnet connection to the relevant server / port (from your java box).

If this is NOT working, i suggest to check your firewall settings. If it's working it could be a problem with the gateway security of the target system (ABAP).

kind regards,

Martin

Former Member
0 Kudos

Hi Santosh,

the issue caused by an empty entry in SM59 under TCP/IP

or if you using a load balancer or logon group. For this case you need to connect to a message server and not application server

change ahost property to mshost property

Best regards

Maik

Former Member
0 Kudos

Hi,

Can you please provide dev_jrfc.trc.

Regards,

Venkata S Pagolu.


martin_juen2
Contributor
0 Kudos

... Connect from SAP gateway to RFC server failed ...

Please check the gateway trace of the SAP system  (TA SMGW). Maybe you will find an information there.

regards, Martin

Former Member
0 Kudos

Hi,

Please check the repository information you provided is the target system and it must be defined in Connections  properly with username and password.

Thanks,

Subhash.G