简体   繁体   中英

public default constructor error in JAX-RPC 1.1

I wrote a web service and i got this error. How can i fix this error ?

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.

The problem is with the class org.apache.spark.mllib.recommendation.Rating which does not contain a default constructor.

ie

public Rating() {}

However, it would appear that this class is not part of your code and hence you cannot add it.

So, my question would be why are you passing a third party type over your web service interface? This does not seem like a good idea to me. You want to have complete control over this interface and the types on it.

Perhaps you could come up with your own type, ensuring it has a default constructor defined and then on receipt, map the data from it to the type org.apache.spark.mllib.recommendation.Rating.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM