on 11-23-2006 11:47 AM
Hi Folks,
while i'm configuring a JCO connection to R/3, i got a little problem:
In my class constructor i initialize a client pool.
JCO.addClientPool(sapSID, sapMaxConnections, sapMandant, sapUser, sapPasswort, sapLanguage, sapSystem, sapSystemNumber);
JCO.getClientPoolManager().getPool(sapSID).setMaxWaitTime(maxWaitTime);
problem:
when there is already a client pool, the application crashes
solution:
check if there is already a connection-pool with this name
i tried the following:
1) Check if there's a pool with the name
if (JCO.getClientPoolManager().getPool(sapSID).getName()==sapSID) {
...
}
==> which leads to a null pointer exception because logically there is no pool and as the doc says "if there's no pool, .getPool(String) will return null, which leads to:
2) Check if null
if (JCO.getClientPoolManager().getPool(sapSID)==null) {
...
}
but unfortunately. this won't work either.. null point exception again.
anyone got a hint?
thx in advance,
lars
Message was edited by:
Lars Paetzold
Paste some more code if you want.
Where do you set the waittime? In the if or in the else?
KR,
Christophe
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
i remove the waittime part now, but it won't work anyway:
java.lang.NullPointerException
if (JCO.getClientPoolManager().getPool(sapSID)==null) {
if (JCO.getClientPoolManager().getPool(sapSID).getName().toString()==sapSID.toString()) {
} else {
JCO.addClientPool(sapSID, sapMaxConnections, sapMandant, sapUser,
sapPasswort, sapLanguage, sapSystem, sapSystemNumber);
}
}
if i'm not checking if there is any kind of pool, everything works fine until i call the application a second time and the pool is already initialized
okay, works fine now i modified it a bit more and here's the code-snippet if a pool is initialized or not, for whom it might interesst:
//Check if there is any pool created with the name sapSID, if not, create one
if (JCO.getClientPoolManager().getPool(sapSID)!=null) {
//There is a Pool, do nothing
} else {
//There is no pool, create one
JCO.addClientPool(sapSID, sapMaxConnections, sapMandant, sapUser,sapPasswort, sapLanguage, sapSystem, sapSystemNumber);
}
User | Count |
---|---|
85 | |
10 | |
10 | |
9 | |
7 | |
6 | |
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.