Swagger with Resteasty 3 + Jetty 9.2 + JAX-RS 3 - jetty

I am trying to configure an existing application to use Swagger. This application uses Resteasy 3 and Jetty 9.2 along with JAX-RS 3.
My changes are based on the explanations given on the Swagger wiki.
I have first added swagger 1.5.0 in my build.gradle before adding annotations #Api and #ApiOperation on a resource named SchedulerStateRest.
The next step was to edit my web.xml in order to hook up Swagger-Core in my Application and Initialize Swagger using Swagger's Servlet.
My issue is that when I launch my application, no resource is found when I browse /swagger.json or /swagger.yaml from http://localhost:8080. However, I get no error while starting Jetty and existing services are running and available.
I have enabled Jetty logs but I found no information relevant to me (the class in charge to launch Jetty embedded is JettyStarter).
By looking for similar problems, I found people who say that swagger content should be available at /v1/api-docs, so I tried different URLs but I always get a 404 error.
Recently, I found a gist from ben-manes for configuring swagger with Resteasy 3 + Guice 4. I tried to mimic its configuration and deduce the configuration for web.xml based on Guice-servlet explanations but I end up with the same problem as for the configuration explained above (no resource available are the expected address).
Since there is no error while starting embedded Jetty, I wonder if the issue is not related to a wrong address. Do you know how to list "resources" that are available on a Jetty instance?
I noticed that explanations on Swagger wiki are for Resteasy 2.X. Does it mean that Swagger is not compatible with Resteasy 3.x?
Ideas, suggestions, etc. to debug, solve the issue are welcome ;)

I actually figured it out yesterday. I'm going to post a sample application on git hub sometime this week since I can't find an example anywhere

Related

HTML5 Application (Cloud Foundry) - 404 Not Found nginx

I deployed a React-Application with the Staticfile Buildpack to Cloudfoundry on the SAP Cloud Platform which has different routes (e.g."/login", etc.)
When I access the app with the provided URL (e.g. "www.exampleurl.com") and navigate through my app everything works, the different pages with different routes are working as expected.
My problem now is that, everytime I want to reload a page or if I want to access the application with an additional path attached initally e.g "www.exampleurl.com/todo-route" instead of just "www.exampleurl.com/" I get an 404 Not Found nginx error.
Is this problem related to the application router I need to configure before deploying my application or is it something different.
Unfortunately, I am not getting smarter from reading the documentation and resources on this are very rare in general.
I would appreciate some advice very much. Thank you in advance.
For people having trouble with single-page applications as well:
I found an answer already myself.
Refering to this post:
Deploy single page application Angular: 404 Not Found nginx
You need to add a "Staticfile" file in your dist or build folder with "pushstate: enabled".
You can also refer to the cloudfoundry documentation for the staticfile buildpack: https://docs.cloudfoundry.org/buildpacks/staticfile/index.html
Hope that will help some people on the way.

Error Configuring WSO2 data analytics server

I'm currently experimenting/working on WSO2. What i'm trying to do is to have Data Analytics server configured. I started by following the below specified URL
https://docs.wso2.com/display/AM210/Configuring+APIM+Analytics#9d6747f5c0074928b18599abe472987d (Quick Steps)
After performing all the steps, i get the following issue on APIM cmd prompt
YES Its pretty evident from the error that no such table exists BUT that is exactly the issue i'm facing. What could really be the cause here?
Consider the following points:
I've not followed ALL the steps mentioned on
https://docs.wso2.com/display/DAS310/Getting+Started (BUT are they
required?)
In the installation prerequisites for DAS, JDBC-compliant Connector for Java is required which I've not yet installed (BUT its not mandatory at the same time)
Most of the QUICK STEPS for the configuration of DAS in the specified URL i.e. https://docs.wso2.com/display/AM210/Configuring+APIM+Analytics#9d6747f5c0074928b18599abe472987d where already in place and i only had to
Set Up JDK, ANT, Maven
enable the analytics section in the API-M_HOME/repository/conf/api-manager.xml
add log4j.rootLogger=, DAS_AGENT to API-M_HOME/repository/conf/log4j.properties
add snappy-java_1.1.1.7.jar to DAS_HOME\repository\components\lib
Yet the issue persists, Do let me know of what you think. Thank you
Since you are following quick start guide please extract the WSO2 API Manager and the WSO2 API-M Analytics distributions (zip files), to the same directory (preferably an empty directory).
Also, you need to generate some traffic to the published APIs in order to analytics server to create this table for the first time.

Rest Web Service,

