Package com.taobao.datasource.resource

Examples of com.taobao.datasource.resource.JBossResourceException


      if (trace)
         log.trace("Checking driver for URL: " + url);

      if (driverClass == null)
      {
         throw new JBossResourceException("No Driver class specified!");
      }

      // Check if the driver is already loaded, if not then try to load it

      if (isDriverLoadedForURL(url))
      {
         return driver;
      } // end of if ()

      try
      {
         //try to load the class... this should register with DriverManager.
         Class clazz = Class.forName(driverClass, true, Thread.currentThread().getContextClassLoader());
         if (isDriverLoadedForURL(url))
            //return immediately, some drivers (Cloudscape) do not let you create an instance.
            return driver;

         //We loaded the class, but either it didn't register
         //and is not spec compliant, or is the wrong class.
         driver = (Driver) clazz.newInstance();
         DriverManager.registerDriver(driver);
         if (isDriverLoadedForURL(url))
            return driver;
         //We can even instantiate one, it must be the wrong class for the URL.
      }
      catch (Exception e)
      {
         throw new JBossResourceException("Failed to register driver for: " + driverClass, e);
      }

      throw new JBossResourceException("Apparently wrong driver class specified for URL: class: " + driverClass
            + ", url: " + url);
   }
View Full Code Here


      return this;
   }

   public XAResource getXAResource() throws ResourceException
   {
      throw new JBossResourceException("Local tx only!");
   }
View Full Code Here

            {
               checkException(e);
            }
         }
         else
            throw new JBossResourceException("Trying to begin a nested local tx");
      }
   }
View Full Code Here

         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();
         log.warn("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

TOP

Related Classes of com.taobao.datasource.resource.JBossResourceException

Copyright © 2018 www.massapicom. 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.