您的位置:首页 > 数据库 > Oracle

Appfuse,Oracle出现 NoSuchTableException错误的解决

2015-05-13 21:03 369 查看
引言: 最近,我根据Appfuse的文档,学习配置在appfuse上使用oracle数据库。在设置过程中出现了错误org.dbunit.dataset.NoSuchTableException,几经周折,终于解决,记录下来,供参考。 Appfuse版本:1.9.3 Oracle版本:9.2

Appfuse,Running On Oracle时出现NoSuchTableException错误的解决

引言: 最近,根据Appfuse的文档,学习配置在appfuse上使用oracle数据库。在设置过程中出现了错误,几经周折,终于解决,记录下来,供参考。 Appfuse版本:1.9.3 Oracle版本:9.2 一、问题的出现: 在按照文档要求,需要完成以下几步:1) Create Database Schema :chq;2) Setup JDBC Driver ;3) Edit build.properties in the main AppFuse Directory ;4) Generate Application;5)Deploy Application ;6) Test Database Access 。在执行时第5步发布程序ant setup时,程序报错:org.dbunit.dataset.NoSuchTableException,屏幕输出如下: $ ant db-load Buildfile: build.xml init: prepare: [echo] Preparing target directory 'D:developmytest/build/mytest'db-load: [dbunit] Executing operation: CLEAN_INSERT [dbunit] on file: D:developmytestmetadatasqlsample-data.xml [dbunit] with format: xml BUILD FAILED D:developmytestuild.xml:714: org.dbunit.dataset.NoSuchTableException: user_role Total time: 3 seconds 二、问题的解决 1:首先根据错误信息检查相关配置文件D:developmytestuild.properties,D:developmytestuild.xml和导入数据文件:D:developmytestmetadatasqlsample-data.xml,发现与文档要求是一致的。 2:在网上搜索,根据一些人的建议,进行修改,均没有效果 3:对数据库启用全局sql语句跟踪,查找执行的语句,并进行分析,终于解决,看到了盼望已久的success:,屏幕输出: $ ant db-load Buildfile: build.xml init: prepare: [echo] Preparing target directory 'D:developmytest/build/mytest'db-load: [dbunit] Executing operation: CLEAN_INSERT [dbunit] on file: D:developmytestmetadatasqlsample-data.xml [dbunit] with format: xml BUILD SUCCESSFUL Total time: 3 seconds 三、小结 1:这次问题解决的核心是配置好build.properties文件,特别是以下语句:
database.username=username
database.schema=schemaname(case sensitive using 10g)
要注意,在使用oracle9时,由于默认情况下,所有的标识符(包括数据库各种对象名、用户名等)均以大写形式保存在数据库字典里,除非以引号包裹的形式强行指定为小写。所以 这里的database.username和database.schema要与数据库中的一致,一般情况下为大写。 2:appfuse 1.9.3的build.xml和metadatasqlsample-data.xml两个文件已经没问题了,除了参照appfuse文档设置为使用oracle外,不必额外修改。 网上不少文章谈到要修改这两个文件中的内容,如sample-data.xml里表名前加上schema名、表名大写、直接设置build.xml的“operation”属性值等可能是针对以前版本的。我的测试结果是:sample-data.xml里表名前加上schema名汇报错;表名大小写不敏感. 3:其他设置按照appfuse文档要求进行设置。 4:注意在设置build.properties时,井号符号”#”只有在行首时才是注释符号, 如以下语句
database.schema=schemaname#(case sensitive using 10g)
会被解析为:schema名为“schemaname #(case sensitive using 10g)”,这是错误的,应该为
database.schema=schemaname
#(case sensitive using 10g)
四、相关资料: 1、 http://appfuse.org/wiki/ 2、 使用oracle的系统跟踪功能调试java程序(http://www.chq.name/content/view/126/59/ 3、 我的配置文件: 1)metadatasqlsample-data.xml:
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