开发者

Problem in using org.apache.ddlutils.DdlUtilsException

I'm trying to use the org.apache.ddlutils package for reading database metadata. I've written the following method:

开发者_StackOverflow中文版
public static void readMetaData(DataSource dataSource) throws DdlUtilsException{

    final Platform platform = PlatformFactory.createNewPlatformInstance(dataSource);
}

But the statement throws DdlUtilsException gives the following error:

No exception of type DdlUtilsException can be thrown; an exception type must be a subclass of Throwable

I simply do not understand the reason behind this error because the API at http://db.apache.org/ddlutils/api/org/apache/ddlutils/DdlUtilsException.html clearly states the following:

java.lang.Object
  extended by java.lang.Throwable
      extended by java.lang.Exception
          extended by java.lang.RuntimeException
              extended by org.apache.commons.lang.exception.NestableRuntimeException
                  extended by org.apache.ddlutils.DdlUtilsException

Please advice.


My guess is that you've got another class called DdlUtilsException somewhere - possibly in the top-level package, given that the compiler isn't mentioning a full package name. If you're using Eclipse or something similar, try to navigate to the class declaration.

EDIT: Okay, judging by your comment, you aren't including the various dependencies. Make sure you've downloaded DdlUtils-1.0-bin.zip, and the dependencies are all in the lib directory. It's not immediately clear to me whether you need all of them, but you might as well use them all to start with, and then remove what you don't need.


It looks like that other class 'org.apache.commons.lang.exception.NestableRuntimeException' is located in commons-lang. Download and add that jar and it should work. Check the docs for DDL Utils and see what else it depends on.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