我编写了一个网络服务,但遇到了这个错误。我该如何修复这个错误?
The service class "com.argedor.ttnetMusic.recommendationWebService.Recommender" does not comply to one or more requirements of the JAX-RPC 1.1 specification, and may not deploy or function correctly.
The value type "org.apache.spark.mllib.recommendation.Rating" used via the service class "com.argedor.ttnetMusic.recommendationWebService.Recommender" does not have a public default constructor. Chapter 5.4 of the JAX-RPC 1.1 specification requires a value type to have a public default constructor, otherwise a JAX-RPC 1.1 compliant Web service engine may be unable to construct an instance of the value type during deserialization.
最佳答案
问题在于 org.apache.spark.mllib.recommendation.Rating 类不包含默认构造函数。
即
public Rating() {}
但是,该类似乎不是您代码的一部分,因此您无法添加它。
所以,我的问题是为什么要通过 Web 服务接口(interface)传递第三方类型?这对我来说似乎不是一个好主意。您希望完全控制此接口(interface)及其上的类型。
也许您可以提出自己的类型,确保它定义了默认构造函数,然后在收到时将数据映射到 org.apache.spark.mllib.recommendation.Rating 类型。
关于java - JAX-RPC 1.1 中的公共(public)默认构造函数错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/24610221/