title: How to use @Service class from another Web App Project
body: <p>I'm having a problem right now, I have two Dynamic Web App Project (<strong>ProjectA</strong> and <strong>ProjectB</strong>) and I need to reuse methods from Service class from <strong>ProjectA</strong>. Right now I'm developing <strong>ProjectB</strong>, the methods I need to reuse from <strong>ProjectA</strong> are pulling datas from its own database, and I need to have those data.</p>
  
  <p>I've already done doing this following steps</p>
  
  <ol>
  <li>Java Build Path -> Add Project</li>
  <li>Project Reference -> Add Project</li>
  </ol>
  
  <p>and I also tried to add <strong>ProjectA</strong> jar file as Maven dependency and still not working</p>
  
  <p>In <strong>ProjectB</strong>, I can already import and call methods from <strong>ProjectA</strong> but I'm having a nullPointerException.</p>
  
  <p>ProjectA.java
  <code></p>
  
  <pre><code>public interface CustomerService {
      public Customer getCustomerDetails(Long id);
  }
  </code></pre>
  
  <p></code></p>
  
  <p>The above class is the class that I need to reuse, for to me have <strong>ProjectA</strong> data.</p>
  
  <p>ProjectB.java
  <code></p>
  
  <pre><code>public class CustomerController {
     private CustomerService customerService;//service from another project
  
     public ModelAndView getCustomer(Long id){
       Customer = this.customerService.getCustomerDetails(id);
     }
  }
  </code></pre>
  
  <p></code></p>
  
  <p>Now, In <strong>ProjectB</strong> I need to call CustomerService.class and use its own method for me to have its own data. But unluckily I'm having a NullPointerException everytime call CustomerService interface</p>
  
  <p>Please help I can't get the right thing to do.</p>
  
  <p>Thanks in advance</p>