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

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

2015-05-13 21:03 537 查看
Appfuse,Running On Oracle时出现NoSuchTableException错误的解决作者:陈海青(joson chen)(http://www.chq.name)2006.08.01(版权所有:陈海青(joson chen) www.chq.name Copyright (C) 陈海青(joson chen) www.chq.name All Rights Reserved
转载或引用本网版权所有之内容须注明“转自(或引自)chq.name (Junit fans)”字样, 并标明本网站网址http://www.chq.name
)引言:最近,根据Appfuse的文档,学习配置在appfuse上使用oracle数据库。在设置过程中出现了错误,几经周折,终于解决,记录下来,供参考。Appfuse版本:1.9.3Oracle版本: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-loadBuildfile: build.xmlinit: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: xmlBUILD FAILEDD:developmytestbuild.xml:714: org.dbunit.dataset.NoSuchTableException: user_roleTotal time: 3 seconds二、问题的解决1:首先根据错误信息检查相关配置文件D:developmytestbuild.properties,D:developmytestbuild.xml和导入数据文件:D:developmytestmetadatasqlsample-data.xml,发现与文档要求是一致的。2:在网上搜索,根据一些人的建议,进行修改,均没有效果3:对数据库启用全局sql语句跟踪,查找执行的语句,并进行分析,终于解决,看到了盼望已久的success:,屏幕输出:$ ant db-loadBuildfile: build.xmlinit: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: xmlBUILD SUCCESSFULTotal time: 3 seconds三、小结1:这次问题解决的核心是配置好build.properties文件,特别是以下语句:database.username=usernamedatabase.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:
id usernamepasswordfirst_name。。。。。。
2)D:developmytestbuild.properties……# modi by chq,for use oracle-->modi by chq,for use oracle-->database.jar=${lib.dir}/oracle/ojdbc14.jardatabase.type=oracledatabase.host=192.168.1.1#use the database schema owner and password created in step #1 above heredatabase.username=chqdatabase.password=chqdatabase.schema=CHQhibernate.dialect=org.hibernate.dialect.Oracle9Dialectdatabase.driver_ <database.url=jdbc:oracle:thin:@192.168.1.1:1521:chq3)D:developmytestbuild.xml,要改两个target,。。。。。。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