title: javax.xml.ws.WebServiceException: Unable to create JAXBContext while calling webservice from web application
body: <p>I am new to Apache CXF and trying to create a Webservices Simulator and Webservices Client from wsdl using apache-cxf-2.7.8.</p>
  
  <p>I created the simulator successfully and is able to hit the simulator webservice from main method client </p>
  
  <p>public static void main(String args[]) throws java.lang.Exception {</p>
  
  <pre><code>    URL wsdlURL = new URL("http://localhost:7020/sirius_uwi_simulator2/services/RetrieveTelematicsDataPTEndpoint?wsdl");
      GetDataService ss = new GetDataService(wsdlURL, SERVICE_NAME);
      GetDataPT port = ss.getRetrieveTelematicsDataPTEndpoint();  
  </code></pre>
  
  <p>However when i try to call the same simulator webservice from my struts application using the client code shown below </p>
  
  <p>public static EnrollmentInformation retrieveTelematicsData(String vin) throws java.lang.Exception {</p>
  
  <pre><code>    URL wsdlURL = new URL("http://localhost:7020/sirius_uwi_simulator2/services/RetrieveTelematicsDataPTEndpoint?wsdl");
      GetDataService ss = new GetDataService(wsdlURL, SERVICE_NAME);
      GetDataPT port = ss.getRetrieveTelematicsDataPTEndpoint();  
  </code></pre>
  
  <p>It is throwing this exception :</p>
  
  <pre><code>ERROR com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.execute_aroundBody0 - Validating Terms And Conditions Failed
  javax.xml.ws.WebServiceException: Unable to create JAXBContext
      at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:153)
      at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.postProcess(AbstractSEIModelImpl.java:83)
      at com.sun.xml.internal.ws.model.RuntimeModeler.buildRuntimeModel(RuntimeModeler.java:244)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.createSEIPortInfo(WSServiceDelegate.java:687)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.addSEI(WSServiceDelegate.java:675)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:330)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:313)
      at com.sun.xml.internal.ws.client.WSServiceDelegate.getPort(WSServiceDelegate.java:295)
      at javax.xml.ws.Service.getPort(Service.java:92)
      at com.sirius.ws.gettelematicsdata.generated.service.vehicleTelematicsPreferences.retrieveTelematicsData.GetDataService.getRetrieveTelematicsDataPTEndpoint_aroundBody0(GetDataService.java:58)
      at com.sirius.ws.gettelematicsdata.generated.service.vehicleTelematicsPreferences.retrieveTelematicsData.GetDataService$AjcClosure1.run(GetDataService.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:104)
      at com.sirius.ws.gettelematicsdata.generated.service.vehicleTelematicsPreferences.retrieveTelematicsData.GetDataService.getRetrieveTelematicsDataPTEndpoint(GetDataService.java:58)
      at com.sirius.uwi.starss.wsclient.GetTelematicsData.retrieveTelematicsData_aroundBody0(GetTelematicsData.java:27)
      at com.sirius.uwi.starss.wsclient.GetTelematicsData$AjcClosure1.run(GetTelematicsData.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
      at com.sirius.uwi.starss.wsclient.GetTelematicsData.retrieveTelematicsData(GetTelematicsData.java:25)
      at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.simulateTermsAndConditionsValidation(ValidateTermsAndConditionsAction.java:71)
      at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.execute_aroundBody0(ValidateTermsAndConditionsAction.java:35)
      at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction$AjcClosure1.run(ValidateTermsAndConditionsAction.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
      at com.sirius.uwi.starss.action.ValidateTermsAndConditionsAction.execute(ValidateTermsAndConditionsAction.java:26)
      at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
      at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
      at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
      at java.lang.reflect.Method.invoke(Method.java:597)
      at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)
      at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)
      at com.opensymphony.xwork2.interceptor.TimerInterceptor.invokeUnderTiming(TimerInterceptor.java:135)
      at com.opensymphony.xwork2.interceptor.TimerInterceptor.intercept(TimerInterceptor.java:122)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.sirius.uwi.starss.interceptors.CSRAccessInterceptor.intercept_aroundBody4(CSRAccessInterceptor.java:140)
      at com.sirius.uwi.starss.interceptors.CSRAccessInterceptor$AjcClosure5.run(CSRAccessInterceptor.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
      at com.sirius.uwi.starss.interceptors.CSRAccessInterceptor.intercept(CSRAccessInterceptor.java:77)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:167)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:265)
      at org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.sirius.uwi.starss.interceptors.RemoveAccountFromSessionInterceptor.intercept_aroundBody2(RemoveAccountFromSessionInterceptor.java:52)
      at com.sirius.uwi.starss.interceptors.RemoveAccountFromSessionInterceptor$AjcClosure3.run(RemoveAccountFromSessionInterceptor.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
      at com.sirius.uwi.starss.interceptors.RemoveAccountFromSessionInterceptor.intercept(RemoveAccountFromSessionInterceptor.java:42)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.sirius.uwi.starss.interceptors.MaintenanceModeInterceptor.intercept_aroundBody2(MaintenanceModeInterceptor.java:49)
      at com.sirius.uwi.starss.interceptors.MaintenanceModeInterceptor$AjcClosure3.run(MaintenanceModeInterceptor.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
      at com.sirius.uwi.starss.interceptors.MaintenanceModeInterceptor.intercept(MaintenanceModeInterceptor.java:44)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.sirius.uwi.starss.interceptors.NavigationInterceptor.intercept_aroundBody2(NavigationInterceptor.java:126)
      at com.sirius.uwi.starss.interceptors.NavigationInterceptor$AjcClosure3.run(NavigationInterceptor.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.invoke(LogAspect.java:170)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.ajc$inlineAccessMethod$com_sirius_uwi_utils_logging_aspect_LogAspect$com_sirius_uwi_utils_logging_aspect_LogAspect$invoke(LogAspect.java:1)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:114)
      at com.sirius.uwi.starss.interceptors.NavigationInterceptor.intercept(NavigationInterceptor.java:48)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:138)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:239)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at org.apache.struts2.interceptor.CheckboxInterceptor.intercept(CheckboxInterceptor.java:91)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.ModelDrivenInterceptor.intercept(ModelDrivenInterceptor.java:100)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.ScopedModelDrivenInterceptor.intercept(ScopedModelDrivenInterceptor.java:141)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at org.apache.struts2.interceptor.ProfilingActivationInterceptor.intercept(ProfilingActivationInterceptor.java:104)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at org.apache.struts2.interceptor.debugging.DebuggingInterceptor.intercept(DebuggingInterceptor.java:256)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.ChainingInterceptor.intercept(ChainingInterceptor.java:145)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:161)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.PrepareInterceptor.doIntercept(PrepareInterceptor.java:171)
      at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at org.apache.struts2.interceptor.ServletConfigInterceptor.intercept(ServletConfigInterceptor.java:164)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.opensymphony.xwork2.interceptor.ExceptionMappingInterceptor.intercept(ExceptionMappingInterceptor.java:189)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at com.sirius.uwi.commons.web.struts.interceptors.TrimParametersInterceptor.intercept_aroundBody2(TrimParametersInterceptor.java:30)
      at com.sirius.uwi.commons.web.struts.interceptors.TrimParametersInterceptor$AjcClosure3.run(TrimParametersInterceptor.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:104)
      at com.sirius.uwi.commons.web.struts.interceptors.TrimParametersInterceptor.intercept(TrimParametersInterceptor.java:20)
      at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)
      at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)
      at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:563)
      at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)
      at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:83)
      at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:76)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at com.sirius.uwi.commons.web.filter.LoggingRequestFilter.doFilter_aroundBody4(LoggingRequestFilter.java:57)
      at com.sirius.uwi.commons.web.filter.LoggingRequestFilter$AjcClosure5.run(LoggingRequestFilter.java:1)
      at org.aspectj.runtime.reflect.JoinPointImpl.proceed(JoinPointImpl.java:149)
      at com.sirius.uwi.utils.logging.aspect.LogAspect.logTimeMethod(LogAspect.java:104)
      at com.sirius.uwi.commons.web.filter.LoggingRequestFilter.doFilter(LoggingRequestFilter.java:45)
      at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
      at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
      at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
      at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
      at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
      at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
      at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
      at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:298)
      at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:859)
      at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:588)
      at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:489)
      at java.lang.Thread.run(Thread.java:662)
  Caused by: java.security.PrivilegedActionException: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
  javax.xml.bind.JAXBElement does not have a no-arg default constructor.
      this problem is related to the following location:
          at javax.xml.bind.JAXBElement
          at static final javax.xml.bind.JAXBElement com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory.createCDIID_aroundBody8(com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory,java.lang.String,org.aspectj.lang.JoinPoint)
          at com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory
  
      at java.security.AccessController.doPrivileged(Native Method)
      at com.sun.xml.internal.ws.model.AbstractSEIModelImpl.createJAXBContext(AbstractSEIModelImpl.java:140)
      ... 138 more
  Caused by: com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException: 1 counts of IllegalAnnotationExceptions
  javax.xml.bind.JAXBElement does not have a no-arg default constructor.
      this problem is related to the following location:
          at javax.xml.bind.JAXBElement
          at static final javax.xml.bind.JAXBElement com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory.createCDIID_aroundBody8(com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory,java.lang.String,org.aspectj.lang.JoinPoint)
          at com.sirius.ws.gettelematicsdata.generated.schemas.telematics.common.mobileWebHeader.ObjectFactory
  
      at com.sun.xml.internal.bind.v2.runtime.IllegalAnnotationsException$Builder.check(IllegalAnnotationsException.java:91)
      at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.getTypeInfoSet(JAXBContextImpl.java:436)
      at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl.&lt;init&gt;(JAXBContextImpl.java:277)
      at com.sun.xml.internal.bind.v2.runtime.JAXBContextImpl$JAXBContextBuilder.build(JAXBContextImpl.java:1100)
      at com.sun.xml.internal.bind.v2.ContextFactory.createContext(ContextFactory.java:143)
      at com.sun.xml.internal.bind.api.JAXBRIContext.newInstance(JAXBRIContext.java:95)
      at com.sun.xml.internal.ws.developer.JAXBContextFactory$1.createJAXBContext(JAXBContextFactory.java:97)
      at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:148)
      at com.sun.xml.internal.ws.model.AbstractSEIModelImpl$1.run(AbstractSEIModelImpl.java:140)
      ... 140 more
  </code></pre>
  
  <p>Does anyone have any idea why is this happening?  Why does it work when called from main method of client but not from struts based web application. I am guessing it must be related to the jars. </p>