DataNucleus JDO 故障排除
我正在使用 Google App Engine 1.2.6 和 Web Toolkit 1.7.1 的 Eclipse 插件 DataNucleus/JDO 让我抓狂! 我怀疑我的创建在写入之前会默默地出错和/或读取不一致地填充对象。
我可以使用一些技巧来弄清楚到底发生了什么。
- 使用最低限度未修改的GAE项目,dn增强器写入的日志在哪里?
- 是否有数据存储代码写入的日志?
是否可以检查 local_db.bin 文件的内容?
使用下面的基本 JDO 事务语法,如何在不干扰内置错误处理机制的情况下理解错误/异常?
使用下面的
TIA, 安迪
private final Provider<PersistenceManager> pmp; private PersistenceManager pm; MyResult result; // results from handler, usually has object id or error message try { pm = pmp.get(); pm.currentTransaction().begin(); /* validate, fetch, create/update persistent myObject */ pm.currentTransaction().commit(); result = new MyResult( myObject.getId() ); } finally { if (pm.currentTransaction().isActive()) { logger.severe("DN fails..."); pm.currentTransaction().rollback(); result = new MyResult( "error message why failed" ); } } return (result);
I am using the Eclipse plugin for Google App Engine 1.2.6 and Web Toolkit 1.7.1
DataNucleus/JDO is driving me mad!
I suspect either my creates are silently erroring out before being written AND/OR the reads are inconsistently populating the objects.
I could use some tips on figuring out what is really happening.
- Using a minimally unmodified GAE project, where is the log written by the dn enhancer?
- Is there a log written by the datastore code?
Is there anyway to inspect the contents local_db.bin file?
Using the basic JDO transaction syntax below, how do I understand the error/exception without disturbing the builtin error handing mechanism?
TIA,
Andy
private final Provider<PersistenceManager> pmp; private PersistenceManager pm; MyResult result; // results from handler, usually has object id or error message try { pm = pmp.get(); pm.currentTransaction().begin(); /* validate, fetch, create/update persistent myObject */ pm.currentTransaction().commit(); result = new MyResult( myObject.getId() ); } finally { if (pm.currentTransaction().isActive()) { logger.severe("DN fails..."); pm.currentTransaction().rollback(); result = new MyResult( "error message why failed" ); } } return (result);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
所以你想调试这个但你将日志级别设置为 INFO 吗?我建议 DEBUG 会更有意义。 GAE/J 文档有一些关于日志记录的页面 - 抱歉不记得 URL;搜索他们的 Google 群组,因为有很多关于它的帖子。未定义如何调用增强器?使用 Google 的 Eclipse 插件?还是手动?还是Maven2?还是蚂蚁? DN 文档定义了除 Google 插件之外的所有选项的日志位置(因为那是他们的,我们不支持它)。
显然有一个 local_db 查看器 - 搜索他们的 Google 群组
--Andy (DataNucleus)
So you want to debug this yet you set log levels to INFO? I'd suggest DEBUG would make way more sense. The GAE/J docs have some page on logging - can't remember the URL sorry; search their Google Group cos there are several posts about it. How you invoke the enhancer is not defined ? Using Google's Eclipse plugin ? or manually ? or Maven2 ? or Ant ? The DN docs define where the log is ... for all options except Googles plugin (since that is theirs and we don't support it).
Obviously there is a local_db viewer - search their Google Group
--Andy (DataNucleus)