hi guys i am breaking my head with this problem,hope i could get some help here.

**My Problem:-** i am using angular js for frontend and connecting it to backend using rest api. in my some partials inside angular js or we can say some html pages i am able to do GET successfully but for only **one html page or partial the GET is saying internal server error 500**.i tried to debug in my **browser** and its **showing against the angular.js.**  

--**GET localhost:8080/mytracker/getDeviceList.do 500 (Internal Server Error)**--

**Confusion:-** My confusion is that is it problem in angular js code or my backend code which is rest api code which i have written in spring.is the issue because **i am getting data in text/html format** .for **others html page i able to get in application/json**.what could be the problem in my backend.

**posting my backend code:-**

DeviceController.java ->

```
@Controller
public class DeviceController {

@Autowired DeviceDAO deviceDAO;

@RequestMapping(value="/getDeviceList",method=RequestMethod.GET, produces=MediaType.APPLICATION_JSON_VALUE)
public @ResponseBody List<DeviceForm> getdevice()
{
    List<DeviceForm> deviceForms=new ArrayList<DeviceForm>();
    List<Device> devices= deviceDAO.getAllDevices();
    for(Device device:devices)
    {
        DeviceForm deviceForm= new DeviceForm();
        deviceForm.setDeviceNumber(device.getDeviceNo());
        deviceForm.setDeviceId(device.getDeviceId());
        deviceForm.setPurchaseDate(device.getPurchaseData().toString());
        deviceForm.setExpiryDate(device.getExpiryDate().toString());
        deviceForm.setClientId(device.getDeviceClienid());

        deviceForms.add(deviceForm);
    }
    return deviceForms; 
}

```

my autowiring is as follows with it:-

```
public interface DeviceDAO {

public List<Device> getAllDevices();

public void saveDevice(Device device);
}

```

and my **DeviceForm class is**:->

```
private double deviceId;
private String purchaseDate;
private String warrantyPeriod;
private String warEndDate;
private String clientId;
private String warrantedDays;
private String warStartDate;
private String warranty;
private String deviceNumber;
private String expiryDate;
private long vehicleId;
private String deviceStatus;

public double getDeviceId() {
    return deviceId;
}
public void setDeviceId(double deviceId) {
    this.deviceId = deviceId;
}
public long getVehicleId() {
    return vehicleId;
}
public void setVehicleId(long vehicleId) {
    this.vehicleId = vehicleId;
}
public String getExpiryDate() {
    return expiryDate;
}
public void setExpiryDate(String expiryDate) {
    this.expiryDate = expiryDate;
}
public String getDeviceNumber() {
    return deviceNumber;
}
public void setDeviceNumber(String deviceNumber) {
    this.deviceNumber = deviceNumber;
}
public String getWarranty() {
    return warranty;
}
public void setWarranty(String warranty) {
    this.warranty = warranty;
}

public String getPurchaseDate() {
    return purchaseDate;
}
public void setPurchaseDate(String purchaseDate) {
    this.purchaseDate = purchaseDate;
}
public String getWarrantyPeriod() {
    return warrantyPeriod;
}
public void setWarrantyPeriod(String warrantyPeriod) {
    this.warrantyPeriod = warrantyPeriod;
}
public String getWarEndDate() {
    return warEndDate;
}
public void setWarEndDate(String warEndDate) {
    this.warEndDate = warEndDate;
}

public String getWarrantedDays() {
    return warrantedDays;
}
public void setWarrantedDays(String warrantedDays) {
    this.warrantedDays = warrantedDays;
}
public String getWarStartDate() {
    return warStartDate;
}
public void setWarStartDate(String warStartDate) {
    this.warStartDate = warStartDate;
}
public String getClientId() {
    return clientId;
}
public void setClientId(String clientId) {
    this.clientId = clientId;
}

```

}

i am using these rest classes in my angular **fronted** using code written inside a **angular controller as shown below:-**>

```
myApp.controller("DeviceManagementController",['$scope','$http',function($scope,$http){ 
$scope.gridOptions = {
        pagingPageSizes: [25, 50, 75],
        pagingPageSize: 25,
        columnDefs: [
                    { name: 'deviceId' },
                    { name: 'deviceNumber' },
                    { name: 'purchaseDate' },
                    { name: 'expiryDate' }
        ],

 $http.get('http://localhost:8080/mytracker/getDeviceList.do')
  .success(function (data) {
    $scope.gridOptions.data = data;
  });

}]);

```

**My Full stackTrace is:-**

```
Jan 12, 2015 5:11:15 PM org.apache.catalina.core.StandardWrapperValve invoke
SEVERE: Servlet.service() for servlet [mytracker] in context with path [/mytracker] threw       exception [Request processing failed; nested exception is java.lang.NullPointerException] with root    cause
java.lang.NullPointerException
at com.dataisys.mytracker.web.controller.DeviceController.getdevice(DeviceController.java:44)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at     org.springframework.web.method.support.InvocableHandlerMethod.invoke(InvocableHandlerMethod.java:213)
at    org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:126)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:96)
at     org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:617)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:578)
at     org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodA    dapter.java:80)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:923)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:852)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:882)
at org.springframework.web.servlet.FrameworkServlet.doGet(FrameworkServlet.java:778)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:620)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:727)
at         org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:303)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at     org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:220)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:501)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:171)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:950)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:408)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1040)
at    org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:607)
at org.apache.tomcat.util.net.JIoEndpoint$SocketProcessor.run(JIoEndpoint.java:316)
at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Unknown Source)

```

**hoping for suggestions!!!!**