Package com.ibatis.common.exception

Examples of com.ibatis.common.exception.NestedRuntimeException


          if (impl instanceof TypeHandlerCallback) {
            typeHandler = new CustomTypeHandler((TypeHandlerCallback) impl);
          } else if (impl instanceof TypeHandler) {
            typeHandler = (TypeHandler) impl;
          } else {
            throw new NestedRuntimeException ("The class '' is not a valid implementation of TypeHandler or TypeHandlerCallback");
          }

          vars.errorCtx.setMoreInfo("Check the javaType attribute '" + javaType + "' (must be a classname) or the jdbcType '" + jdbcType + "' (must be a JDBC type name).");
          if (jdbcType != null && jdbcType.length() > 0) {
            typeHandlerFactory.register(Resources.classForName(javaType), jdbcType, typeHandler);
View Full Code Here


      String xmlConfig = (String) properties.get("sql-map-config-file");

      Reader reader = Resources.getResourceAsReader(xmlConfig);
      sqlMap = SqlMapClientBuilder.buildSqlMapClient(reader);
    } catch (Exception e) {
      throw new NestedRuntimeException("Error configuring SqlMapClientDaoTransactionPool.  Cause: " + e, e);
    }

  }
View Full Code Here

      } else {
        try {
          Class javaClass = Resources.classForName(javaType);
          handler = typeHandlerFactory.getTypeHandler(javaClass, jdbcType);
        } catch (Exception e) {
          throw new NestedRuntimeException("Error.  Could not set TypeHandler.  Cause: " + e, e);
        }
      }
    } else if (typeHandlerFactory.getTypeHandler(clazz, jdbcType) != null) {
      // Primitive
      handler = typeHandlerFactory.getTypeHandler(clazz, jdbcType);
    } else {
      // JavaBean
      if (javaType == null) {
        if (useSetterToResolve) {
          Class type = PROBE.getPropertyTypeForSetter(clazz, propertyName);
          handler = typeHandlerFactory.getTypeHandler(type, jdbcType);
        } else {
          Class type = PROBE.getPropertyTypeForGetter(clazz, propertyName);
          handler = typeHandlerFactory.getTypeHandler(type, jdbcType);
        }
      } else {
        try {
          Class javaClass = Resources.classForName(javaType);
          handler = typeHandlerFactory.getTypeHandler(javaClass, jdbcType);
        } catch (Exception e) {
          throw new NestedRuntimeException("Error.  Could not set TypeHandler.  Cause: " + e, e);
        }
      }
    }
    return handler;
  }
View Full Code Here

        ByteArrayInputStream bis = new ByteArrayInputStream((byte[]) value);
        ObjectInputStream ois = new ObjectInputStream(bis);
        value = ois.readObject();
        ois.close();
      } catch (Exception e) {
        throw new NestedRuntimeException("Error caching serializable object.  Be sure you're not attempting to use " +
            "a serialized cache for an object that may be taking advantage of lazy loading.  Cause: " + e, e);
      }
    }

    synchronized (STATS_LOCK) {
View Full Code Here

        oos.writeObject(value);
        oos.flush();
        oos.close();
        value = bos.toByteArray();
      } catch (IOException e) {
        throw new NestedRuntimeException("Error caching serializable object.  Cause: " + e, e);
      }
    }
    synchronized (getLock(key)) {
      controller.putObject(this, key, value);
    }
