<servlet>
<servlet-name>MobileStoreServlet</servlet-name>
<servlet-class>
org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
</servlet-class>
<init-param>
<param-name>jaxrs.serviceClasses</param-name>
<param-value>com.company.integration.mobile.rest.MobileStoreService,com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON</param-value>
</init-param>
<init-param>
<param-name>jaxrs.providers</param-name>
<param-value>com.wordnik.swagger.jaxrs.json.JacksonJsonProvider,com.wordnik.swagger.jaxrs.listing.ResourceListingProvider,com.wordnik.swagger.jaxrs.listing.ApiDeclarationProvider</param-value>
</init-param>
<init-param>
<param-name>swagger.api.version</param-name>
<param-value>1.0</param-value>
</init-param>
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>http://localhost:8080/MobileStoreService/rest/api-docs</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MobileStoreServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
@Produces({ "application/json" })
@Api (value = "/", description = "Manage people")
public class MobileStoreService {
/**
* Return a Product based on the provided Product ID.
* @param id
* @return a Product product Object.
*/
@GET
@Path("/product/{id}/")
@ApiOperation(value = "Get a single product", notes = "Get a single product", response = Product.class)
public Product getProduct(@PathParam("id") final String id) {
// logic to retrieve Product
return product;
}
{"apiVersion":"0.0","swaggerVersion":"1.2"}
--
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.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
WARNING [Reflections] could not create Vfs.Dir from url. ignoring the exception and continuing
org.reflections.ReflectionsException: could not create Vfs.Dir from url, no matching UrlType was found [vfszip:/opt/jboss-eap-5.1.2/jboss-as/server/sim-uat-api/deploy/simons-service-api-1.0.2014-11-26-502eabd5c8f0745b7c53c2163ab70f80c3f06da8.ear/atglib/_Simstore.ServiceAPI_sclasses_s/]
either use fromURL(final URL url, final List<UrlType> urlTypes) or use the static setDefaultURLTypes(final List<UrlType> urlTypes) or addDefaultURLTypes(UrlType urlType) with your specialized UrlType.
at org.reflections.vfs.Vfs.fromURL(Vfs.java:109)
at org.reflections.vfs.Vfs.fromURL(Vfs.java:91)
at org.reflections.Reflections.scan(Reflections.java:231)
at org.reflections.Reflections.scan(Reflections.java:204)
at org.reflections.Reflections.<init>(Reflections.java:129)
at com.wordnik.swagger.jaxrs.config.BeanConfig.classesFromContext(BeanConfig.scala:60)
at com.wordnik.swagger.jaxrs.listing.ApiListingCache$$anonfun$listing$1$$anonfun$apply$1$$anonfun$apply$2.apply(ApiListing.scala:42)
at com.wordnik.swagger.jaxrs.listing.ApiListingCache$$anonfun$listing$1$$anonfun$apply$1$$anonfun$apply$2.apply(ApiListing.scala:40)
at scala.Option.map(Option.scala:145)To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggersocket+unsubscri...@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-swaggers...@googlegroups.com.
/**
* Constructor.
*/
public MobileStoreService() {
int port = atgConf.getSiteHttpServerPort();
String basePath = String.format("http://%s:%d/MobileStoreService/rest", hostName, port);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0");
beanConfig.setScan(true);
beanConfig.setResourcePackage(MobileStoreService.class.getPackage().getName());
beanConfig.setBasePath(basePath);
}
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
</dependency>
--
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.
Are you referring to core version. Then it is swagger-core_2.10-1.3.1.jar.
--
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.
I have bumped up the version to 1.3.12 but issue still persists.
--
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.
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.10</artifactId>
<version>1.3.12</version>
@Override
public void init(ServletConfig config) throws ServletException {
super.init(config);
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("1.0");
beanConfig.setBasePath("http://localhost:8080/my_services/api");
// beanConfig.setResourcePackage("io.swagger.resources");
beanConfig.setResourcePackage(MyResource.class.getPackage().getName());
beanConfig.setScan(true);
}
Can you check which version of reflections.org ends up on your application? You can check using mvn dependency:list
Which application server do you use? Does it have shared libraries that include reflections.org? Do you have other applications on the same app server that may contain that dependency?
--
That can actually be the issue. JBoss 5 may carry it in its shared libraries. I need to check but will only be able to do that tomorrow.
I am using reflections-0.9.9.jar. I have verified my deployment directory and this is the only version that I have. I am using Jboss 5.2.
--
JBOSS/server/<configuration>/lib and JBOSS/lib. Let me know what you find out.I will when I get a chance. Unfortunately I'm between flights so it's difficult at the moment. There could be a thick jar too. I'll see if I can check before my next flight.
If I recall correctly, the version supplies with JBoss has a different name but uses the same class signatures.
I have verifiedJBOSS/server/<configuration>/libandJBOSS/lib. Let me know what you find out.
--
Did you get a chance to find out the jar that might be causing the issue?
--
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.
--
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.
Okay, my bad. It's may not be directly related to reflections.org but rather the javassist library which should be in the shared lib directory.Do you have the option to try the application (at least the Swagger generation) on a different server such as Jetty or Tomcat?
On Tue, Feb 3, 2015 at 5:30 PM, Ashwin <ashwin.da...@gmail.com> wrote:
Any luck?
--
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-swaggersocket+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to swagger-swaggers...@googlegroups.com.
We are using resteasy (jboss 5.1). All the classes are set by overriding the getClassesMethod in the class which extends Application.
We are using resteasy (jboss 5.1). All the classes are set by overriding the getClassesMethod in the class which extends Application.For swagger we added the beanconfig in the constructor of the class that extends Application and sets the package name in ResourcePackage
--
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 App extends javax.ws.rs.core.Application{public App() {super();
BeanConfig beanConfig = new BeanConfig();
beanConfig.setVersion("0.0.1");beanConfig.setBasePath("url");beanConfig.setResourcePackage("com.package");beanConfig.setScan(true);}@Overridepublic Set<Class<? >> getClasses(){Set<Class<? >> classSet = new HashSet<Class<? >>();classSet.add(com.package.class);...
import java.util.HashSet;
import java.util.Set;
import javax.servlet.ServletConfig;
import javax.ws.rs.core.Application;
import scala.collection.JavaConverters$;
import scala.collection.TraversableOnce;
import scala.collection.immutable.List;
import com.wordnik.swagger.jaxrs.config.BeanConfig;
public class CustomBeanConfig extends BeanConfig {
@Override
public List classesFromContext(Application app, ServletConfig sc) {
Set set = new HashSet();
System.out.println("CALLING CustomBeanConfig.classesFromContext()");
try {
// you can read the package name form some configuration or pass it as an constructor parameter to your new CustomBeanConfig
set.add(Class.forName("com.package.classWithSwaggerAnnotation"));
} catch (ClassNotFoundException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
return ((TraversableOnce) JavaConverters$.MODULE$.asScalaSetConverter(set).asScala()).toList();
}
}
--
You received this message because you are subscribed to a topic in the Google Groups "Swagger" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/swagger-swaggersocket/Xbo4XtLrThw/unsubscribe.
To unsubscribe from this group and all its topics, send an email to swagger-swaggers...@googlegroups.com.
Hi,
I m trying to setup swagger to work with my implementation using annotations.
I using CXF ( non-spring version) and jackson as a provider and ant as a build tool.
I tried to follow the tutorial in this URL with trying to modify it to use the non-spring version.
https://github.com/swagger-api/swagger-core/tree/master/samples/java-jaxrs-cxf
My Service is accessible from
http://localhost:8080/MobileStoreService/rest/product/12345
Here is my web.xml
<servlet>
<servlet-name>MobileStoreServlet</servlet-name>
<servlet-class>
org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet
</servlet-class>
<init-param>
<param-name>jaxrs.serviceClasses</param-name>
<param-value>com.company.integration.mobile.rest.MobileStoreService,com.wordnik.swagger.jaxrs.listing.ApiListingResourceJSON</param-value>
</init-param>
<init-param>
<param-name>jaxrs.providers</param-name>
<param-value>com.wordnik.swagger.jaxrs.json.JacksonJsonProvider,com.wordnik.swagger.jaxrs.listing.ResourceListingProvider,com.wordnik.swagger.jaxrs.listing.ApiDeclarationProvider</param-value>
</init-param>
<init-param>
<param-name>swagger.api.version</param-name>
<param-value>1.0</param-value>
</init-param>
<init-param>
<param-name>swagger.api.basepath</param-name>
<param-value>http://localhost:8080/MobileStoreService/rest/api-docs</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>MobileStoreServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
Here is my CXF Service class@Produces({ "application/json" })
@Api (value = "/", description = "Manage people")
public class MobileStoreService {
/**
* Return a Product based on the provided Product ID.
* @param id
* @return a Product product Object.
*/
@GET
@Path("/product/{id}/")
@ApiOperation(value = "Get a single product", notes = "Get a single product", response = Product.class)
public Product getProduct(@PathParam("id") final String id) {
// logic to retrieve Product
return product;
}
Here is all the dependencies that I have
When I run the application and hit
http://localhost:8080/MobileStoreService/rest/api-docs
I get the following response:{"apiVersion":"0.0","swaggerVersion":"1.2"}
Can you please advise on why swagger is not detecting the annotation and generating the documentation for the GetProduct Service.
To unsubscribe from this group and all its topics, send an email to swagger-swaggersocket+unsub...@googlegroups.com.