title: How to fix javax.xml.ws.WebServiceException: java.lang.NullPointerException?
body: <p>I'm running me Spring Boot application (<code>mvn:spring-boot:run</code>) and get next stack trace: </p>
  
  <pre><code> \\/  ___)| |_)| | | | | || (_| |  ) ) ) )
    '  |____| .__|_| |_|_| |_\__, | / / / /
   =========|_|==============|___/=/_/_/_/
   :: Spring Boot ::        (v1.3.2.RELEASE)
  
  2016-02-10 09:57:31.350  INFO 8868 --- [           main] com.comp.config.Application         : Starting Application on SOFT12 with PID 8868 (C:\Users\Maya\git\app-services\target\classes started by Maya in C:\Users\Maya\git\app-services)
  2016-02-10 09:57:31.356  INFO 8868 --- [           main] com.comp.config.Application         : No active profile set, falling back to default profiles: default
  2016-02-10 09:57:31.429  INFO 8868 --- [           main] ationConfigEmbeddedWebApplicationContext : Refreshing org.springframework.boot.context.embedded.AnnotationConfigEmbeddedWebApplicationContext@7dd7f653: startup date [Wed Feb 10 09:57:31 MSK 2016]; root of context hierarchy
  2016-02-10 09:57:33.174  INFO 8868 --- [           main] o.s.b.f.s.DefaultListableBeanFactory     : Overriding bean definition for bean 'beanNameViewResolver' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/ErrorMvcAutoConfiguration$WhitelabelErrorViewConfiguration.class]] with [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=org.springframework.boot.autoconfigure.web.WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter; factoryMethodName=beanNameViewResolver; initMethodName=null; destroyMethodName=(inferred); defined in class path resource [org/springframework/boot/autoconfigure/web/WebMvcAutoConfiguration$WebMvcAutoConfigurationAdapter.class]]
  2016-02-10 09:57:35.126  INFO 8868 --- [           main] s.b.c.e.t.TomcatEmbeddedServletContainer : Tomcat initialized with port(s): 8080 (http)
  2016-02-10 09:57:35.151  INFO 8868 --- [           main] o.apache.catalina.core.StandardService   : Starting service Tomcat
  2016-02-10 09:57:35.153  INFO 8868 --- [           main] org.apache.catalina.core.StandardEngine  : Starting Servlet Engine: Apache Tomcat/8.0.30
  2016-02-10 09:57:35.296  INFO 8868 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/]       : Initializing Spring embedded WebApplicationContext
  2016-02-10 09:57:35.296  INFO 8868 --- [ost-startStop-1] o.s.web.context.ContextLoader            : Root WebApplicationContext: initialization completed in 3871 ms
  2016-02-10 09:57:36.401  INFO 8868 --- [ost-startStop-1] o.s.b.c.e.ServletRegistrationBean        : Mapping servlet: 'CXFServlet' to [/APPservice/*]
  2016-02-10 09:57:36.408  INFO 8868 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'metricFilter' to: [/*]
  2016-02-10 09:57:36.409  INFO 8868 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'characterEncodingFilter' to: [/*]
  2016-02-10 09:57:36.409  INFO 8868 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'hiddenHttpMethodFilter' to: [/*]
  2016-02-10 09:57:36.409  INFO 8868 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'httpPutFormContentFilter' to: [/*]
  2016-02-10 09:57:36.410  INFO 8868 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'requestContextFilter' to: [/*]
  2016-02-10 09:57:36.410  INFO 8868 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'webRequestLoggingFilter' to: [/*]
  2016-02-10 09:57:36.410  INFO 8868 --- [ost-startStop-1] o.s.b.c.embedded.FilterRegistrationBean  : Mapping filter: 'applicationContextIdFilter' to: [/*]
  2016-02-10 09:57:37.028  INFO 8868 --- [           main] o.a.c.w.s.f.ReflectionServiceFactoryBean : Creating Service {http://new.webservice.namespace}CompServiceForPCO from WSDL: classpath:CompService.wsdl
  2016-02-10 09:57:39.665  WARN 8868 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'ws' defined in com.comp.config.Application: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.xml.ws.Endpoint]: Factory method 'ws' threw exception; nested exception is javax.xml.ws.WebServiceException: java.lang.NullPointerException
  2016-02-10 09:57:39.676  INFO 8868 --- [           main] o.apache.catalina.core.StandardService   : Stopping service Tomcat
  2016-02-10 09:57:39.891 ERROR 8868 --- [           main] o.s.boot.SpringApplication               : Application startup failed
  </code></pre>
  
  <p>ws method is in Application.class which look like:</p>
  
  <pre><code>package com.comp.config;
  
  import org.apache.cxf.Bus;
  import org.apache.cxf.bus.spring.SpringBus;
  import org.apache.cxf.interceptor.LoggingInInterceptor;
  import org.apache.cxf.interceptor.LoggingOutInterceptor;
  import org.apache.cxf.jaxws.EndpointImpl;
  import org.apache.cxf.transport.servlet.CXFServlet;
  import org.springframework.beans.factory.annotation.Autowired;
  import org.springframework.boot.SpringApplication;
  
  import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
  import org.springframework.boot.autoconfigure.SpringBootApplication;
  import org.springframework.boot.builder.SpringApplicationBuilder;
  import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
  import org.springframework.boot.context.embedded.ServletRegistrationBean;
  import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
  import org.springframework.boot.context.web.SpringBootServletInitializer;
  import org.springframework.context.ApplicationContext;
  import org.springframework.context.annotation.Bean;
  import org.springframework.context.annotation.Configuration;
  import org.springframework.web.servlet.config.annotation.ResourceHandlerRegistry;
  import com.comp.pcoserv.CompServiceEndPoindImpl;
  
  import javax.xml.ws.Endpoint;
  
  
  @Configuration
  @EnableAutoConfiguration
  public class Application  {
  
      public static final String SERVLET_MAPPING_URL_PATH = "/APPservice";
      public static final String SERVICE_NAME_URL_PATH = "/ws";
  
      @Autowired
      private ApplicationContext applicationContext;
  
      public static void main(String[] args) {
          SpringApplication.run(Application.class, args);
      }
  
      @Bean
      public ServletRegistrationBean dispatcherServlet() {
          return new ServletRegistrationBean(new CXFServlet(), SERVLET_MAPPING_URL_PATH + "/*");
      }
  
  
      @Bean(name = Bus.DEFAULT_BUS_ID)
      /* &lt;bean id="cxf" class="org.apache.cxf.bus.spring.SpringBus"&gt;*/
      public SpringBus springBus() {
          return new SpringBus();
      }
  
      @Bean
      /* &lt;jaxws:endpoint id="app" implementor="com.dlizarra.app.ws.AppImpl" address="/app"&gt;*/
      public Endpoint ws() {
          //Bus bus = (Bus) applicationContext.getBean(Bus.DEFAULT_BUS_ID);
  
  
          Object implementor = new CompServiceEndPoindImpl();
          EndpointImpl endpoint = new EndpointImpl(springBus(), implementor);
          endpoint.publish(SERVICE_NAME_URL_PATH);
          endpoint.setWsdlLocation("CompService.wsdl");
          /*endpoint.getServer().getEndpoint().getInInterceptors().add(new LoggingInInterceptor());
          endpoint.getServer().getEndpoint().getOutInterceptors().add(new LoggingOutInterceptor());*/
          return endpoint;
      }
  
  }
  </code></pre>
  
  <p>I searched through the entire Internet to find the solution but without any success. Could you help me to fix this exception?  </p>
  
  <p>The full stack trace is here: <a href="http://pastebin.com/Eg8QPtpF" rel="nofollow">full stack trace</a></p>