Ibatis-无法获得属性“武器”来自空引用

发布于 2024-09-24 15:09:39 字数 1318 浏览 3 评论 0原文

我对 Ibatis 很陌生,所以我可能会遗漏一些东西,但我似乎无法弄清楚为什么会出现此错误。

当我尝试保存具有武器引用变量的 Person 对象时,出现此错误。 我知道 person 对象不为 null,因为我验证了对象以查看武器引用变量是否不为 null,并且在 Eclipse 中检查了调试器中的值。 通过验证和调试,我还知道武器引用不为空。

要将我的对象保存到数据库,我使用: getSqlMapClientTemplate().insert(statementMap.get("create"), object);

我使用 informix 作为数据库,使用 jboss 作为应用程序服务器。

我的控制台输出更多:

14:33:12,796 ERROR [STDERR] org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in sqlmaps/person.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the Person.findById.
--- Check the parameter map.
--- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'weapon' from null reference.  Cause: java.lang.NullPointerException; nested exception is com.ibatis.
common.jdbc.exception.NestedSQLException:
--- The error occurred in sqlmaps/person.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the Person.findById.
--- Check the parameter map.
--- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'weapon' from null reference.  Cause: java.lang.NullPointerException

块引用

I'm quite new to Ibatis so I might be missing something, but I can't seem to be able to figure out why I'm getting this error.

I'm getting this error when I try to save a Person object which has a weapon reference variable.
I know the person object isn't null since I validate the object to see if the weapon reference variable isn't null and since I checked the value in my debugger in Eclipse.
Thanks to the validation and debugging I also know that the weapon reference isn't null.

To save my object to the database I use: getSqlMapClientTemplate().insert(statementMap.get("create"), object);

I'm using informix as my database and jboss as my application server.

Bit more output from my console:

14:33:12,796 ERROR [STDERR] org.springframework.jdbc.UncategorizedSQLException: SqlMapClient operation; uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in sqlmaps/person.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the Person.findById.
--- Check the parameter map.
--- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'weapon' from null reference.  Cause: java.lang.NullPointerException; nested exception is com.ibatis.
common.jdbc.exception.NestedSQLException:
--- The error occurred in sqlmaps/person.xml.
--- The error occurred while preparing the mapped statement for execution.
--- Check the Person.findById.
--- Check the parameter map.
--- Cause: com.ibatis.common.beans.ProbeException: Could not get property 'weapon' from null reference.  Cause: java.lang.NullPointerException

Blockquote

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

长不大的小祸害 2024-10-01 15:09:39

这将很难追踪 - SQL 消息信息位于第一行(很长)信息中:

[...] uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in sqlmaps/person.xml.

也就是说,本质上没有任何信息 - 名义上,甚至不是错误,因为 0 是成功代码。但是,我认为一定出了什么问题。

问题:

  • 这之前有用吗?
  • 代码是你写的吗?
  • 可能涉及 blob 类型吗?

我不确定我能用这些答案做些什么;我认为您应该联系 Ibatis 的支持渠道。我发现 SO 上有很多关于 Ibatis 的问题(事实上,几乎和关于 Informix 的问题一样多),所以你可能会很幸运。

如果您最终必须进行调试,我想查看客户端和 Informix 数据服务器之间中继的数据(以及 Ibatis 可以保留的有关其 SQL 活动的任何日志);大多数基于 C 的 Informix 客户端都有一种这样做的机制,但我不确定 JDBC(不过它可能也存在)。如果需要请联系我 - 查看我的个人资料。但我不是 Java 或 JDBC 方面的专家。

This will be tough to track down - the SQL message info is in the first (very long) line of information:

[...] uncategorized SQLException for SQL []; SQL state [null]; error code [0];
--- The error occurred in sqlmaps/person.xml.

That is, essentially, no information - nominally, not even an error since 0 is the success code. However, I think something must have gone wrong.

Questions:

  • Was this working before?
  • Did you write the code?
  • Could blob types be involved?

I'm not sure there's anything much I can do with the answers; I think you should probably approach the support channels for Ibatis. I see that there are a number of questions about Ibatis on SO (nearly as many as there are about Informix, in fact), so you may get lucky.

If you end up having to debug, I'd want to look at the data relayed between client and the Informix data server (and at any log that Ibatis can keep about its SQL activity); there's a mechanism for doing in so in most of the C-based Informix clients, but I'm not sure about JDBC (it probably is there too, though). Contact me if need so be - see my profile. But I'm not an expert on Java or JDBC.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文