JCO Client Pool
Hi All,
I have a situation where I'm supposed to initialize JCO Client pool at server startup(Weblogic 8.1). Could someone please let me know how to achieve this.
Any pointers to documentation or sample startup servlet code would also be of great help!
Regards,
Chaitanya
Abhilash,
Thank you very much for the prompt response.
<i>The better approach is write your own classe where all JCO related logic is maintained. And use that class to initialilze the pool in servlet and to get connection and release connection.</i>
I couldn't get the gist of this, are we trying to invoke a startup servlet from an external class? My idea is to do as follows:
1. Create a servlet that is intialized on server startup.
2. In the init method initialize JCO client pool.
3. Write a backend class something like <MyApp>BackendR3 and have a getConnection() inside.
My question was, <b>could I directly use JCo.getClient method? in the backend class</b>.
4. If yes, am I supposed to add a JCo jar during weblogic startup explicity or could it simply reside in web-inf/lib
Thanks again,
Chaitanya
Message was edited by:
chaitanya hazari
Similar Messages
-
Using X509 certificates to create a client in a JCo destination / pool
Hi,
Our administrators have set up JCo destinations for us developers to use in connecting to the SAP R/3 back-end. We need to use X509 certificates instead of username/password to create a connection. How is this done? The JCo API doesn't seem to list any class/method combination that is suitable.
JCO.createClient allows me to pass an X509 certificate, but it doesn't allow me to specify what JCO.Pool (i.e., JCo destination) to use.
JCO.addClientPool seems to allow both, but I don't think I want to really "add" a pool-- don't I just want to "use" a pre-existing pool, i.e., one of the JCo destinations our administrator has set up?
Do I need to create a Client using the X509 certificate and somehow add this Client to the JCO.Pool? I thought JCo destinations were meant to be pre-established Client pools waiting for a Client to be plucked out of it and used. Is that wrong? What am I missing?
Thanks in advance for your responses.Hi,
I'm note sure whether you can use prepared JCo destinations in this case. However, if it's possible to use single JCo clients you instantiate when you need them, you have different options depending on whether you have an Enterprise Portal installed on top of your J2EE Engine or not.
--> Without Portal
Retrieve the user's current certificate from UME using:
[code]com.sap.security.api.IUser currentUser = ...;
java.security.cert.X509Certificate[] certificates = currentUser.getUserAccounts()[0].getCertificates();
byte[] certBytes = certs[0].getEncoded();
String encodedCert = someBase64Method(certBytes);
Properties jcoProperties = new Properties();
// Add your backend properties like hostname and so on...
jcoProperties.setProperty("jco.client.user", "$X509CERT$");
jcoProperties.setProperty("jco.client.passwd", x509Cert);
JCO.Client jcoClient = JCO.createClient(jcoProperties);[/code]
--> With Portal installed
In general: Define your backend system in the Portal's system landscape instead of as JCo destination. Configure it's logonmethod for X.509 certificates. Either use UME's user mapping feature directly via com.sap.security.api.UMFactory.getUserMapping()... to add the certificate properties to the JCO properties, or use some intermediate API, some of which are available in the portal, some of which reside in the J2EE Engine (details if you request them).
Best regards
Heiko -
URGENT: JCO.Client: null
Hello
We're using SAP EP 7.0 with webdynpro connected to SAP R3 4.6C by SapLogon Ticket.
The connection can be done with certificates for our customers (authentification header) or via logon/password for internal test on our LAN.
These webdynpro work fine on the LAN but when we connect via the web we have the error below :
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException: Error connecting using JCO.Client: null
Do you have any idea ?
It's on our production environment so very urgent )
ThanksHi
1.May be JCO's are not configured properly.Check your JCO's are up and running by pinging it in ContentAdmin->WebDynpro.
2. its a simple problem of connection pooling. In your JCO connection settings change the maximum connections to 200. It will work.it is good After you execute the Model please release the connection. The reason you are getting this JCO Client null is because the connection is not getting released.
When you say the following code
wdContext.current<BAPI_INPUT>.modelObject().execute();
//Get the reference to the model and release the connection
If your Model name is say "MO_Mymodel" then
MO_Mymodel model = (MO_Mymodel) WDModelFactory.getModelInstance(MO_Mymodel.class);
model.disconnectIfAlive();
This should release your connections. Also ensure you release the connections even if there is a exception :).
Please refer the below forum also:
Error connection using JCO.Client :null
JCO.Client: null
com.sap.mw.jco.JCO$Exception: (102) JCO_ERROR_COMMUNICATION: JCO.Client not
Thanks
susmita -
Error connecting JCO.Client
Hello!
I've got a little problem with Adaptive RFC calls: After exactly 10 times executing my call I always get the following Exception:
com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecuteException: Error connecting using JCO.Client: null
Has anybody by any chance got an idea why or how to handle this problem?
Thank you very much in advance!
Best RegardsHi
Well its a simple problem of connection pooling. In your JCO connection settings change the maximum connections to 200. It will work.
well what i would advice is that After you execute the Model please release the connection. The reason you are getting this JCO Client null is because the connection is not getting released.
When you say the following code
wdContext.current<BAPI_INPUT>.modelObject().execute();
//Get the reference to the model and release the connection
If your Model name is say "MO_Mymodel"
then
MO_Mymodel model = (MO_Mymodel) WDModelFactory.getModelInstance(MO_Mymodel.class);
model.disconnectIfAlive();
This should release your connections. Also ensure you release the connections even if there is a exception :).
Hope that helps you.
regards
ravi -
WDDynamicRFCExecuteException: Error connecting using JCO.Client: null
Hi
This is a common problem,I have seen many threads , but following them did not solve my problem.
I have the JCOs tested successful from WD Admin. When I create a sample WDJ application with RFC model and deploy it to the server, I get
Exception:com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecution: Error connecting using JCO.Client: null.
I have checked my binding , I have only one input parameter and the code is
wdComponentAPI.getMessageManager().reportSuccess("Inside wdInit in Component ctrller");
Z_Plm44_Obsoleteimpactanalysis_Input input = new Z_Plm44_Obsoleteimpactanalysis_Input();
wdContext.nodeZ_Plm_Input().bind(input);
wdContext.createZ_Plm_InputElement(input).setV_Type(wdContext.currentZ_Plm_InputElement().getV_Type());
Also I have implemented closing the connection
disconnectifalive
I contacted the basis team... they tell me that everything is fine from their end. they have tried increasing the JCO connection pools.
Thanks for your help in advance
KarthikaHi Karthika
Check this pdf and try to catch WDDynamicRFCExecution in catch block.
Please put your code in try catch and also import com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCExecution in your code;
http://www.sappro.com/downloads/WebDynproJava.pdf
Re: User has no RFC authorization for function group.
Hope this will help you.
thanks
Arun Jaiswal -
Client pool of connections to R/3
Hi,
I'm using this function to create a client pool:
JCO.addClientPool(C_CLIENTPOOL_NAME,
C_CLIENTPOOL_MAX_CONNECTIONS, C_ABAP_CLIENT, C_ABAP_USER,
C_ABAP_PWD, C_ABAP_LANG, C_ABAP_HOST, C_ABAP_SYSTEMNR);
Is there a way to avoid this pool being created by code in my application?
Is there some tool to define client pools as you can define JCo connections in the J2EE Content Administrator?
Or is it considered safe practice to have a plaintext password in the source code of an application?
Thanks,
JeroenHi
You can use the property file for access the username and pasword.
See this samples and help for webdynpro
https://www.sdn.sap.com/irj/sdn/downloaditem?rid=/library/uuid/f0b0e990-0201-0010-cc96-d7ecd2e51715
Kind Regards
Mukesh -
Couldn't create jco client connection for logical system
Dear Experts,
we are facing a strange issue in our custom webdynpro java application, few of our portal users are getting the "couldn't create jco client connection for logical system" for Model Data JCO Destination. below are details
1. portal version 7.02 SP14 (we have recently updated to SP14 from SP02-- is this is causing the issue ?)
1.1. updated the NWDI track with SP14 SCA files as well as added latest WD Runtime SCA file deployed the applications to Production also.
2. above said exception is inconsistent and happening for only few users
3. ping and test of jco destinations are successfull in content administration as well as in SLD, destinations were added in the SLD system.
4. cleared the JCO ARFC meta data cache in webdynpro console
5. jco destinations are configured using uid/pwd, configured user is not locked active and tested in the backend by logging in with the same user.
6. restarted the portal server
even though, we are getting the above said exception for few of portal users randomly.
Please help me on this ASAP, as i am not getting any further help on this.
Thanks,
Ram.Hello Ram,
Check the JCo Pool Configuration settings of your JCO Destination. This message normally comes when the maximum connections has been reached. Increase the "Maximum Connections" to some number depending on the usage. A good habit is to disconnect the jco connection after executing the same in your webdynpro code if you don't want it to be synchronous.
<ModelName>.modelInstance().disconnectIfAlive()
Hope this helps.
Regards
Vijay -
hi,
<b>How to create connection pooling in WAS for SAP R/3 System.</b>
I have written session bean for Creating SalesOrder in SAP Using JCO.
my application will create 100 connection objects if 100 Client Calls for my SessionBean .so that i need to avoid creation of connection objects for <i><b>every time</b></i>.
pls tell me how configure WAS for JCO connection pooling .and How to get those connection objects. and how to use that connction object in my application.
regards
GuruHi
See this help
http://help.sap.com/saphelp_nw2004s/helpdata/en/83/85343e8c7f6329e10000000a114084/frameset.htm
http://help.sap.com/saphelp_nw2004s/helpdata/en/6a/82343ecc7f892ee10000000a114084/frameset.htm
Kind Regards
Mukesh -
Web dynpro console - monitor - JCO Connection pools
If you go to the web dynpro console -> monitor -> JCO connection pools you see a table with information.
JCo Clients MonitorJCO Pools - 12:31:02.992
Name Size Currently used Maximum used Max.connections Max.pool size
Can somebody explain what for example the "Size" and "Maximum used" mean in this table?
And if you have set max.pool size to 20, what things can override this setting in the SAP system?Hi,
You can follow this link for information on JCO in Web Dynpro Java:
[http://help.sap.com/SAPHELP_NW04S/helpdata/EN/3a/3b1b40fcdd8f5ce10000000a155106/frameset.htm|http://help.sap.com/SAPHELP_NW04S/helpdata/EN/3a/3b1b40fcdd8f5ce10000000a155106/frameset.htm]
-Kunal Kotak -
How to use a JCO connection pool in an EJB?
Hi *,
I want to build a WebService using SAP Web AS (J2EE Engine) that connects to a R/3 ERP (release 4.7).
I thought of building a stateless session bean that will be deployed as webservice. The session bean shall connect to the R/3 in order to call some BAPIs. I'd like to use a JCO connection pool. But I'm not sure, where I should create and destroy the connection pool. Are the EJB methods ejbCreate() and ejbRemove() the right ones? If so, my businness methods would just have to get a connection from the pool and call the BAPIs, right? If not, what do you suggest?
Another question: I already deployed a bean as webservice. Since not really knowing how to use the connection pool, I created a bean with one business method that creates a connection pool whenever it gets called. But if I have to change something in the bean so that I have to redeploy the bean I can't call my business method anymore, because JCO cannot load a native library once again, as it is already loaded, This leads to an exception. So I have to restart the complete engine everytime I redeploy my bean. Are there any workarounds for this problem? I'm not sure whether this is connected to the wrong use of the JCO connection pool.
Kind regards,
LarsHi *,
I want to build a WebService using SAP Web AS (J2EE Engine) that connects to a R/3 ERP (release 4.7).
I thought of building a stateless session bean that will be deployed as webservice. The session bean shall connect to the R/3 in order to call some BAPIs. I'd like to use a JCO connection pool. But I'm not sure, where I should create and destroy the connection pool. Are the EJB methods ejbCreate() and ejbRemove() the right ones? If so, my businness methods would just have to get a connection from the pool and call the BAPIs, right? If not, what do you suggest?
Another question: I already deployed a bean as webservice. Since not really knowing how to use the connection pool, I created a bean with one business method that creates a connection pool whenever it gets called. But if I have to change something in the bean so that I have to redeploy the bean I can't call my business method anymore, because JCO cannot load a native library once again, as it is already loaded, This leads to an exception. So I have to restart the complete engine everytime I redeploy my bean. Are there any workarounds for this problem? I'm not sure whether this is connected to the wrong use of the JCO connection pool.
Kind regards,
Lars -
Error sending IDOC from JCO Client to PI AEX 7.3.1
Hi All
We have a requirement to send an IDOC from a non SAP System to our ECC via PI AEX :
JCO.Client --> PI AEX --> SAP ECC
At this time, we are testing this scenario with a JAVA Client with JCO Library (3.0.10).
Destination to PI is OK
Destination to our SAP ECC (for IDocRepository) is OK
But by sending the IDOC to PI we are getting the following error, Exception is raised on the PI System and sent back to the JCO Client :
com.sap.conn.jco.JCoException: (104) JCO_ERROR_SYSTEM_FAILURE: while trying to invoke the method java.lang.Object.hashCode() of an object loaded from local variable 'key' (raised by system <extern>|PiSystem)
at com.sap.conn.jco.rt.MiddlewareJavaRfc.generateJCoException(MiddlewareJavaRfc.java:670)
at com.sap.conn.jco.rt.MiddlewareJavaRfc$JavaRfcClient.execute(MiddlewareJavaRfc.java:1881)
at com.sap.conn.jco.rt.ClientConnection.execute(ClientConnection.java:1120)
at com.sap.conn.jco.rt.ClientConnection.execute(ClientConnection.java:953)
at com.sap.conn.jco.rt.RfcDestination.execute(RfcDestination.java:1465)
at com.sap.conn.jco.rt.AbapFunction.execute(AbapFunction.java:319)
at com.sap.conn.idoc.jco.JCoIDoc.send(JCoIDoc.java:323)
at com.sap.conn.idoc.jco.JCoIDoc.send(JCoIDoc.java:353)
at sap_connector_examples.IDocClientExampleToJavaPO_pbs.main(IDocClientExampleToJavaPO_pbs.java:97)
Caused by: RfcException: [<extern>|PiSystem]
message: while trying to invoke the method java.lang.Object.hashCode() of an object loaded from local variable 'key'
Return code: RFC_SYS_EXCEPTION(3)
error group: 104
key: RFC_ERROR_SYSTEM_FAILURE
Exception raised by <extern>|PiSystem
PI Destination:
jco.destination.repository_destination=ABAP_AS_WITHOUT_POOL
jco.client.gwhost=PiSystem
jco.client.gwserv=sapgw01
jco.client.tpname=XI_IDOC_DEFAULT_PID
jco.client.type=E
ECC Destination: (ABAP_AS_WITHOUT_POOL)
jco.client.lang=en
jco.client.client=100
jco.client.passwd=****
jco.client.user=User
jco.client.sysnr=00
jco.client.ashost=ECCSystem
We have already set the PI VM System parameter jco.allow_non_abap_partner to 1
ECC User has S_RFC Rolle
I will be thankful for any advise.
Thank You
Regards
StéphaneHi
InboundRA (Resource Adapter) is green (Fully available).
What do you mean by maintaining JCO RFC Destination in PI ?
We have set the inboundRA Properties has follow :
ProgramID : XI_IDOC_DEFAULT_PID
DestinationName : XI_IDOC_DEFAULT_DESTINATION
Local: true
mutliRepository : ED1=XI_IDOC_DEFAULT_DESTINATION_ED1;ES4=XI_IDOC_DEFAULT_DESTINATION_ES4;MD1=XI_IDOC_DEFAULT_DESTINATION_MD1;ES1=XI_IDOC_DEFAULT_DESTINATION_ES1;PD1=XI_IDOC_DEFAULT_DESTINATION_PD1;
GatewayServer and Service are pointing to our PI System
BindingKey : PI_AAE_IDOC
And for each Repository we created a destination in NWA pointing to the corresponding ECC System.
(target host pointing to the ECC System and the Gateway host pointing to the PI System)
Our Installation isn't new but it is the first time we are configuring the System for this scenario:
JCO.client --> PI AEX
Regards
Stéphane -
Error connecting using JCO.Client: null
Hi,
I created a WD app which uses the RFC FM. I followed How-To-build-webdynpro.pdf document to create the WD and trying to deploy and run, I see the view page but when I trigger the action via button UI element I get following error as exception in the try catch block of execute method
In the NWA I see
Could not create JCOClientConnection for logical System: 'WD_MODELDATA_DEST' - Model
An exception has occurred: Erorr accessing cache [region]='XCM_SESSION_SCOPE'.
[EXCEPTION]
com.sap.isa.core.cache.Cache$Exception: Cannot return access for region 'XCM_SESSION_SCOPE'. Cache is not ready
I'm using following existing JCO definition by configuring them with correct parameters. Tested them successfully
WD_RFC_METADATA_DEST
WD_MODELDATA_DEST
What am I missing? In SM04 tcode I see 2 connections are opened with 2 Megabyte not released for a long time. I think if connections are released correctly it should drop to 1 megabyte. Is there anything that I need to do just after execute method as shown below (I have replaced function module with <FM> in below code)
try {
wdContext.node<FM>_Input().current<FM>_Get_InputElement().modelObject().execute();
} catch(Exception exception) {
msgMgr.reportException(exception.getLocalizedMessage(), false);
wdContext.nodeOutput().invalidate();
msgMgr.reportSuccess("Success");
The error is in the catch block which is displayed on the view page.
Thanks
Praveen
I modified the above code and put in finally block to close the connections as follows, please let me know if this is OK. I still get error message as "Error connecting using JCO.Client: null" but no additional connections in the SM04 after adding finally block.
try {
wdContext.node<FM>_Input().current<FM>_Get_InputElement().modelObject().execute();
} catch(Exception exception) {
msgMgr.reportException(exception.getLocalizedMessage(), false);
}finally {
// disconnect the connection
wdContext.<FM>_Get_InputElement().modelObject().modelInstance().disconnectIfAlive();
Edited by: Praveen11 on Oct 5, 2009 9:06 AMThanks Satish.
The issue is resolved. I think it was to do with permission, as I was running directly from NWDS deploy and run the session didn't have proper authorisation or something that was causing this error.
When I copy pasted the URL in the correct browser session window I got no error and function module was successfully executed. However the issue now is that values are not showing up in the view may be to do with mapping context or model I'll review and post back as different thread.
Thanks
Praveen -
JCo Client Programming and Error Handling
Hi all,
I was wondering if anybody could help me out with some advice on error handling when writing code to send messages to SAP via a JCo Client, particularly IDocs.
I understand from my reading that IDocs are always sent asyncronously to the SAP system from JCo, using JCO.Client.send(). So it is possible (and I have some test code working to do this) to force an exception with say a malformed IDoc, and catch the exception in my code.
But due to the asyncronous nature of the send functionality for IDoc, I cannot see any way of getting back any "business level" exceptions (e.g. Order Number does not exist, Unknown Material, etc.)
So my question is, is it possible to receive any of these type of error messages when sending IDocs to an SAP system using JCo? Perhaps by setting up a JCo Server with the correct error/exception listeners to receive these messages - but are they even sent out in the way?
If not what is the process for handling them?
It is of course possible to look in the SAP system using txn WE02 and see the problem/error but that does not help me to propagate this back to the sending application or to maintain state alignment between the two apps.
Any advice much appreciated!!
ChrisHi Anil,
you should check on those trheads:
<a href="https://www.sdn.sap.com/irj/sdn/thread?messageID=3104772�">https://www.sdn.sap.com/irj/sdn/thread?messageID=3104772�</a>
<a href="https://www.sdn.sap.com/irj/sdn/thread?messageID=579794򍣒">https://www.sdn.sap.com/irj/sdn/thread?messageID=579794򍣒</a>
Regards,
Gianluca Barile -
Error connection using JCO.Client
Hello all,
I got the following problem <b>"Error connection using JCO.Client"</b> and don't know what's wrong. All connections works at the content administration when I test the connection.
Can anyone help me please?
Best regards
PetraHi,
I almost tested the JCO connection with the 'test' button successfully at the content administrator. I tested again and it still works. And I have a stand alone webdynpro application (no portal).
Now I got the following error message after completing the coding with 'e.printStackTrace().'.
<i>
"Error connection using JCO.Client:null"
"[Ljava.lang.StackTraceElement:@60db08"
"Could not create JCOClientConnection for logical System:WD_MODELDATA_DEST - Model: class impersonalaccout.intro.model.Z_Fh0002_Datenverwaltung.Please assure that you have configured the RFC connections and/or logical System"
"com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCException:Error connection using JCO.Client:null"
"com.sap.tc.webdynpro.modelimpl.dynamicrfc.WDDynamicRFCException: Could not create JCOClientConnection for logical System: WD_MODELDATA_DEST - Model:class impersonalaccout.intro.model.Z_Fh0002_Datenveraltung.Please ***"</i>
Can anyone explaine me what's wrong?
Bye
Petra -
Error connection using JCO.Client :null
Hi,
I have small doubt in JCO connection, can any one help me.
In WebDynpro application some time we are getting exception like Error connection using JCO.client : null.
Connection :200 we are maintained in JCO configuration.
If I call one RFC useing JCO it will created a session or connection to ECC server, because we are getting exception in server too many sessions to ECC server.
Write now we are not using any code to close the connection like.
SaveModel svModel = (SaveModel)WDModelFactory.getModelInstance(SaveModel.class);
svModel.disconnectIfAlive();
If we use the above code it will close the connection or sessions.
Is it recommended to write the code in every RFC calls or in final block of all RFC calls ?
Regards,
Satya.Hi Satya
/message/1944647#1944647 [original link is broken]
/message/8499#8499 [original link is broken]
Please go through this link.Hope it will be helpful for you
Regards
Ruturaj
Maybe you are looking for
-
Weblogic 10.3.2 Release Notes (What's New)
I've been looking for a document with the features/bug fixes in Weblogic 10.3.2 since 10.3.1. Does Oracle/BEA maintain a document anywhere online that will tell me what's new with the new release? Thanks! Chris
-
Hardware or software malfunction?
Hi everyone. within the space of a few days my iMac early 2008 started throwing the spinning pinwheel more and more until I couldn't even do anything after logging in. Finder would just hang at the slightest click. I got into safe mode ok and disabl
-
Logical delete in DB adapter with 2 columns to update
Hi', I am using Oracle SOA 11G. I am polling a DB table and after reading the data I have to update 2 columns. With logical delete we can update 1 field, is it possible to update 2 fields. If Yes, then I have to update the first column BPEL_FLAG = R
-
What does the 4.3.2 do?
Can someone ell me what it does? What are the new features?
-
a. After downloading Flash 9, how do you get it to work with Apple iMac OS X 10.3.9 ?... b. , c. What's the best browser to try?... Firefox?... Opera?... Why?... d. What directory/ies contain the downloaded Flash 9 files?...