cancel
Showing results for 
Search instead for 
Did you mean: 

Starting with JCO - RFC_COMMUNICATION_ERROR

Former Member
0 Kudos

Hello experts.

I'm currently starting to use JCo and I really lack basic knowledge on it.

Thus, I'm following the tutorial of SAP Java Connector - Standalone version.

First step: connect to the ECC system.

This is what I've done:



public class MyClass {

	static String DESTINATION_NAME1 = "ABAP_AS_WITHOUT_POOL";

	static void createDestinationDataFile(String destinationName,Properties connectProperties) {
		File destCfg = new File(destinationName+".jcoDestination");
		try {
			FileOutputStream fos = new FileOutputStream(destCfg,false);
			connectProperties.store(fos, "for tests only !");
			fos.close();
		}catch (Exception e){
			throw new RuntimeException("Unable to create the destination files", e);
		}
	}
	
	public static void step1Connect() throws JCoException {
		JCoDestination destination = JCoDestinationManager.getDestination(DESTINATION_NAME1);
		System.out.println("Attributes:");
		System.out.println(destination.getAttributes());
		System.out.println("end");
	}	
	
	public static void main(String[] args) throws JCoException{
		Properties connectProperties = new Properties();
		connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST,myHost);
		connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR,sysNum);
		connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT,"800");
		connectProperties.setProperty(DestinationDataProvider.JCO_USER,myUser);
		connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD,myPswd);
		connectProperties.setProperty(DestinationDataProvider.JCO_LANG,"en");
		createDestinationDataFile(DESTINATION_NAME1,connectProperties);
		
		step1Connect();
	}
}

I have no clue in what's wrong in here. Do I have to do sth previously in the ECC system? Thanks for your time and help. Regards, C.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Sorry.

This is What I'm getting:

Exception in thread "main" com.sap.conn.jco.JCoException: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed

Connection parameters: TYPE=A DEST=ABAP_AS_WITHOUT_POOL ASHOST=myHost SYSNR=06 PCS=1

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

ERROR partner 'myHost:3306' not reached

TIME Thu Sep 17 16:28:23 200

RELEASE 711

COMPONENT NI (network interface)

VERSION 39

RC -10

MODULE nixxi.cpp

LINE 3150

DETAIL NiPConnect2: 192.168.109.2:3306

SYSTEM CALL connect

ERRNO 10060

ERRNO TEXT WSAETIMEDOUT: Connection timed out

COUNTER 2

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

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

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

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

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

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

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

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

at com.sap.conn.jco.rt.RfcDestination.getAttributes(RfcDestination.java:637)

at com.sap.conn.jco.rt.RfcDestination.getAttributes(RfcDestination.java:26)

at MyClass.step1Connect(MyClass.java:43)

at MyClass.main(MyClass.java:61)

Caused by:

RfcException: [null]

message: Connect to SAP gateway failed

Connection parameters: TYPE=A DEST=ABAP_AS_WITHOUT_POOL ASHOST=myHost SYSNR=06 PCS=1

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

ERROR partner 'myHost:3306' not reached

TIME Thu Sep 17 16:28:23 200

RELEASE 711

COMPONENT NI (network interface)

VERSION 39

RC -10

MODULE nixxi.cpp

LINE 3150

DETAIL NiPConnect2: 192.168.109.2:3306

SYSTEM CALL connect

ERRNO 10060

ERRNO TEXT WSAETIMEDOUT: Connection timed out

COUNTER 2

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:83)

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

... 10 more

Former Member
0 Kudos

I'm sorry but I don' know why I cannot use the markup tags...

To connect to my ECC system through the sap logon, I use the route 192.168.222.182.

I see that in the error message, theres a "NiPConnect2: 192.168.109.2". I don't know what it is, but if the error is generated because of this ip, how can I change it when connecting to a destination?

Hope I'm clear enough. Feel free to ask if not.

Thanks for your time and answers.

Regards,

C.

Former Member
0 Kudos

Hi,

R u creating RFC to ECC and Java system right?

1) create a RFC in ECC system with registered program.

2) Create JCo RFC provider in Java system and specify the same registered program name as given in ECC system.

3) /etc/host file maintain

ECC system: maintain Java system host name

JAVA system: maintain ECC system host name.

Regards

Gangadhar

Former Member
0 Kudos

Hi gangadhar hm,

Thank you for you answer.

However, I still don't get it.

1) create a RFC in ECC system with registered program.

I want to access a BAPI, so the RFC program already exists.

2) Create JCo RFC provider in Java system and specify the same registered program name as given in ECC system.

When I saw your post, I searched for "JCo RFC provider". I found [this help documentation|http://help.sap.com/saphelp_nw2004s/helpdata/en/be/6e0f41218ff023e10000000a155106/content.htm]. Is this what I'm supposed to do?

How come there's nothing mentionned in the JCo standalone version's documentation?

3) /etc/host file maintain
ECC system: maintain Java system host name
JAVA system: maintain ECC system host name.

Did not really get that...

Also, what about the "NiPconnect2"?

Thanks again for any help you can provide.

Regards,

C.

Former Member
0 Kudos

Hi Cristina,

Can you please clarify me that u

1) Wants to connect ECC system and JAVA system right??

IF YOU ARE CONNECTING.....THEN ..Follow the steps below

Maintain the RFC Connections (ABAP)

1) Call transaction SM59.

2) Choose Create.

3) Enter at least the following:

RFC destination: ECC_TO_JAVA

Connection type: T

Description: <your description>

4) Choose ENTER.

5) Choose the Technical settings tab and do the following:

a. Select Registered Server Program.

b. In the Program ID field, enter: ECCJAVA

6) Enter Gateway host and Gateway service of your Server host (JAVA HOSTNAME)

7) Save the settings

Configure the Destinations (Java)

Start the J2EE Engine Visual Administrator.

1) Cluster >Server >Services > JCo RFC Provider

2) In the RFC destination section, Type ECC_TO_JAVA

3) Enter the program ID = ECCJAVA

4) In the Repository section, do the following:

a. Enter the parameters for the Integration Server host: Application Server, System Number, Client, and Language.

b. For User and Password maintain the login parameters for the user SAPJSF.

c. Select the Unicode flag.

5) Choose Set.

Test the RFC from ECC system.

Regards

Gangadhar

Edited by: gangadhar hm on Sep 18, 2009 5:15 PM

Former Member
0 Kudos

Hi!

What I want to do is the following:

I have a Java application (developed with eclipse) (independent of SAP).

I want to use RFC via JCo to be able to expose a ECC system's data in my Java application.

Hope it clarifies.

Thx.

Regards,

C.

Former Member
0 Kudos

Hi.

I was missing the "SAPROUTER" property in my properties file.

It's working fine now 😃

Regards.

C.