【问题标题】:public default constructor error in JAX-RPC 1.1JAX-RPC 1.1 中的公共默认构造函数错误
【发布时间】:2014-07-07 12:06:06
【问题描述】:

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

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.

【问题讨论】:

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


    【解决方案1】:

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

    public Rating() {}
    

    但是,这个类似乎不是您代码的一部分,因此您无法添加它。

    那么,我的问题是为什么要通过 Web 服务接口传递第三方类型?这对我来说似乎不是一个好主意。您希望完全控制此接口及其上的类型。

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-09-09
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-03-20
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多