cancel
Showing results for 
Search instead for 
Did you mean: 

JCoDestination Problem: JCO_ERROR_RESOURCE: Destination does not exist

Former Member
0 Kudos

Hello Experts,

I followed the JCo3 tutorial of accessing backend ABAP system.

I implemented the following code:

File configuration = new File(JCO_DESTINATION_APP +".jcoDestination");
if(!configuration.exists() || updateprovider) {
   Properties properties = new Properties();
   properties.setProperty(DestinationDataProvider.JCO_ASHOST, Configuration.getInstance().ashost);
   properties.setProperty(DestinationDataProvider.JCO_SYSNR, Configuration.getInstance().sysnr);
   properties.setProperty(DestinationDataProvider.JCO_CLIENT, Configuration.getInstance().client);
   properties.setProperty(DestinationDataProvider.JCO_USER, Configuration.getInstance().user);
   properties.setProperty(DestinationDataProvider.JCO_PASSWD, Configuration.getInstance().passwd);
   properties.setProperty(DestinationDataProvider.JCO_LANG, Configuration.getInstance().lang);
   properties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "" + Configuration.getInstance().connections);
   properties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "" + Configuration.getInstance().connections);

   FileOutputStream fos = new FileOutputStream(configuration, false);
   properties.store(fos, JCO_DESTINATION_APP);
   fos.close();
}

When I execute the following code:

this.getDestination().getAttributes()

I get the following error:

com.sap.conn.jco.JCoException: (106) JCO_ERROR_RESOURCE: Destination JCO_DESTINATION_APP does not exist
	at com.sap.conn.jco.rt.DefaultDestinationManager.update(DefaultDestinationManager.java:163)
	at com.sap.conn.jco.rt.DefaultDestinationManager.searchDestination(DefaultDestinationManager.java:292)
	at com.sap.conn.jco.rt.DefaultDestinationManager.getDestinationInstance(DefaultDestinationManager.java:90)
	at com.sap.conn.jco.JCoDestinationManager.getDestination(JCoDestinationManager.java:61)
	at com.exz.app.common.helper.IntegrationPlatformAccessor.getDestination(IntegrationPlatformAccessor.java:83)
	at com.exz.app.common.helper.IntegrationPlatformAccessor.<init>(IntegrationPlatformAccessor.java:67)
	at com.exz.app.common.helper.IntegrationPlatformAccessor.getInstance(IntegrationPlatformAccessor.java:32)
	at com.exz.app.interfacemng.services.Template_WebService.<init>(Template_WebService.java:34)
	at com.exz.app.interfacemng.services.ConfigurationScenarioServiceClient.<init>(  ...

What am I missing?

Regards.

Accepted Solutions (0)

Answers (1)

Answers (1)

Former Member
0 Kudos

As a starter it might be best to take try out the examples that ship with the JCo3 distribution. I cannot comment much on your code, as it's an excerpt and doesn't show everything. E.g. I have no clue what the line this.getDestination().getAttributes() means; usually you retrieve destinations via the class JCoDestinationManager and there you always have to at least provide the name of the destination.

So let me give some generic comments instead:

<ul style="list-style:circle">

<li>Properties for destinations can be returned via a class that implements the interface DestinationDataProvider; you can register your own implementation (once) via static method Environment.registerDestinationDataProvider().</li>

<li>SAP ships the JCo with a generic file handler for providing destination attributes: It basically searches in the current directory (i.e. from where you started your application) for client destinations with the given name and extension ".jcoDestination" (server destinations use extension ".jcoServer"). As far as I remember you can also change the directory where those destination property files are searched for by setting System property "jco.destinations.dir".</li>

<li>I strongly recommend registering your own DestinationDataProvider (or ServerDataProvider) and so does SAP; this is especially true if you get your properties from somewhere else (as it seems to be in your case) or want some specific processing (e.g. use encrypted passwords in your properties that you decrypt upon loading).</li>

<li>For troubleshooting your existing coding I'd verify that you did actually create the file with the properties and that the file name (without the extension) matches the name that you use when trying to retrieve the destination.</li>

</ul>

Cheers, harald