i am approaching the development of Restful web services for the first time. I tried to follow this guide for Netbeans . I am stuck at the testing of the web service.
When i open the
http://localhost:8080/WebServicesTest/test-resbeans.html
page, none of the root resources appears in the left menu. (there should be entities.customer and entities.discountcode)
I really can't find a solution.
Thanks in advance to anyone who likes to give me a hint.
--------------- Edit
If i click on CustomerDB --> Deploy i get an error
In-place deployment at C:\Users\utente\Documents\NetBeansProjects\CustomerDB\build\web
GlassFish Server 4, deploy, null, false
C:\Users\utente\Documents\NetBeansProjects\CustomerDB\nbproject\build-impl.xml:1071:
The module has not been deployed.
See the server log for details.
The line 1071 of build-impl.xml is
<nbdeploy clientUrlPart="${client.urlPart}" debugmode="false" forceRedeploy="${forceRedeploy}"/>
I checked out the referenced tutorial.
Which exact path did you follow? Did you change anything?
Most likely your CustomerDB application is not deployed correctly (see GlassFish Server output in NetBeans) and thus is not able to expose the web service and thus is not displayed in the test page (nothing visible in the side bar).
I tried the tutorial myself and had that phenomenon when using another database ("test" instead of the sample db, which was not connectable in my installed environment), resulting in a message that "test__pm" resource was not found. I then created a conection pool and a jdbc reosurce for test and then it worked.

Cant Find my Axis2 Web Service deployed on OpenShift

I deployed a web service developed using Apache Axis2 on Openshift.
When I try accessing the axis2 index.jsp, I can see the index page which only contains the default Version.
Q:
How do I get to display the web service other web services I created as I can view them on my localhost through the browser in Eclipse?
I have done a few searches online and seen some suggestions as to making adjustments to axis2.xml. In that regard, I have tried changing the contextRoot parameter and the servicePath without no success though I am not too sure if I am making the right changes.
My project structure in Eclipse is shown below:
SieveService
+...
+Java Resources
++src
+++Model
++++some model classes
+++Services
++++SieveServiceService.java
++Libraries
+...
+WebContent
++axis2-web
+++...
I had the same problem and that's occurs because openshift's tomcat server only deploys services in aar format, meanwhile in localhost deploys aar and exploded files too.
You need to create a aar file with your services and put it into your WebContent/WEB-INF/services/ directory. You need to update the services.list file too with the name of your services.
After that you must see your services in your openshift server.

Deploy Rule Service WSO2 Business Rule Server

I was trying to deploy a rule service with WSO2 Business Rule Server
I exactly followed this link
http://docs.wso2.org/wiki/display/BRS200/Creating+and+Deploying+the+Rule+Service#CreatingandDeployingtheRuleService-RuleServiceWizard
I also made the jar file from 3 different class files:
OrderAccept.class OrderReject.class and PlaceOrder.class
I am trying to deploy the server with wizard in the end I got this error
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask. runPeriodic(ScheduledThreadPoolExecutor.java:181)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.
run(ScheduledThreadPoolExecutor.java:205)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExec
utor.java:885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor
.java:907)
at java.lang.Thread.run(Thread.java:619)
Caused by: java.lang.ClassNotFoundException: Class Not found : samples.userguide
.PlaceOrder
at org.apache.axis2.deployment.DeploymentClassLoader.findClass(Deploymen
tClassLoader.java:92)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at org.apache.axis2.deployment.DeploymentClassLoader.loadClass(Deploymen
tClassLoader.java:280)
at java.lang.ClassLoader.loadClass(ClassLoader.java:251)
at org.wso2.carbon.rule.common.config.HelperUtil.processFactDefaultValue
s(HelperUtil.java:43)
Anyone could help me where I might make mistakes?
It seems your jar files are not properly picked. One reason I can think of it, your axis2 archive has wrong folder structure. I am talking about the rule service upload mechanism. You may see there is a folder structure recommended in the documentation. After creating the .aar file, extract it and see whether you have the same folder structure. If it differs from the recommended one, your jar files will not get picked.
I've tried the same example and it's also giving me the same error(both methods, Rule service Upload and Rule Service Wizard). The folder structure that #Amila was suggesting seems to be ok according to the documentation. What I recently found is this link http://wso2.com/library/articles/2013/05/eclipse-plugin-wso2-business-rules-server from which I quote "Previously WSO2 BRS artifacts (aar/car) were created using the web UI rule wizard or creating the artifact by combining several artifacts. With the new WSO2 Developer Studio plug-in for rule services, one can easily create a complete deployable BRS artifact using the Eclipse IDE. Developers can easily create WSO2 BRS artifacts using this tool, and deploy it in the WSO2 Business Rules Server." What I'm guessing is that this new method/tool would substitute the "old" methods(upload and wizard). Give it a try.