java - The attribute value is undefined for the annotation type Produces for "MediaType.APPLICATION_JSON" -


i getting weird warning (while hovering red line in eclipse) simple restful service code: (eclipse draws red line under "mediatype.application_json")

import java.util.list; import java.util.logging.logger;  import javax.enterprise.inject.produces; import javax.persistence.entitymanager; import javax.persistence.entitymanagerfactory;  import javax.ws.rs.core.mediatype; import javax.ws.rs.get; import javax.ws.rs.path;  import com.mycompany.annotation.restfulserviceaddress; import com.mycompany.myproject.middleware.api.myservice;  @restfulserviceaddress("/mycompany-middleware") public class myserviceimpl implements myservice {  private entitymanagerfactory entitymanagerfactory;  @get @path("/getstuff") @produces(mediatype.application_json) public list<object> getstuff() {     entitymanager entitymanager = entitymanagerfactory             .createentitymanager();     try {         return entitymanager.createquery(                 "select s stuff s", object.class)                 .getresultlist();     } catch (exception ex) {         ex.printstacktrace();         return null;     } {         entitymanager.close();     } }  public entitymanagerfactory getentitymanagerfactory() {     return entitymanagerfactory; }  public void setentitymanagerfactory(         entitymanagerfactory entitymanagerfactory) {     this.entitymanagerfactory = entitymanagerfactory; } } 

also maven builds jar file without problems. error osgi container, telling me jar failed.

use @javax.ws.rs.produces instead of javax.enterprise.inject.produces

import javax.ws.rs.produces;  // import javax.enterprise.inject.produces; 

Comments

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -