Examples of JBossResourceException


Examples of com.taobao.datasource.resource.JBossResourceException

         buffer.append("Missing configuration for HA local datasource. ");
         if (getConnectionURL() == null)
            buffer.append("No connection-url. ");
         if (urlDelimiter == null)
            buffer.append("No url-delimiter. ");
         throw new JBossResourceException(buffer.toString());
      }

      // try to get a connection as many times as many urls we have in the list
      for(int i = 0; i < urlSelector.getUrlList().size(); ++i)
      {
         String url = urlSelector.getUrl();

         if(trace)
         {
            log.trace("Trying to create a connection to " + url);
         }

         try
         {
            Driver d = getDriver(url);
            Connection con = d.connect(url, copy);
            if(con == null)
            {
               log.warn("Wrong driver class for this connection URL: " + url);
               urlSelector.failedUrl(url);
            }
            else
            {
               return new LocalManagedConnection(this, con, props, transactionIsolation, preparedStatementCacheSize);
            }
         }
         catch(Exception e)
         {
            log.warn("Failed to create connection for " + url + ": " + e.getMessage());
            urlSelector.failedUrl(url);
         }
      }

      // we have supposedly tried all the urls
      throw new JBossResourceException(
         "Could not create connection using any of the URLs: " + urlSelector.getUrlList()
      );
   }
View Full Code Here

Examples of org.jboss.jca.common.JBossResourceException

            JBossResourceException.rethrowAsResourceException("Unexpected throwable while trying " +
                                                              "to create a connection: " + cl, t);
         }
      }

      throw new JBossResourceException("This should never happen", new Throwable("STACKTRACE"));
   }
View Full Code Here

Examples of org.jboss.jca.common.JBossResourceException

            JBossResourceException.rethrowAsResourceException("Unexpected throwable while trying " +
                                                              "to create a connection: " + cl, t);
         }
      }

      throw new JBossResourceException("This should never happen", new Throwable("STACKTRACE"));
   }
View Full Code Here

Examples of org.jboss.jca.common.JBossResourceException

            JBossResourceException.rethrowAsResourceException("Unexpected throwable while trying " +
                                                              "to create a connection: " + cl, t);
         }
      }

      throw new JBossResourceException("This should never happen", new Throwable("STACKTRACE"));
   }
View Full Code Here

Examples of org.jboss.jca.common.JBossResourceException

      {
         if (trace)
         {
            getLog().trace("Could not enlist in transaction on entering meta-aware object! " + cl, t)
         }
         throw new JBossResourceException("Could not enlist in transaction on entering meta-aware object!", t);
      }
   }
View Full Code Here

Examples of org.jboss.jca.common.JBossResourceException

               if (!xaResource.setTransactionTimeout(xaResourceTimeout))
                  getLog().debug("XAResource does not support transaction timeout configuration: " + getJndiName());
            }
            catch (XAException e)
            {
               throw new JBossResourceException("Unable to set XAResource transaction timeout: " + getJndiName(), e);
            }
         }
      }

      ConnectionListener cli = new TxConnectionListener(this, mc, getPool(), context, xaResource);
View Full Code Here

Examples of org.jboss.jca.common.JBossResourceException

            JBossResourceException.rethrowAsResourceException("Unexpected throwable while trying " +
                                                              "to create a connection: " + cl, t);
         }
      }

      throw new JBossResourceException("This should never happen", new Throwable("STACKTRACE"));
   }
View Full Code Here

Examples of org.jboss.jca.common.JBossResourceException

      }
      catch (Throwable t)
      {
         getLog().trace("Could not enlist in transaction on entering meta-aware object! " + cl, t)

         throw new JBossResourceException("Could not enlist in transaction on entering meta-aware object!", t);
      }
   }
View Full Code Here

Examples of org.jboss.resource.JBossResourceException

         }
         con.close();
      }
      catch (Throwable e)
      {
         throw new JBossResourceException
            ("Could not properly close the session and connection", e);
      }
   }
View Full Code Here

Examples of org.jboss.resource.JBossResourceException

               if (trace)
                  log.trace("Using a non-XA TopicConnection.  " +
                            "It will not be able to participate in a Global UOW");
            }
            else
               throw new JBossResourceException("Connection was not recognizable: " + con);

            if (trace)
               log.trace("xaTopicSession=" + xaTopicSession + ", topicSession=" + topicSession);
         }
         else if (info.getType() == JmsConnectionFactory.QUEUE)
         {
            String jndi = adapter.getQueueFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'QueueFactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createQueueConnection(factory, user, pwd);
            if (info.getClientID() != null)
               con.setClientID(info.getClientID());
            con.setExceptionListener(this);
            if (trace)
               log.debug("created connection: " + con);

            if (con instanceof XAQueueConnection)
            {
               xaQueueSession =
                  ((XAQueueConnection)con).createXAQueueSession();
               queueSession = xaQueueSession.getQueueSession();
               xaTransacted = true;
            }
            else if (con instanceof QueueConnection)
            {
               queueSession =
                  ((QueueConnection)con).createQueueSession(transacted, ack);
               if (trace)
                  log.trace("Using a non-XA QueueConnection.  " +
                            "It will not be able to participate in a Global UOW");
            }
            else
               throw new JBossResourceException("Connection was not reconizable: " + con);

            if (trace)
               log.trace("xaQueueSession=" + xaQueueSession + ", queueSession=" + queueSession);
         }
         else
         {
            String jndi = adapter.getFactoryRef();
            if (jndi == null)
               throw new IllegalStateException("No configured 'FactoryRef' on the jms provider " + mcf.getJmsProviderAdapterJNDI());
            factory = context.lookup(jndi);
            con = ConnectionFactoryHelper.createConnection(factory, user, pwd);
            if (info.getClientID() != null)
               con.setClientID(info.getClientID());
            con.setExceptionListener(this);
            if (trace)
               log.trace("created connection: " + con);

            if (con instanceof XAConnection)
            {
               xaSession =
                  ((XAConnection)con).createXASession();
               session = xaSession.getSession();
               xaTransacted = true;
            }
            else
            {
               session = con.createSession(transacted, ack);
               if (trace)
                  log.trace("Using a non-XA Connection.  " +
                            "It will not be able to participate in a Global UOW");
            }

            if (trace)
               log.debug("xaSession=" + xaQueueSession + ", Session=" + session);
         }

         if (trace)
            log.debug("transacted=" + transacted + ", ack=" + ack);
      }
      catch (NamingException e)
      {
         throw new JBossResourceException("Unable to setup connection", e);
      }
      catch (JMSException e)
      {
         throw new JBossResourceException("Unable to setup connection", e);
      }
   }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.