cancel
Showing results for 
Search instead for 
Did you mean: 

RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed

Former Member
0 Kudos

HI All,

Im getting the following error while trying to call a RFC through JCO.




{0}#1#com.sap.mw.jco.JCO$Exception: (102) RFC_ERROR_COMMUNICATION: Connect to SAP gateway failed
Connect_PM  TYPE=A ASHOST=R3ip SYSNR=00 GWHOST=R3ip GWSERV=sapgw00 PCS=1

LOCATION    CPIC (TCP/IP) on local host with Unicode
ERROR       hostname 'R3ip' unknown

TIME        Thu May 15 12:13:36 2008
RELEASE     700
COMPONENT   NI (network interface)
VERSION     38
RC          -2
MODULE      niuxi.c
LINE        1529
DETAIL      NiPGetHostByName2: hostname 'R3ip' not found
SYSTEM CALL gethostbyname_r
COUNTER     1

I know it has something to do with the entries in the services and hosts files of the portal server. Please guide me on links from help.sap.com on this.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

Hi S.B,

These threads might help resolve your issue.

Cheers,

Sandeep Tudumu

Former Member
0 Kudos

Hi Sandeep,

One of the posts says that I need to do the following entry in my services file :

sapgw00 3300/tcp

The question is "How do you reach the figure 3300" ?

Its no where in the error log

Regds

Former Member
0 Kudos

Question 2 :

I checked SMLG in my backend and there is no group defined in there. I believe I need to have PUBLIC for RFC's to work.

Please correct and advice.

Thanks

Former Member
0 Kudos

Hi,

I think the standard is 3300 + System id to you backend system.

Since the entry is sapgw00, the system id is 0 and 3300+0 = 3300

If the entry was sapgw12, the system id would be 12 and the port would be 3300+12 = 3312

Regards

Dagfinn

Former Member
0 Kudos

HI Dagfinn,

1. Is there a link on the help.sap.com or elsewhere where they give details of this entry.

2. I would like to know how do I get my system number.

3. This entry 3300+System Number has to be in the services file of my portal server. right ?

4. What entry do I need to do in my "Hosts" file of my portal server.

Thanks

Former Member
0 Kudos

1.

http://help.sap.com/saphelp_46c/helpdata/en/bb/9f18124b9b11d189750000e8322d00/content.htm

http://help.sap.com/saphelp_nw04/helpdata/en/22/042a4b488911d189490000e829fbbd/frameset.htm

2. It is defined during installation, not quite sure how you can find it afterwards (try looking at the name of the startup profile, believe they include the number)

3. Yes

4. Normally, the sap system should be registered in DNS, and you should need any.

In your case the DNS lookup fails for name R3ip , so a workaround is to add R3ip <ip addresse to R3ip system> in the hosts file.

But I would instead recommend that R3ip is in your corporate DNS (you can test if a DNS entry exist with nslookup)

Dagfinn

Former Member
0 Kudos

HI Dagfinn,

Very helpful answer. Thanks.

When you say :

4. Normally, the sap system should be registered in DNS, and you should need any. --- How do I check if my SAP system is registerd in the DNS? Is there some detail explaination on this.

Also,

I have these observations :

1. I checked the services file on my portal server and the entry for "sapgw00 3300/tcp" is maintained there.

2. There is no entry of my SAP ECC box in the hosts file of my portal server.

3. The group PUBLIC is not maintained in SMLG transaction.

4. I am using R3ip only in my code, there is no other place that this "R3ip" is being used.

Following is my code :



import com.sapportals.htmlb.page.*;
import com.sapportals.htmlb.table.DefaultTableViewModel;
import com.sapportals.htmlb.event.*;
import com.sapportals.portal.htmlb.page.*;
import com.sapportals.portal.prt.component.*;
import com.sapportals.portal.prt.resource.IResource;
import com.sapportals.portal.prt.session.*;
import java.math.*;
import java.util.*;
import java.util.Calendar;
import com.sapportals.portal.prt.service.jco.IJCOClientService;
import com.sap.mw.jco.JCO;
import com.sapportals.portal.prt.service.jco.IJCOClientPoolEntry;
import com.sap.mw.jco.IFunctionTemplate;
import com.sap.mw.jco.IRepository;

