cancel
Showing results for 
Search instead for 
Did you mean: 

problem with jco 3.0 program StepByStepClient

Former Member
0 Kudos

Hi,

I replace the login-properties, but I get an error with the old settings. Question is why ashost is still 'binmain' and not the ipnummer, why is SYSNR 53 and not 67

*****************************************************************************

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=binmain SYSNR=53 PCS=1

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

ERROR hostname 'binmain' unknown

TIME Thu Nov 27 09:02:11 2008

RELEASE 711

COMPONENT NI (network interface)

VERSION 39

RC -2

MODULE ninti.c

LINE 895

DETAIL NiPGetHostByName: 'binmain' not found

SYSTEM CALL getaddrinfo

COUNTER 3

Mine settings are:

connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "145.22.20.204");

connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "67");

connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "120");

connectProperties.setProperty(DestinationDataProvider.JCO_USER, "TESTJCOUSER");

connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "testtesttest");

connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "nl");

createDataFile(ABAP_AS, "jcoDestination", connectProperties);

************************************************************************************************

Thanks & regards

Rens Boevé

Accepted Solutions (0)

Answers (3)

Answers (3)

Former Member
0 Kudos

Hi,

I made this solution.

import java.util.Properties;

import sap.MyDestinationDataProvider;

import com.sap.conn.jco.AbapException;

import com.sap.conn.jco.JCoDestination;

import com.sap.conn.jco.JCoDestinationManager;

import com.sap.conn.jco.JCoException;

import com.sap.conn.jco.JCoField;

import com.sap.conn.jco.JCoFunction;

import com.sap.conn.jco.JCoStructure;

import com.sap.conn.jco.ext.DestinationDataProvider;

public class StartTestQueryJCoDrie {

/**

  • @param args

*/

public static void main(String[] args) throws JCoException {

Properties jcoPropertiesDPR = new Properties();

jcoPropertiesDPR.setProperty(DestinationDataProvider.JCO_ASHOST,

"ipnummer");

jcoPropertiesDPR.setProperty(DestinationDataProvider.JCO_SYSNR, "DPR");

jcoPropertiesDPR.setProperty(DestinationDataProvider.JCO_CLIENT, "sapclient");

jcoPropertiesDPR.setProperty(DestinationDataProvider.JCO_USER, "user");

jcoPropertiesDPR.setProperty(DestinationDataProvider.JCO_PASSWD,

"paswrd");

jcoPropertiesDPR.setProperty(DestinationDataProvider.JCO_LANG, "nl");

//

MyDestinationDataProvider provider = new MyDestinationDataProvider();

provider.addDestination("DPR", jcoPropertiesDPR);

com.sap.conn.jco.ext.Environment

.registerDestinationDataProvider(provider);

JCoDestination destination = JCoDestinationManager.getDestination("DPR");

// step 01

System.out.println("Attributes:");

System.out.println(destination.getAttributes());

System.out.println();

// step 02

JCoFunction function = destination.getRepository().getFunction("RFC_SYSTEM_INFO");

if(function == null)

throw new RuntimeException("BAPI_COMPANYCODE_GETLIST not found in SAP.");

try

{

function.execute(destination);

}

catch(AbapException e)

{

System.out.println(e.toString());

return;

}

JCoStructure exportStructure = function.getExportParameterList().getStructure("RFCSI_EXPORT");

System.out.println("System info for " + destination.getAttributes().getSystemID() + ":

");

for(int i = 0; i < exportStructure.getMetaData().getFieldCount(); i++)

{

System.out.println(exportStructure.getMetaData().getName(i) + ": " + exportStructure.getString(i));

}

System.out.println();

//JCo still supports the JCoFields, but direct access via getXX is more efficient as field iterator

System.out.println("The same using field iterator:

System info for " + destination.getAttributes().getSystemID() + ":

");

for(JCoField field : exportStructure)

{

System.out.println(field.getName() + ": " + field.getString());

}

System.out.println();

}

}

*********************************************************************************************************************

Rens Boevé

Edited by: M.P. Boevé on Jan 28, 2009 2:57 PM

Former Member
0 Kudos

Hello ,I solve this problem as StepByStepClient. My application is a Web Project. I call com.sap.conn.jco.ext.Environment

.registerDestinationDataProvider(provider) in ServletServletContextListener. But I get a error like as follows:

java.lang.IllegalStateException: DestinationDataProvider already registered [com.sap.security.core.server.destinations.provider.DestinationsProviderFrame].

But, If I deploy application in others Application Server like Tomcat, It is Ok.

So I am very puzzled.

Former Member
0 Kudos

Hi,

If you look into the error you can see that ABAP_AS_WITHOUT_POOL is where the error is thrown.

Inside the sample their are three connections used. Either you comment out the part which is not relevent for your and run the application or else populate all the connection with respective parameters

You have changed the parameters for ABAP_AS but not for ABAP_AS_WITHOUT_POOL.

Regards

Ayyapparaj

manuelhildemaro_ramossanc
Active Participant
0 Kudos

Hi Ayyapparaj,

I have this...

connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "srvctrsapd01");

connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00");

connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "220");

connectProperties.setProperty(DestinationDataProvider.JCO_USER, "consultor04");

connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "wwewewewe");

connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "ES");

createDataFile(ABAP_AS, "jcoDestination", connectProperties);

connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");

connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");

createDataFile(ABAP_AS_POOLED, "jcoDestination", connectProperties);

But still don't works... what do you think is the reason ?

Regards,

Manuel H.

manuelhildemaro_ramossanc
Active Participant
0 Kudos

Hi,

Did you solved it ? I have the same problem..

Regards,

Manuel H.