如何解决依赖版本冲突(NoSuchMethodError)
在我的 Spring 3.0.5 Web MVC 应用程序中,我定义了一个模型类,其属性用 @SafeHtml 注释。当 Spring 尝试验证此模型对象时,它会出现以下错误:
HTTP ERROR: 500
org.jsoup.Jsoup.isValid(Ljava/lang/String;Lorg/jsoup/safety/Whitelist;)Z
RequestURI=/guestbook/process-new-entry
Caused by:
java.lang.NoSuchMethodError: org.jsoup.Jsoup.isValid(Ljava/lang/String;Lorg/jsoup/safety/Whitelist;)Z
at org.hibernate.validator.constraints.impl.SafeHtmlValidator.isValid(SafeHtmlValidator.java:62)
at org.hibernate.validator.constraints.impl.SafeHtmlValidator.isValid(SafeHtmlValidator.java:34)
at org.hibernate.validator.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:278)
... (abbreviated)
我知道这是由于我没有使用正确版本的 Jsoup 造成的。 (我使用的是 0.2.2)在我使用的这个版本中,isValid() 的方法签名已更改或已被完全删除。因此,为了解决这个问题,我相信我应该使用不同版本的 Jsoup。我说得对吗?
假设,如果我想继续使用我当前使用的版本怎么办?其他需要更改版本的部分是什么?它是 Hibernate 验证器吗?
另外,有人可以建议一种方法来找出要使用的 Jsoup 版本吗? 您通常如何解决此类错误?
最后一个问题是,行尾的“Z”字母是什么意思?我有时也会遇到其他信件。这些字母是什么意思?这有记录在任何地方吗?
预先感谢大家帮助我更好地理解应该如何解决这些版本差异,这样我将来就不需要浪费这么多时间了......干杯!
In my Spring 3.0.5 Web MVC application I have defined a model class with a property annotated with @SafeHtml. When Spring tries to validate this model object, it blows up with the following:
HTTP ERROR: 500
org.jsoup.Jsoup.isValid(Ljava/lang/String;Lorg/jsoup/safety/Whitelist;)Z
RequestURI=/guestbook/process-new-entry
Caused by:
java.lang.NoSuchMethodError: org.jsoup.Jsoup.isValid(Ljava/lang/String;Lorg/jsoup/safety/Whitelist;)Z
at org.hibernate.validator.constraints.impl.SafeHtmlValidator.isValid(SafeHtmlValidator.java:62)
at org.hibernate.validator.constraints.impl.SafeHtmlValidator.isValid(SafeHtmlValidator.java:34)
at org.hibernate.validator.engine.ConstraintTree.validateSingleConstraint(ConstraintTree.java:278)
... (abbreviated)
I understand this is caused by my not using the right version of Jsoup. (I'm using 0.2.2) In this version I am using, the method signature for isValid() has changed or has been removed altogether. So to resolve this, I believe I should use a different version of Jsoup. Am I right?
Hypothetically, what if I wanted to keep using the version I am currently using - what is the other part that needs a change in version? Is it the Hibernate validator?
Also, can anyone suggest a way to find out which version of Jsoup to use? How do you usually resolve this kind of errors?
And, one final question, what does to "Z" letter at the end of the line mean? I sometimes come across other letters as well. What do these letters mean? Is this documented anywhere?
Thank you all in advance for helping me arrive at a better understanding of how these version discrepancies should be resolved, so I wouldn't need to waste so much of my time in the future... Cheers!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
![扫码二维码加入Web技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)