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

标签 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.

最佳答案

问题在于 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/

相关文章:

java - 在java中扩展内部类

java - PopupMenu 未在 RecyclerView 中正确定位

java - 如何在 jersey Rest Webservice 中接受 json 数组输入

vb.net - 类型未显示以供服务引用

http - 如何在不关闭连接的情况下在分块的 http 响应中途报告错误?

java - SOAP 负载中的特殊字符未正确传输

java - Install4j: 安装程序:sys.installationDir 不一致

java - 是否可以将一个变量的名称设置为另一个变量的内容?

wcf - 将 OperationContext.Current 存储在 WCF 服务实例的实例变量中

java - 使用 Java 的 SOAP Web 服务 - 框架?