0👍
Add a @CrossOrigin(origins = "http://localhost:8081")
annotation (of your URL the request is coming from) to the class, like;
@Path("resource")
@CrossOrigin(origins = "http://localhost:8080")
public class Resource { ... }
For more details, see Enabling Cross Origin Requests for a RESTful Web Service
Source:stackexchange.com