cancel
Showing results for 
Search instead for 
Did you mean: 

JCO.createClient - isAlive() returns false after creation?

Former Member
0 Kudos

Hello Forum,

I have a question regarding JCO.Client usage.

I created a class used for managing JCO.Client creation, repository creation and closing

the open resources after usage. The class was developed to encapsulate recurring logic

of client creation and especially our logging related to it.

The class contains a method


public JCO.Client openConnection(...) {...}

The JCO.Client returned is used for creating a repository, creating a function template

and so on. It works but I'm a bit confused about usage of the methods


isAlive() and isValid()

When implementing the method openConnection I placed an assertion directly after

calling the JCO.createClient method


JCO.Client jcoClient = JCO.createClient(...);
assert jcoClient.isAlive();

Although I'm able to use the JCO.Client object returned by my method this assertion

fails - I also tried the isValid() method as assertion which fails also...

Any help would be greatly appreciated.

Best regards,

Henning Malzahn

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

I am using the method:

JCO.Client client = JCO.getClient( poolName);

My understainding about the JCO.createClient() and JCO.getClient() is the latter one gets a client connection from the SAP end; while the first one only creates an instance of JCO.Client which is not conected to the SAP yet.

Dennis

Former Member
0 Kudos

Hello Dennis,

thank you for the hint. I interpreted the API doc erroneously.

The API says "Creates an instance of a client connection to a remote SAP system"

for the createClient(...) method and I thought that's a JCO.Client with an already openend

connection...

I just need the client to execute a function template. The basic tests I realized so far

are creating the (as I now know) client reference and a JCO.Repository which I use

to retreive the FunctionTemplate. Afterwards I use the JCO.Client reference to execute

the FunctionTemplate.

Although everything works as expected - Is my assumption correct that I don't need

to open a connection using the method you mentioned above if I just want to execute

the FunctionTemplate, or do I'm missing something there?

Best regards,

Henning

Former Member
0 Kudos

Hi Henning,

The method I mentioned is connected to the SAP system when getting the pool. The connection may not be explicitly opened. Anything action based on the retrieved client will use the same connection.

Dennis

Answers (1)

Answers (1)

Vlado
Advisor
Advisor
0 Kudos

Hi Henning,

I'm not sure how much it will help you, just wanted to give you the link to the SAP JCo (and actually all public NetWeaver) javadocs:

https://www.sdn.sap.com/irj/sdn/javadocs

Just my 2 cents...

Cheers,

Vladimir