001/* 002 * Licensed to the Apache Software Foundation (ASF) under one 003 * or more contributor license agreements. See the NOTICE file 004 * distributed with this work for additional information 005 * regarding copyright ownership. The ASF licenses this file 006 * to you under the Apache License, Version 2.0 (the 007 * "License"); you may not use this file except in compliance 008 * with the License. You may obtain a copy of the License at 009 * 010 * http://www.apache.org/licenses/LICENSE-2.0 011 * 012 * Unless required by applicable law or agreed to in writing, 013 * software distributed under the License is distributed on an 014 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 015 * KIND, either express or implied. See the License for the 016 * specific language governing permissions and limitations 017 * under the License. 018 */ 019package org.apache.reef.tang.exceptions; 020 021/** 022 * Thrown when Tang encounters an unknown (to the current classloader) class 023 * or configuration option. NameResolutionExceptions can only be encountered 024 * if: 025 * <ol> 026 * <li> Tang is processing a configuration file from an external source </li> 027 * <li> Classes / NamedParameters are passed to Tang in String form </li> 028 * <li> Class objects are passed directly to Tang, but it is using a different 029 * classloader than the calling code.</li> 030 * <li> Tang is processing Configurations using a ClassHierarchy produced by 031 * another process </li> 032 * </ol> 033 */ 034public class NameResolutionException extends BindException { 035 private static final long serialVersionUID = 1L; 036 037 public NameResolutionException(final String name, final String longestPrefix) { 038 super("Could not resolve " + name + ". Search ended at prefix " + longestPrefix + 039 " This can happen due to typos in class names that are passed as strings, or because Tang is configured " + 040 "to use a classloader other than the one that generated the class reference " + 041 "(check your classpath and the code that instantiated Tang)"); 042 } 043}