JCA HelloWorld Example - get managed connection error

169 views
Skip to first unread message

rbcunha79

unread,
Nov 27, 2015, 9:57:47 AM11/27/15
to IronJacamar Users

Hi,

I'm running tests using the example helloworld ironjacamar-1.2.6.Final and I'm having trouble getting connections.

The error is:
javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:/eis/HelloWorld
Caused by: javax.resource.ResourceException: IJ000655: No managed connections available within configured blocking timeout (30000 [ms])

I compile and package the following files in a helloworld.rar file.

HelloWorldConnection.java
HelloWorldConnectionFactory.java
HelloWorldConnectionFactoryImpl.java
HelloWorldConnectionImpl.java
HelloWorldManagedConnection.java
HelloWorldManagedConnectionFactory.java
HelloWorldManagedConnectionMetaData.java
HelloWorldResourceAdapter.java

I packed everything in an EAR file and make deploy in a wildfly-9.0.2.Final application server.
So far so OK.

I created an EJB Stateless to use the project hello world JCA.
But after 19 requests get the error mentioned above.
After using the connection I close the connection as code below.

Can anyone help me?

Thanks,
Renato

@Stateless
public class BusinessFacadeBean implements BusinessFacadeLocal, BusinessFacadeRemote {

    @Resource(mappedName = "java:/eis/HelloWorld")
    private HelloWorldConnectionFactory connectionFactory;

    @Override
    public String send(String value) {
        HelloWorldConnection comm = null;
        try {
            comm = connectionFactory.getConnection();
            return connectionFactory.getConnection().helloWorld( value );

        } catch (ResourceException e) {            
            e.printStackTrace();
        } finally {
            if (comm != null) {
                comm.close();
            }
        }
        return "Erro";
    }
}


public class HelloWorldConnectionImpl implements HelloWorldConnection {
    /** ManagedConnection */
    private HelloWorldManagedConnection mc;

    /** ManagedConnectionFactory */
    private HelloWorldManagedConnectionFactory mcf;

    @Override
    public void close() {
        log.info("close()");
        mc.closeHandle(this);
    }
}

public class HelloWorldManagedConnection implements ManagedConnection {

    void closeHandle(HelloWorldConnection handle) {

        ConnectionEvent event = new ConnectionEvent(this, ConnectionEvent.CONNECTION_CLOSED);
        event.setConnectionHandle(handle);

        for (ConnectionEventListener cel : listeners) {
            cel.connectionClosed(event);
         }
    }
}





Jesper Pedersen

unread,
Nov 30, 2015, 8:18:35 AM11/30/15
to IronJacamar Users
Because you are leaking a connection in "return connectionFactory.getConnection().helloWorld( value );"

You can use http://www.ironjacamar.org/doc/userguide/1.2/en-US/html/ch04.html#configuration_ironjacamar_leakpool to find issues like these.

HTH

rbcunha79

unread,
Nov 30, 2015, 10:05:28 AM11/30/15
to IronJacamar Users

Thanks for your help.
Reply all
Reply to author
Forward
0 new messages