on 02-12-2009 2:31 PM
Hi all,
I have followed the tutorial in order to establish a connection and validate the credentials and setup parameters I have received.
I write the properties to a file and parse it into the destination manager as the tutorial describes. The properties I write are:
- JCO_ASHOST, JCO_SYSNR, JCO_CLIENT, JCO_USER, JCO_PASSWD
and I'm using a direct connection.
dest = JCoDestinationManager.getDestination(SAP_SERVER);
dest.ping(); // same result with dest.getAttributes()
When ping is invoked an exception is cast and here I'm stuck. (the content of the dest object is attached, is it a problem that isInitiazed=null and destinationId is empty?)
And the exception is also attahced.
My system setup is winXp. JCo3.0.1. Java 1.6.0_06 (Is it a requirement that one is using Java EE??)
I tried to find out more from the RFC_ERROR_CANCELLED, but the documentation doesn't really tell me what is wrong. Is there a log I can check that contains more information?
If I change the hostname I get something different. For the rest of the parameters it is the same result/exception.
the exception ***************
group = 109
key = {java.lang.String@897}"RFC_ERROR_CANCELLED"
messageClass = null
messageType = '\u0000' 0
messageNumber = null
messageParameters = null
detailMessage = {java.lang.String@898}"Handle close pending"
cause = {com.sap.conn.rfc.exceptions.RfcException@899}"
RfcException: System (193.3.7.84/00)
message: Handle close pending
Return code: RFC_CLOSED(6)
error group: 109
key: RFC_ERROR_CANCELLED"
stackTrace = null
dest object *************************
name = {java.lang.String@759}"SAP_SERVER"
destinationId = {java.lang.String@892}"SAP_SERVER&123|DCN_LGR|45391A7804522154B65622D38ED84F3E"
destinationRepositoryId = {java.lang.String@893}"SAP_SERVER&123|DCN_LGR&R"
isInitialized = false
properties = {java.util.Properties@772} size = 8
attributes = null
repository = null
peakLimit = 2147483647
capacity = 0
maxGetClientTime = 30000
expirationTime = 60000
expirationCheckPeriod = 60000
scopeType = null
parentDestination = {com.sap.conn.jco.rt.RfcDestination@758}"destination SAP_SERVER with properties:{jco.client.tpname=DCN_LGR, jco.client.client=123, propertiesProvider=com.sap.conn.jco.rt.FileDestinationsDataProvider, jco.client.destination=SAP_SERVER, jco.client.sysnr=00, jco.client.user=DCN_LGR, jco.client.ash
scopeList = null
isDeleted = false
monitor = null
repMonitor = null
throughput = null
Best regards
Hi There
Indeed JCo exceptions are not worth noticing at this stage.. With wireshark i could understand that the user in the code was a faulty one... we need to use a defined user that is of type connection and not dialog.....
One more problem i was able to identify was that my loopback adaptor had an IP address of a different schema than that of the NIC.. the application was not able to reach the correct adaptor for SAP Server...
All is working for now...
Thanks a ton friend..
keep posting ..
rgds / Kamal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi
Your problem seems to have solved... I have attempted all that i could so far, but the simplest thing of pinging is still not working.. please share in details if possible how your issue was solved.
Best regards
Kamal
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I'm not sure what your problem is?
I used Wireshark (free program) to help figure out the problem as the JCo exception helped very little.
With wireshark I can follow the network traffic and get clues as to what the SAP Server replies. Clues that are not available in JCo.
So install Wireshark, start recording on the correct interface, stop recording, follow tcp stream. And look for clues in the clear text messages.
Br
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
Following is a sample working code in JCO 3.O
import java.io.File;
import java.io.FileOutputStream;
import java.util.Properties;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.ext.DestinationDataProvider;
public class JCOClientTest {
static String ABAP_AS_POOLED = "ABAP_AS_WITH_POOL";
static
{
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "ECCBANG");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "100");
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "AYYAPPAR");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "e");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
connectProperties.setProperty(DestinationDataProvider.JCO_POOL_CAPACITY, "3");
connectProperties.setProperty(DestinationDataProvider.JCO_PEAK_LIMIT, "10");
createDataFile(ABAP_AS_POOLED, "jcoDestination", connectProperties);
}
static void createDataFile(String name, String suffix, Properties properties)
{
File cfg = new File(name+"."+suffix);
if(!cfg.exists())
{
try
{
FileOutputStream fos = new FileOutputStream(cfg, false);
properties.store(fos, "for tests only !");
fos.close();
}
catch (Exception e)
{
throw new RuntimeException("Unable to create the destination file " + cfg.getName(), e);
}
}
}
public static void main(String args[]) throws Exception
{
JCoDestination destination = JCoDestinationManager.getDestination(ABAP_AS_POOLED);
System.out.println("Attributes:");
System.out.println(destination.getAttributes());
System.out.println("Pinging the Destination" + ABAP_AS_POOLED);
destination.ping();
System.out.println("Ping successfull...");
}
}
Regards
Ayyapparaj
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi,
I tried the code with my parameters, still with the same result.
When I received my connection parameters, I was given also something they called:
RFC Connection:
Registration ID:
I could not find the equivalent in the the JCO properties. Could this be my connection problem?
There is also one more thing in the exception that could be a clue, namely the systemInfo field, it says system|193.3.7.84/00"
detailMessage = {java.lang.String@874}"Handle close pending"
cause = null
stackTrace = null
Wouldn't it make sense to focus on getting a connection established as client before exploring the server part? Or is both needed to work from the beginning before the something like ping() can be called. Could there be a permission setup that is needed to invoke ping?
I turned on the trace option in the JC0 which gives a bit more information. I'm a bit conerned about:
the null value: 5 [JCoRFC] Connect before RfcOpen(null)
and the System <empty>.
RfcException: [System <empty>|x.x.x.x/00]
message: Handle close pending
Return code: RFC_CLOSED(6)
error group: 109
key: RFC_ERROR_CANCELLED
Could anybody tell me if I need to be concerned about those values?
Could the problem be that I need to use load balancing parameters?
Br
6 [JCoAPI] DefaultDestinationManager.getDestinationInstance(SAP_SERVER) calls on provider com.sap.conn.jco.rt.FileDestinationsDataProvider
4 [JCoAPI] DefaultDestinationManager.getDestinationInstance(SAP_SERVER) got from provider com.sap.conn.jco.rt.FileDestinationsDataProvider follow properties {jco.client.client=123,jco.client.passwd=lgradmin,jco.client.sysnr=00,jco.client.user=DCN_LGR,jco.client.trace=1,jco.client.ashost=193.3.7.84}
8 [JCoAPI] DestinationManager.searchDestination(SAP_SERVER) CREATE_NEW
8 [JCoAPI] create destination with:{jco.client.client=123, propertiesProvider=com.sap.conn.jco.rt.FileDestinationsDataProvider, jco.client.destination=SAP_SERVER, jco.client.sysnr=00, jco.client.user=XXX, jco.client.trace=1, jco.client.ashost=XXX}
4 [JCoAPI] Pool.setMaxPoolSize(0) on pool SAP_SERVER&123|DCN_LGR|45391A7804522154B65622D38ED84F3E
4 [JCoAPI] Pool.setExpirationTime(0) on pool SAP_SERVER&123|DCN_LGR|45391A7804522154B65622D38ED84F3E
5 [JCoRFC] Connect before RfcOpen(null)
5 [JCoRFC] initialize client with parameters: {jco.client.client=123, propertiesProvider=com.sap.conn.jco.rt.FileDestinationsDataProvider, jco.client.destination=SAP_SERVER, jco.client.sysnr=00, jco.client.user=XXX, jco.client.trace=1, jco.client.ashost=XXX}
6
RfcException: [System <empty>|x.x.x.x/00]
message: Handle close pending
Return code: RFC_CLOSED(6)
error group: 109
key: RFC_ERROR_CANCELLED
invoked at com.sap.conn.jco.rt.MiddlewareJavaRfc.generateJCoException(MiddlewareJavaRfc.java:599)
invoked at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.connect(MiddlewareJavaRfc.java:1270)
invoked at com.sap.conn.jco.rt.ClientConnection.connect(ClientConnection.java:661)
invoked at com.sap.conn.jco.rt.PoolingFactory.init(PoolingFactory.java:103)
invoked at com.sap.conn.jco.rt.ConnectionManager.createFactory(ConnectionManager.java:171)
invoked at com.sap.conn.jco.rt.DefaultConnectionManager.createFactory(DefaultConnectionManager.java:44)
invoked at com.sap.conn.jco.rt.ConnectionManager.getFactory(ConnectionManager.java:160)
invoked at com.sap.conn.jco.rt.RfcDestination.initialize(RfcDestination.java:766)
invoked at com.sap.conn.jco.rt.RfcDestination.ping(RfcDestination.java:976)
invoked at test.sapConnectionTestV3.Connection.<init>(Connection.java:45)
invoked at test.sapConnectionTestV3.Startup.main(Startup.java:84)
invoked at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
invoked at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
invoked at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
invoked at java.lang.reflect.Method.invoke(Method.java:597)
invoked at com.intellij.rt.execution.application.AppMain.main(AppMain.java:90)
Hi,
One more sample application which is working for you to make ping work for you.
Change the connection parameters to that of your ECC system.
package com.bcone.jco.test;
import java.util.Properties;
import com.sap.conn.jco.JCoDestination;
import com.sap.conn.jco.JCoDestinationManager;
import com.sap.conn.jco.ext.DestinationDataEventListener;
import com.sap.conn.jco.ext.DestinationDataProvider;
public class CustomDestinationDataProvider
{
static class MyDestinationDataProvider implements DestinationDataProvider
{
private DestinationDataEventListener eL;
private Properties ABAP_AS_properties;
public Properties getDestinationProperties(String destinationName)
{
if(destinationName.equals("ABAP_AS") && ABAP_AS_properties!=null)
return ABAP_AS_properties;
return null;
//alternatively throw runtime exception
//throw new RuntimeException("Destination " + destinationName + " is not available");
}
public void setDestinationDataEventListener(DestinationDataEventListener eventListener)
{
this.eL = eventListener;
}
public boolean supportsEvents()
{
return true;
}
void changePropertiesForABAP_AS(Properties properties)
{
if(properties==null)
{
eL.deleted("ABAP_AS");
ABAP_AS_properties = null;
}
else
{
if(ABAP_AS_properties!=null && !ABAP_AS_properties.equals(properties))
eL.updated("ABAP_AS");
ABAP_AS_properties = properties;
}
}
}
public static void main(String[] args) throws Exception
{
Properties connectProperties = new Properties();
connectProperties.setProperty(DestinationDataProvider.JCO_ASHOST, "ECCBANG");
connectProperties.setProperty(DestinationDataProvider.JCO_SYSNR, "00");
connectProperties.setProperty(DestinationDataProvider.JCO_CLIENT, "100");
connectProperties.setProperty(DestinationDataProvider.JCO_USER, "AYYAPPAR");
connectProperties.setProperty(DestinationDataProvider.JCO_PASSWD, "password");
connectProperties.setProperty(DestinationDataProvider.JCO_LANG, "en");
MyDestinationDataProvider myProvider = new MyDestinationDataProvider();
com.sap.conn.jco.ext.Environment.registerDestinationDataProvider(myProvider);
myProvider.changePropertiesForABAP_AS(connectProperties);
JCoDestination ABAP_AS = JCoDestinationManager.getDestination("ABAP_AS");
ABAP_AS.ping();
System.out.println("ABAP_AS destination is ok");
}
}
Regards
Ayyapparaj
Hi,
I tried to install the .net sap connector running visual studio 2003. The component fails connecting to the server since my computer and the SAP server is not on the same local domain.
"You have entered an Internet address or an IP address outside the local domain.
Connections to Internet addresses or to external domains are not supported."
Is there a similar restriction for the Java connector? If yes, then it would explaine my connection problem.
Br
> Hi,
>
> I tried to install the .net sap connector running visual studio 2003. The component fails connecting to the server since my computer and the SAP server is not on the same local domain.
>
> "You have entered an Internet address or an IP address outside the local domain.
> Connections to Internet addresses or to external domains are not supported."
>
> Is there a similar restriction for the Java connector? If yes, then it would explaine my connection problem.
>
> Br
Hi,
JCo too will have the same restrictions as they both use the OS for communication
Regards
Ayyapparaj
Problem has been found and I can get a connection and getAllAttributes. Now continuing on with actually invoking RFC methods and acting as server...
The solution: Using wireshark (former ethereal) to get the tcp conversation with the server. It ended out in clear text from the SAP server saying wrong user name or passord. Talking to the SAP admin revealed that my given credentials was wrong and changing this made getAllAttributes() work.
Another thing it revealed was that the .net component never got across the local network domain so it appears that there is a difference between the two components. I wonder why SAP does not update the component so it can be used with a newer Visual Studio..
Back to Java. Why I didn't get the 'wrong user or password ' error message in the JCo is hopefully not an indication of the quality of JCo V3..
I tried to use JCo V2 but ended up in some missing dll's which I never got working.
I also tried to download NW RFC but the SAP download manager kept on getting 'error 400'. Guess SAP is just not that keen on given helpful error messages to the user. (Yes I have been able to download other things through the download manager)
Anyway.. Thank you all for your help and might talk to you soon again
Alternatively, does anybody know of a simple SAP client that can be used to validate the parameters I have received. Something like connecting, pinging or maybe showing a list of RFC if possible.
That would at least indicate to me if it is the java program or the settings I have received that is the problem.
Thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
86 | |
10 | |
10 | |
9 | |
7 | |
7 | |
6 | |
5 | |
4 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.