Appfuse,Oracle出现 NoSuchTableException错误的解决

引言:

最近,我根据Appfuse的文档,学习配置在appfuse上使用oracle数据库。在设置过程中出现了错误org.dbunit.dataset.NoSuchTableException,几经周折,终于解决,记录下来,供参考。

Appfuse版本:1.9.3

Oracle版本:9.2

AppfuseRunning 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.propertiesD: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.usernamedatabase.schema要与数据库中的一致,一般情况下为大写。

2appfuse 1.9.3build.xmlmetadatasqlsample-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、  我的配置文件:

1metadatasqlsample-data.xml

 

 

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值