on 02-20-2008 1:00 PM
Hi,
I have developed a webdynpro application using webservice.and it works fine in portal...
But whenever the connection exceeds its limit,It throws the following Exception
Couldn't create ManagedConnection with . {jco.client.passwd=**, jco.client.lang=EN, jco.client.sysnr=00, jco.client.client=800, jco.client.ashost=server, jco.client.user=user1, jco.client.type=A, jco.client.jra_conn=true}
Then we have to increase the maximum number of connection in Visual administrator..
Although we have already close the connection in Webservice,
The connection remains in the same state(open),and throws the above Error.
Is There any way to solve this?
Regards
Nandha.
Hi Goran,
I have made change in my code,and Deploy it so.
How can i monitor the available connection state?
Regards
Nandha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nandha
I think that you should be able to check that information in the backend in transaction sm04. Check for the user that executes the webservice and see if it's allocation of memory is down to zero after each call - meaning the connection is closed.
I think that you also should be able to use the WebDynpro Console to monitor your JCO connection pools.
http:///webdynpro/dispatcher/sap.com/tcwdtools/WebDynproConsole
and then --> JCO connection pools to the left in the navigation.
Regards
Göran
Edited by: Göran Westin on Feb 21, 2008 10:27 AM
Hi,
InitialContext initialcontext = new InitialContext();
ConnectionFactory connectionfactory=(ConnectionFactory) initialcontext.lookup("java:comp/env/eis/SAPJRAFactory");
Connection connection = connectionfactory.getConnection();
RecordFactory recordFactory=connectionfactory.getRecordFactory();
MappedRecord input = recordFactory.createMappedRecord("ZVP_BAPI_GETPLANT_DETAIL");
input.put("CO_CODE",cocode);
Interaction interaction=connection.createInteraction();
output=(MappedRecord)interaction.execute(null,input);
ResultSet rs=(ResultSet)output.get("OUTPUT");
while(rs.next())
{
plant = rs.getString("PLANT");
plantname = rs.getString("NAME");
ZVP_Bapi_Getplant_WSgandS gs= new ZVP_Bapi_Getplant_WSgandS();
gs.setPlant(plant);
gs.setPlantname(plantname);
results.add(gs);
interaction.close();
connection.close();
}
Regards
Nandha.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Nandhadevi
Ok. The first thing I would do is to move the following two lines of code outside the while loop:
interaction.close();
connection.close();
then I would also as a precaution put both the interaction and connection object to null.
interaction = null;
connection = null;
In reality I would put the code like this (see below) so that we always close the connection even if an exception is thrown.
InitialContext initialcontext = new InitialContext();
ConnectionFactory connectionfactory=(ConnectionFactory) initialcontext.lookup("java:comp/env/eis/SAPJRAFactory");
Connection connection = null;
Interaction interaction= null;
try
{
connection = connectionfactory.getConnection();
RecordFactory recordFactory=connectionfactory.getRecordFactory();
MappedRecord input = recordFactory.createMappedRecord("ZVP_BAPI_GETPLANT_DETAIL");
input.put("CO_CODE",cocode);
Interaction interaction=connection.createInteraction();
output=(MappedRecord)interaction.execute(null,input);
ResultSet rs=(ResultSet)output.get("OUTPUT");
while(rs.next())
{
plant = rs.getString("PLANT");
plantname = rs.getString("NAME");
ZVP_Bapi_Getplant_WSgandS gs= new ZVP_Bapi_Getplant_WSgandS();
gs.setPlant(plant);
gs.setPlantname(plantname);
results.add(gs);
}
}
catch( Exception e )
{
// Some logging
}
finally
{
if( interaction != null )
{
interaction.close();
interaction = null;
}
if( connection != null )
{
connection.close();
connection = null;
}
}
Regards
Göran
Edited by: Göran Westin on Feb 20, 2008 6:24 PM
Edited by: Göran Westin on Feb 20, 2008 6:25 PM
Hi Nandhadevi
How does your code look like which closes the connection?
Regards
Göran
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
82 | |
10 | |
10 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.