File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Web Services and the fly likes is an interface, and JAXB can't handle interfaces Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Web Services
Bookmark " is an interface, and JAXB can Watch " is an interface, and JAXB can New topic
Author is an interface, and JAXB can't handle interfaces

sachin baveja

Joined: May 16, 2011
Posts: 3
I am trying to implement a JAX-WS web service as asynchronous.
I have implemented the client side code as follows:

CallbackHandler callbackHandler = new CallbackHandler ();
Future<?> resp = serverProxy.validateAsAsync(request, callbackHandler);
response = callbackHandler.getResponse();

class CallbackHandler implements AsyncHandler<MyResponse> {
private MyResponse output;
public void handleResponse(Response<MyResponse> response) {
try {
output = response.get();
}catch (ExecutionException e) {
} catch (InterruptedException e) {

MyResponsegetResponse() {
return output;

The SEI looks like below
public Future<?> validateAsAsync(
@WebParam(name = "MyRequest", targetNamespace = "", partName = "parameter")
MyRequest parameter,
@WebParam(name = "callbackhandler", targetNamespace = "", partName = "asyncHandler")
AsyncHandler<MyResponse> asyncHandler);

I am getting the following error:
Caused by: com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 4 counts of IllegalAnnotationExceptions is an interface, and JAXB can't handle interfaces.
this problem is related to the following location:
at private jaxws.ValidateAsAsync.callbackhandler

Looks like Jax-WS is not able to create the Jax-B object for ASyncHandler since it is an interface, how to get around this issue?
I really appreciate your help.

I agree. Here's the link:
subject: is an interface, and JAXB can't handle interfaces
It's not a secret anymore!