com.abc.def.content.service.ContentService).
Hi,--
I've created a very simple REST service using Java and Tomcat, and it is working fine. But when I load up Swagger-UI, and pass in "http://localhost:8080/Content-Server/service/content/hello", I get an error: Uncaught TypeError: Cannot read property 'definitions' of null. CORS isn't the issue I believe as I've fixed that.
Here are some of my files (the important parts of them):Content.java
@Path("/content")
@Api(value="/content", description="Manage content")
public class Content {
private final static Logger LOGGER = Logger.getLogger(Content.class.getName());
@GET
@Path("/hello")
@Produces(MediaType.APPLICATION_JSON)
@ApiOperation(value="default", httpMethod="GET")
public JSONObject hello() {
JSONObject json = new JSONObject();
try {
json.put("hello", "world");
} catch (JSONException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return json;
}
}web.xml
<web-app>
<display-name>Content Stuff</display-name>
<servlet>
<servlet-name>rest</servlet-name>
<servlet-class>org.apache.wink.server.internal.servlet.RestServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.abc.def.content.service.ContentService</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>DefaultJaxrsConfig</servlet-name>
<servlet-class>com.wordnik.swagger.jaxrs.config.DefaultJaxrsConfig</servlet-class>
<init-param>
<param-name>api.version</param-name>
<param-value>1.0.0</param-value>
</init-param>
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>/service</param-value>
</init-param>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>rest</servlet-name>
<url-pattern>/service/*</url-pattern>
</servlet-mapping>
</web-app>pom.xml
<dependencies>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs</artifactId>
<version>1.5.3-M1</version>
</dependency>
</dependencies>
I'm very new at Swagger (and Java REST services) but I'd appreciate any help. Thanks!
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
public class ContentService extends Application {
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
classes.add(Content.class);
return classes;
}
}
http://localhost:8080/Content-Server/service/content/hello -> Uncaught TypeError: Cannot read property 'definitions' of null
http://localhost:8080/Content-Server/service/content -> 405 error
http://localhost:8080/Content-Server/service -> Uncaught failed to parse JSON/YAML response
http://localhost:8080/Content-Server/service/swagger.json -> Uncaught Can't read swagger JSON from...
--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Application
subclass section.--
You received this message because you are subscribed to the Google Groups "Swagger" group.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsub...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.