View Full Code Here

  }

  private void initialize(Map props) {
    try {
      if (props == null) {
        throw new NestedRuntimeException("SimpleDataSource: The properties map passed to the initializer was null.");
      }

      if (!(props.containsKey(PROP_JDBC_DRIVER)
          && props.containsKey(PROP_JDBC_URL)
          && props.containsKey(PROP_JDBC_USERNAME)
          && props.containsKey(PROP_JDBC_PASSWORD))) {
        throw new NestedRuntimeException("SimpleDataSource: Some properties were not set.");
      } else {

        jdbcDriver = (String) props.get(PROP_JDBC_DRIVER);
        jdbcUrl = (String) props.get(PROP_JDBC_URL);
        jdbcUsername = (String) props.get(PROP_JDBC_USERNAME);
        jdbcPassword = (String) props.get(PROP_JDBC_PASSWORD);

        poolMaximumActiveConnections =
            props.containsKey(PROP_POOL_MAX_ACTIVE_CONN)
            ? Integer.parseInt((String) props.get(PROP_POOL_MAX_ACTIVE_CONN))
            : 10;

        poolMaximumIdleConnections =
            props.containsKey(PROP_POOL_MAX_IDLE_CONN)
            ? Integer.parseInt((String) props.get(PROP_POOL_MAX_IDLE_CONN))
            : 5;

        poolMaximumCheckoutTime =
            props.containsKey(PROP_POOL_MAX_CHECKOUT_TIME)
            ? Integer.parseInt((String) props.get(PROP_POOL_MAX_CHECKOUT_TIME))
            : 20000;

        poolTimeToWait =
            props.containsKey(PROP_POOL_TIME_TO_WAIT)
            ? Integer.parseInt((String) props.get(PROP_POOL_TIME_TO_WAIT))
            : 20000;

        poolPingEnabled =
            props.containsKey(PROP_POOL_PING_ENABLED)
                && Boolean.valueOf((String) props.get(PROP_POOL_PING_ENABLED)).booleanValue();

        poolPingQuery =
            props.containsKey(PROP_POOL_PING_QUERY)
            ? (String) props.get(PROP_POOL_PING_QUERY)
            : "NO PING QUERY SET";

        poolPingConnectionsOlderThan =
            props.containsKey(PROP_POOL_PING_CONN_OLDER_THAN)
            ? Integer.parseInt((String) props.get(PROP_POOL_PING_CONN_OLDER_THAN))
            : 0;

        poolPingConnectionsNotUsedFor =
            props.containsKey(PROP_POOL_PING_CONN_NOT_USED_FOR)
            ? Integer.parseInt((String) props.get(PROP_POOL_PING_CONN_NOT_USED_FOR))
            : 0;

        jdbcDefaultAutoCommit =
            props.containsKey(PROP_JDBC_DEFAULT_AUTOCOMMIT)
                && Boolean.valueOf((String) props.get(PROP_JDBC_DEFAULT_AUTOCOMMIT)).booleanValue();

        useDriverProps = false;
        Iterator propIter = props.keySet().iterator();
        driverProps = new Properties();
        driverProps.put("user", jdbcUsername);
        driverProps.put("password", jdbcPassword);
        while (propIter.hasNext()) {
          String name = (String) propIter.next();
          String value = (String) props.get(name);
          if (name.startsWith(ADD_DRIVER_PROPS_PREFIX)) {
            driverProps.put(name.substring(ADD_DRIVER_PROPS_PREFIX_LENGTH), value);
            useDriverProps = true;
          }
        }

        expectedConnectionTypeCode = assembleConnectionTypeCode(jdbcUrl, jdbcUsername, jdbcPassword);

        Resources.instantiate(jdbcDriver);
      }

    } catch (Exception e) {
      log.error("SimpleDataSource: Error while loading properties. Cause: " + e.toString(), e);
      throw new NestedRuntimeException("SimpleDataSource: Error while loading properties. Cause: " + e, e);
    }
  }
View Full Code Here

      return System.currentTimeMillis() - checkoutTimestamp;
    }

    private Connection getValidConnection() {
      if (!valid) {
        throw new NestedRuntimeException("Error accessing SimplePooledConnection.  Connection has been invalidated (probably released back to the pool).");
      }
      return realConnection;
    }
View Full Code Here

      if (dataSource == null) {
        dataSource = newDbcpConfiguration(properties);
      }

    } catch (Exception e) {
      throw new NestedRuntimeException("Error initializing DbcpDataSourceFactory.  Cause: " + e, e);
    }
  }
View Full Code Here

    Nodelet nodelet = (Nodelet) letMap.get(pathString);
    if (nodelet != null) {
      try {
        nodelet.process(node);
      } catch (Exception e) {
        throw new NestedRuntimeException("Error parsing XPath '" + pathString + "'.  Cause: " + e, e);
      }
    }
  }
View Full Code Here

        Node includeNode = (Node) vars.sqlIncludes.get(refid);
        if (includeNode == null) {
          String nsrefid = applyNamespace(refid);
          includeNode = (Node) vars.sqlIncludes.get(nsrefid);
          if (includeNode == null) {
            throw new NestedRuntimeException("Could not find SQL statement to include with refid '" + refid + "'");
          }
        }
        isDynamic = parseDynamicTags(includeNode, dynamic, sqlBuffer, isDynamic, false);
      } else {
        vars.errorCtx.setMoreInfo("Check the dynamic tags.");
View Full Code Here

TOP

Related Classes of com.ibatis.common.exception.NestedRuntimeException

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.