public class ReadModelData extends PageProcessorComponent {

  public DynPage getPage(){
    return new ReadModelDataDynPage();
  }

  public static class ReadModelDataDynPage extends JSPDynPage{
  
	private class4bean class4bean = null;
	
	protected IPortalComponentRequest request;
	protected IPortalComponentSession session; 
	protected IPortalComponentContext context;
	protected IPortalComponentProfile profile;
	protected String userId;
	protected String sapSystem;
		
	private final static int INITIAL_STATE = 0;    
	private final static int OUTPUT_STATE = 1;
	private final static int ERROR_STATE = 2;  
	private int state = INITIAL_STATE;
  
  
    public void doInitialization(){
    	
		System.out.println("cpCv - Code is rendered: " + Calendar.getInstance().getTime().toString());
		state = INITIAL_STATE;
		
		DefaultTableViewModel tvm = new DefaultTableViewModel();
		tvm = getData();
		
		//class4bean = new class4bean();
		class4bean.setModel(tvm);
		
		
		session.putValue("class4bean", class4bean);

    }


	public DefaultTableViewModel getData() {
	
	com.sap.mw.jco.IRepository repository;

	JCO.Pool pool = JCO.getClientPoolManager().getPool("R3");
/*	if (pool == null) {
//	  JCO.removeClientPool("R3");
	JCO.addClientPool(
	"R3",
	10,
	"040",
	USER,
	PWD,
	"EN",
	"R3ip",
	"00");
	}*/
	

	if (pool == null) {
//		  JCO.removeClientPool("R3");
		JCO.addClientPool(
		"R3",
		10,
		"040",
		"uname",
		"pwd",
		"EN",
		"portalserver",
		"40");
		}
	
	
	repository = JCO.createRepository("TTL", "R3");

	JCO.Client client = null;
//	   Get a function template from the repository
	IFunctionTemplate ftemplate =
	repository.getFunctionTemplate("BAPI_SALESORDER_GETSTATUS");
	
//	   Create a function from the template
	JCO.Function function = ftemplate.getFunction();

	client = JCO.getClient("R3");

	JCO.ParameterList input = function.getImportParameterList();

	input.setValue("0053100700", "SALESDOCUMENT");

	client.execute(function);

	JCO.Table sales_orders =
	function.getTableParameterList().getTable("STATUSINFO");
//	  *********************
	Vector row = new Vector();
	Vector tbl = new Vector();
	Vector colNames = new Vector();
//	   Loop over all rows
	do {
//	   Loop over all columns in the current row
	for (JCO.FieldIterator e = sales_orders.fields();
	e.hasMoreElements();
	) {
	JCO.Field field = e.nextField();
	row.add(field.getString());
//	  System.out.println(field.getName() + ":\t" + field.getString());
	} //for
	tbl.add(row);
	} while (sales_orders.nextRow());

	sales_orders = null;
	sales_orders =
	function.getTableParameterList().getTable("STATUSINFO");

	sales_orders.nextRow();
	for (JCO.FieldIterator e = sales_orders.fields();
	e.hasMoreElements();
	) {
	JCO.Field field = e.nextField();
	colNames.add(field.getName().toString());

	}

	DefaultTableViewModel dtvModel = 	new DefaultTableViewModel(tbl, colNames);

	
	JCO.releaseClient(client);
	
//	  **********************
	return dtvModel;
	}








    public void doProcessAfterInput() throws PageException {
    }

    public void doProcessBeforeOutput() throws PageException {
      class4bean myBean = new class4bean();
      ((IPortalComponentRequest)getRequest()).getServletRequest().setAttribute("myBean", myBean);
      // fill your bean with data here...

      this.setJspName("testJSP_.jsp");
    }
  }
}

Former Member
0 Kudos

The problem got solved. When my application was connecting to the backend, it was using the ssame old connection pool which had the R3ip as the host name defined in it.

I changed the connection pool from



JCO.Pool pool = JCO.getClientPoolManager().getPool("R3");

to



JCO.Pool pool = JCO.getClientPoolManager().getPool("mypool");


what this means is that the application will use the same pool and connection credentials that are defined in the pool everythime to connect to the backend system.