Caused by: java.security.PrivilegedActionException:
com.sun.xml.bind.v2.runtime.IllegalAnnotationsException: 1 counts of
IllegalAnnotationExceptions There's no ObjectFactory with an
@XmlElementDecl for the element
{http://www.w3.org/2004/08/xop/include}Include.
this problem is related to the following location:
at protected java.util.List ru.gosuslugi.smev.rev120315.ReferenceType.content
at ru.gosuslugi.smev.rev120315.ReferenceType
at public javax.xml.bind.JAXBElement ru.gosuslugi.smev.rev120315.ObjectFactory.createReference(ru.gosuslugi.smev.rev120315.ReferenceType)
at ru.gosuslugi.smev.rev120315.ObjectFactory
at protected java.util.List ru.gosuslugi.smev.rev120315.AppDataType.any
at ru.gosuslugi.smev.rev120315.AppDataType
at protected ru.gosuslugi.smev.rev120315.AppDataType ru.gosuslugi.smev.rev120315.MessageDataType.appData
at ru.gosuslugi.smev.rev120315.MessageDataType
at protected ru.gosuslugi.smev.rev120315.MessageDataType
ru.gosuslugi.smev.rev120315.BaseMessageType.messageData
at ru.gosuslugi.smev.rev120315.BaseMessageType

You don't specify what kind of application you are deploying to GlassFish, but if it is a JAX-RS/Jersey application I would recommend the use of a ContextResolver. This is a standard mechanism that gives you greater control over how your JAXBContext is created. Below is an example.

I faced exactly the same issue 6 months ago and honestly I don't remember how it was solved (probably we didn't need some functionality so we put it aside). But today once again our lovely stacktrace cursed with the message (literally like yours)

But this time I was able to deal with it.

There's nothing wrong with Include class. But somehow, and that's my guess, it doesn't get loaded properly for jaxb, or not at the time we need it, or ... whatever.

What I was trying to do in my code is to validate a payload of the soap message.

Spare me for the hardcoded values, it's just for debugging. Nonetheless the first line is where the exception is thrown because Jaxb somehow knows nothing about Include or uses the wrong class. To fix it one needs to load multiple classes at the same call.

So the ultimate fix for me was

JAXBContext.newInstance(Include.class, UnifoTransferMsg.class);

Hope that helps and maybe one day i'll expand more on the real cause of the problem.

This seems that your SOAP marshaller is not able to find the ObjectFactoy. I happens when we specify wrong package to marshaller (e.g. Jaxb). So, how you are consuming this web service? I mean via Spring WebServiceTemplate or something else? What are the marsheller/unmarshaller used?
–
vikasAug 23 '12 at 4:49