Skip to Content
author's profile photo Former Member
Former Member

Couldn't Create Managed Connection

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.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

3 Answers

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2008 at 01:51 PM

    Hi Nandhadevi

    How does your code look like which closes the connection?

    Regards

    Göran

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Feb 20, 2008 at 02:34 PM

    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.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

  • author's profile photo Former Member
    Former Member
    Posted on Feb 21, 2008 at 06:43 AM

    Hi Goran,

    I have made change in my code,and Deploy it so.

    How can i monitor the available connection state?

    Regards

    Nandha.

    Add a comment
    10|10000 characters needed characters exceeded

    • Former Member

      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

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.