JAX-RPC 1.1中的公共默认构造函数错误

时间:2014-07-07 12:06:07

标签: java web-services soap apache-spark jax-rpc

我写了一个网络服务,我收到了这个错误。我该如何解决这个错误?

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.

1 个答案:

答案 0 :(得分:3)

问题在于类org.apache.spark.mllib.recommendation.Rating,它不包含默认构造函数。

public Rating() {}

但是,看起来这个类不是代码的一部分,因此你无法添加它。

所以,我的问题是你为什么要在你的网络服务界面上传递第三方类型?这对我来说似乎不是一个好主意。您希望完全控制此接口及其上的类型。

也许您可以提出自己的类型,确保它已定义默认构造函数,然后在收到时将数据映射到org.apache.spark.mllib.recommendation.Rating类型。