Search in sources :

Example 51 with ResourceException

use of javax.resource.ResourceException in project Payara by payara.

the class NoTxConnectorAllocator method createResource.

public ResourceHandle createResource() throws PoolingException {
    try {
        ManagedConnection mc = mcf.createManagedConnection(subject, reqInfo);
        ResourceHandle resource = createResourceHandle(mc, spec, this, info);
        ConnectionEventListener l = new ConnectionListenerImpl(resource);
        mc.addConnectionEventListener(l);
        return resource;
    } catch (ResourceException ex) {
        Object[] params = new Object[] { spec.getPoolInfo(), ex.toString() };
        _logger.log(Level.WARNING, "poolmgr.create_resource_error", params);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "Resource Exception while creating resource", ex);
        }
        if (ex.getLinkedException() != null) {
            _logger.log(Level.WARNING, "poolmgr.create_resource_linked_error", ex.getLinkedException().toString());
        }
        throw new PoolingException(ex);
    }
}
Also used : PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) ResourceHandle(com.sun.enterprise.resource.ResourceHandle) ManagedConnection(javax.resource.spi.ManagedConnection) ResourceException(javax.resource.ResourceException) ConnectionEventListener(com.sun.enterprise.resource.listener.ConnectionEventListener)

Example 52 with ResourceException

use of javax.resource.ResourceException in project Payara by payara.

the class AbstractConnectorAllocator method isConnectionValid.

public boolean isConnectionValid(ResourceHandle h) {
    HashSet conn = new HashSet();
    conn.add(h.getResource());
    Set invalids = null;
    try {
        invalids = getInvalidConnections(conn);
    } catch (ResourceException re) {
        // ignore and continue??
        // there's nothing the container can do but log it.
        Object[] args = new Object[] { h.getResourceSpec().getPoolInfo(), re.getClass(), re.getMessage() };
        _logger.log(Level.WARNING, "pool.get_invalid_connections_resourceexception", args);
        if (_logger.isLoggable(Level.FINE)) {
            _logger.log(Level.FINE, "", re);
        }
    }
    if ((invalids != null && invalids.size() > 0) || h.hasConnectionErrorOccurred()) {
        return false;
    }
    return true;
}
Also used : Set(java.util.Set) HashSet(java.util.HashSet) ResourceException(javax.resource.ResourceException) HashSet(java.util.HashSet)

Example 53 with ResourceException

use of javax.resource.ResourceException in project Payara by payara.

the class AbstractConnectorAllocator method closeUserConnection.

public void closeUserConnection(ResourceHandle resource) throws PoolingException {
    try {
        ManagedConnection mc = (ManagedConnection) resource.getResource();
        mc.cleanup();
    } catch (ResourceException ex) {
        throw new PoolingException(ex);
    }
}
Also used : PoolingException(com.sun.appserv.connectors.internal.api.PoolingException) ManagedConnection(javax.resource.spi.ManagedConnection) ResourceException(javax.resource.ResourceException)

Example 54 with ResourceException

use of javax.resource.ResourceException in project teiid by teiid.

the class CouchbaseProcedureExecution method execute.

@Override
public void execute() throws TranslatorException {
    this.visitor = this.executionFactory.getN1QLVisitor();
    this.visitor.append(call);
    String n1ql = this.visitor.toString();
    LogManager.logDetail(LogConstants.CTX_CONNECTOR, CouchbasePlugin.Util.gs(CouchbasePlugin.Event.TEIID29002, call, n1ql));
    executionContext.logCommand(n1ql);
    N1qlQueryResult queryResult;
    try {
        queryResult = connection.execute(n1ql);
    } catch (ResourceException e) {
        throw new TranslatorException(e);
    }
    this.results = queryResult.iterator();
}
Also used : N1qlQueryResult(com.couchbase.client.java.query.N1qlQueryResult) ResourceException(javax.resource.ResourceException) TranslatorException(org.teiid.translator.TranslatorException)

Example 55 with ResourceException

use of javax.resource.ResourceException in project teiid by teiid.

the class CouchbaseQueryExecution method execute.

@Override
public void execute() throws TranslatorException {
    this.visitor = this.executionFactory.getN1QLVisitor();
    this.visitor.append(this.command);
    String n1ql = this.visitor.toString();
    LogManager.logDetail(LogConstants.CTX_CONNECTOR, CouchbasePlugin.Util.gs(CouchbasePlugin.Event.TEIID29001, n1ql));
    executionContext.logCommand(n1ql);
    N1qlQueryResult queryResult;
    try {
        queryResult = connection.execute(n1ql);
    } catch (ResourceException e) {
        throw new TranslatorException(e);
    }
    this.results = queryResult.iterator();
}
Also used : N1qlQueryResult(com.couchbase.client.java.query.N1qlQueryResult) ResourceException(javax.resource.ResourceException) TranslatorException(org.teiid.translator.TranslatorException)

Aggregations

ResourceException (javax.resource.ResourceException)163 TranslatorException (org.teiid.translator.TranslatorException)26 SQLException (java.sql.SQLException)18 IOException (java.io.IOException)17 PoolingException (com.sun.appserv.connectors.internal.api.PoolingException)14 ManagedConnection (javax.resource.spi.ManagedConnection)13 ResourceStatus (org.glassfish.resourcebase.resources.api.ResourceStatus)13 NamingException (javax.naming.NamingException)11 InvocationTargetException (java.lang.reflect.InvocationTargetException)10 SObject (com.sforce.soap.partner.sobject.SObject)9 ConnectionException (com.sforce.ws.ConnectionException)9 UnexpectedErrorFault (com.sforce.soap.partner.fault.UnexpectedErrorFault)8 ArrayList (java.util.ArrayList)8 ResourceHandle (com.sun.enterprise.resource.ResourceHandle)7 InvalidSObjectFault (com.sforce.soap.partner.fault.InvalidSObjectFault)6 ResourcePrincipal (com.sun.enterprise.deployment.ResourcePrincipal)6 Set (java.util.Set)6 MessageEndpoint (javax.resource.spi.endpoint.MessageEndpoint)6 XAResource (javax.transaction.xa.XAResource)6 InvalidFieldFault (com.sforce.soap.partner.fault.InvalidFieldFault)5