Giter Site home page Giter Site logo

Comments (24)

fehguy avatar fehguy commented on May 2, 2024

howdy, I followed these steps and was able to run the sample just fine--I'm putting in tests today to make sure it stays healthy. Can you please confirm you've followed these steps and still see that error?

  • publish modules/swagger-play2-utils locally via "play publish-local" in that folder
  • publish modules/swagger-play2 locally via "play publish-local"
  • run the sample app with "play clean" then "play run"

You should be able to hit http://localhost:9000/resources.json and get this:

{
  "apiVersion":"0.1",
  "swaggerVersion":"1.0",
  "basePath":"http://localhost:9000",
  "apis":[
    {
      "path":"/user.{format}",
      "description":"Operations about user"
    },
    {
      "path":"/pet.{format}",
      "description":"Operations about pets"
    },
    {
      "path":"/store.{format}",
      "description":"Operations about store"
    }
  ]
}

and http://localhost:9000/pet.json

should produce something like this:


{
  "apiVersion":"0.1",
  "swaggerVersion":"1.0",
  "basePath":"http://localhost:9000",
  "resourcePath":"/pet",
  "apis":[
    {
      "path":"/pet",
      "description":"Operations about pets",
      "operations":[
        {
          "httpMethod":"POST",
          "summary":"Add a new pet to the store",
          "responseClass":"ok",
          "nickname":"addPet",
          "parameters":[

...

from swagger-core.

brainwatch avatar brainwatch commented on May 2, 2024

I tried a clean setup - new play 2.0.1, swagger-core-91670c5.

Followed you steps.

  • publish modules/swagger-play2-utils locally via "play publish-local" in that folder
  • publish modules/swagger-play2 locally via "play publish-local"
  • run the sample app with "play clean" then "play run"

Since swagger-play2-utils have swagger-play2 dependency, there was an error. so changed the order.

  • publish modules/swagger-play2 locally via "play publish-local"
  • publish modules/swagger-play2-utils locally via "play publish-local" in that folder
  • run the sample app with "play clean" then "play run"

Setup and publishing was smooth.

The response for resources.json and pet.json reflects the same as referenced in your message.

But, the error still persists.

[info] play - Listening for HTTP on port 9000...

(Server started, use Ctrl+D to stop and go back to the console...)

[info] Compiling 2 Scala sources and 18 Java sources to D:\eWorkspace\appify\mod
ules\wordnik-swagger-core-91670c5\samples\java-play2\target\scala-2.9.1\classes.
..
[warn] Note: D:\eWorkspace\appify\modules\wordnik-swagger-core-91670c5\samples\j
ava-play2\app\controllers\UserApiController.java uses unchecked or unsafe operat
ions.
[warn] Note: Recompile with -Xlint:unchecked for details.
[debug] application - SwaggerPlugin.onStart
[info] play - Application started (Dev)
[error] application - Unable to resolve apiFilter class security.AuthorizationFi
lter
[debug] application - Found Resource /user @ controllers.UserApiController
[debug] application - Found Resource /pet @ controllers.PetApiController
[debug] application - Found Resource /store @ controllers.StoreApiController
[debug] application - Loading resource /pet from class controllers.PetApiControl
ler @ /pet
[error] c.w.s.p.HelpApi - Unable to resolve apiFilter class security.Authorizati
onFilter
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.PetApiController.addPe
t()
[debug] application - /pet
[error] application - Could not find route controllers.PetApiController.addPet
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.PetApiController.updat
ePet()
[debug] application - /pet
[error] application - Could not find route controllers.PetApiController.updatePe
t
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.PetApiController.getPe
t(java.lang.String)
[debug] application - /pet
[error] application - Could not find route controllers.PetApiController.getPet
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.PetApiController.findP
etsByTags(java.lang.String)
[debug] application - /pet
[error] application - Could not find route controllers.PetApiController.findPets
ByTags
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.PetApiController.findP
etsByStatus(java.lang.String)
[debug] application - /pet
[error] application - Could not find route controllers.PetApiController.findPets
ByStatus
[error] c.w.s.c.u.TypeUtil$ - Unable to load class com.wordnik.swagger.sample.mo
del.Pet
[error] c.w.s.p.HelpApi - Unable to resolve class com.wordnik.swagger.sample.mod
el.Pet

from swagger-core.

brainwatch avatar brainwatch commented on May 2, 2024

Hi

Any update on this issue. I'm still having this error, which i do not see in the scala version sample. Kindly update.

EDIT : More information on my Environment : Windows 7 and Jdk 1.7.0_03 / And also on Linux with jdk 1.7

from swagger-core.

fehguy avatar fehguy commented on May 2, 2024

Hi, all testing has been done on JDK 1.6. Is there a chance you can try that version so we can hunt down the issue?

I also just updated the Build.scala to point to a github-hosted ivy repo so you don't need to build the swagger-play2 project or the swagger-play2-utils. Could you please pull and try again?

from swagger-core.

brainwatch avatar brainwatch commented on May 2, 2024

Hi

I tried all scenario

  • with jdk 1.7 and latest java-play2
  • with jdk 1.6 and latest java-play2

but still the error persists. One thing I notice is that the error persists, but its not following the same sequence. I'm attaching the the trace again fyr. And once the first time url is called, it hangs and no more calls are services by the server.

I would appreciate your help in resolving this.

EDIT : Tried scala version and its just smooth and also reflected in the ui perfectly.

Trace log :

D:\eWorkspace\appify\modules\wordnik-swagger-core-63ccf9d\samples\java-play2>pla
y run
[info] Loading project definition from D:\eWorkspace\appify\modules\wordnik-swag
ger-core-63ccf9d\samples\java-play2\project
[info] Set current project to petstore (in build file:/D:/eWorkspace/appify/modu
les/wordnik-swagger-core-63ccf9d/samples/java-play2/)

[info] Updating {file:/D:/eWorkspace/appify/modules/wordnik-swagger-core-63ccf9d
/samples/java-play2/}petstore...
[info] Resolving org.hibernate.javax.persistence#hibernate-jpa-2.0-api;1.0.1.Fin

[info] Done updating.
--- (Running the application from SBT, auto-reloading is enabled) ---

SLF4J: Class path contains multiple SLF4J bindings.
SLF4J: Found binding in [jar:file:/D:/eWorkspace/appify/platform/play-2.0.1/fram
ework/../repository/local/ch.qos.logback/logback-classic/1.0.0/jars/logback-clas
sic.jar!/org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: Found binding in [jar:file:/D:/eWorkspace/appify/platform/play-2.0.1/fram
ework/../repository/cache/org.slf4j/slf4j-log4j12/jars/slf4j-log4j12-1.6.3.jar!/
org/slf4j/impl/StaticLoggerBinder.class]
SLF4J: See http://www.slf4j.org/codes.html#multiple_bindings for an explanation.

[info] play - Listening for HTTP on port 9000...

(Server started, use Ctrl+D to stop and go back to the console...)

[info] Compiling 2 Scala sources and 18 Java sources to D:\eWorkspace\appify\mod
ules\wordnik-swagger-core-63ccf9d\samples\java-play2\target\scala-2.9.1\classes.
..
[warn] Note: D:\eWorkspace\appify\modules\wordnik-swagger-core-63ccf9d\samples\j
ava-play2\app\controllers\UserApiController.java uses unchecked or unsafe operat
ions.
[warn] Note: Recompile with -Xlint:unchecked for details.
[debug] application - SwaggerPlugin.onStart
[info] play - Application started (Dev)
[debug] application - Found Resource /user @ controllers.UserApiController
[debug] application - Found Resource /pet @ controllers.PetApiController
[debug] application - Found Resource /store @ controllers.StoreApiController
[debug] application - Loading resource /user from class controllers.UserApiContr
oller @ /user
[debug] application - Loading resource /pet from class controllers.PetApiControl
ler @ /pet
[debug] application - Loading resource /store from class controllers.StoreApiCon
troller @ /store
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.PetApiController.updat
ePet()
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.UserApiController.crea
teUser()
[error] application - Cannot determine Path. Nothing defined in play routes file
for api method public static play.mvc.Result controllers.StoreApiController.pla
ceOrder()
[debug] application - /store
[debug] application - /pet
[debug] application - /user
[error] application - Could not find route controllers.PetApiController.updatePe
t
[error] application - Could not find route controllers.StoreApiController.placeO
rder
[error] application - Could not find route controllers.UserApiController.createU
ser

from swagger-core.

fehguy avatar fehguy commented on May 2, 2024

well good news and bad news. I fired up a fresh VM with windows XP (yes, I know that's old) but with play 2.0.1, jdk 1.6.0_27 and a fresh clone of swagger-core. I had to make 2 changes for windows to work with the Build.scala (I'm committing those) but both the swagger-play2 sample and java-play2 sample run just fine. I think I'll need to chat with you on IRC #swagger to figure out why it's failing for you. It's really weird.

What time zone are you in? If you can ping me at tonytam on irc then I'd be happy to help sort this out.

from swagger-core.

brainwatch avatar brainwatch commented on May 2, 2024

Hi

Good and a Bad news from my side too. I tried you patch on jdk 1.6. The error still exists but the system works fine ( except the swagger UI ) and I was able to fire queries on each service uri multiple times. The system did not hang on the first call like before. But on jdk 1.7, the error exists and the system hung on first call to the uri itself.

I'm on GMT + 5:30 ( India ) timezone. Let me know your availability on IRC and I'll ping you.

Thank you for your time.

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

I also got the same errors. I am not sure what I do wrong. All swagger jsons return normally.

[error] application - Cannot determine Path. Nothing defined in play routes file for api method public static play.mvc.Result controllers.Register.registerByForm()
[debug] application - /register
[error] application - Could not find route controllers.Register.registerByForm

@Api(value = "/register", description = "Operations about register")
public class Register extends Controller {
@post
@ApiOperation(value = "Add a new member to the store")
@ApiErrors(value = { @ApiError(code = 405, reason = "Invalid input") })
@ApiParamsImplicit({
@ApiParamImplicit(
name = "deviceId", value = "device GUID",
required = false, dataType = "String", paramType = "body")})
@BodyParser.Of(BodyParser.Json.class)
public static Result registerByForm() {
}
}

POST /register controllers.Register.registerByForm()
GET /resources.json controllers.ApiHelpController.getResources()
GET /register.json controllers.ApiHelpController.getResource(path = "/register")
POST /register.json controllers.Register.registerByForm()

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

I just tried the java-play2 sample project. Yes, I got same error too.

[debug] application - /user
[error] application - Could not find route controllers.UserApiController.updateUser
[error] application - Cannot determine Path. Nothing defined in play routes file for api method public static play.mvc.Result controllers.UserApiController.createUsersWithListInput()

from swagger-core.

fehguy avatar fehguy commented on May 2, 2024

Hi, I think that error message is a red herring. We'll get the message sorted out and report back exactly why it's there.

from swagger-core.

brainwatch avatar brainwatch commented on May 2, 2024

Hi

Also the service call to particular action ( example : /pet.json/1 ... 10 ) is returning a json with all null data. I think either the data is not loading due to the error which we are talking about or the service query is not able to fetch the data.

from swagger-core.

fehguy avatar fehguy commented on May 2, 2024

I've confirmed the issue, only happens in the java play2 sample. Looking into it...

from swagger-core.

fehguy avatar fehguy commented on May 2, 2024

There was test code in the java app that should have been removed :( It's gone now, and the sample is returning the correct data now.

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

Thanks. Btw, could you paste the solution or link here?

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

I tried java-play2. Here are the errors when browse http://localhost:9000/user.json.

[error] application - Cannot determine Path. Nothing defined in play routes file for api method public static play.mvc.Result controllers.UserApiController.createUser()
[debug] application - /user
[error] application - Could not find route controllers.UserApiController.createUser
[error] application - Cannot determine Path. Nothing defined in play routes file for api method public static play.mvc.Result controllers.UserApiController.createUsersWithArrayInput()

from swagger-core.

ayush avatar ayush commented on May 2, 2024

@brainwatch @angelokh @fehguy there was a bug in the play2 plugin which was causing this to happen only for java. This has been fixed now.

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

Still have errors in java-play2.

[error] application - Cannot determine Path. Nothing defined in play routes file for api method public static play.mvc.Result controllers.UserApiController.updateUser(java.lang.String)
[error] application - Cannot determine Path. Nothing defined in play routes file for api method public static play.mvc.Result controllers.PetApiController.addPet()
[error] application - Cannot determine Path. Nothing defined in play routes file for api method public static play.mvc.Result controllers.StoreApiController.placeOrder()
[debug] application - /user
[debug] application - /pet
[debug] application - /store
[error] application - Could not find route controllers.PetApiController.addPet
[error] application - Could not find route controllers.StoreApiController.placeOrder
[error] application - Could not find route controllers.UserApiController.updateUser

from swagger-core.

ayush avatar ayush commented on May 2, 2024

Did you

  1. Get the latest swagger-play2 module
  2. Publish it locally (play publish-local)
  3. Rebuild the app (play clean, play start)

?

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

I follow your steps, still get same errors.

Then I remove /usr/local/share/play-2.0.1/framework/../repository/local/com.wordnik/swagger-play2_2.9.1/1.1-SNAPSHOT/ and do a local-publish again. And clean and run java-play2. The errors are still there.

Another problem I found in java-play2 and swagger-play2. Both were looking for commons-io jar. So I have to add "commons-io" % "commons-io" % "2.3" to Build.scala to be able to build them.

[warn] [NOT FOUND ] commons-io#commons-io;2.0.1!commons-io.jar (0ms)
[warn] ==== local: tried
[warn] /usr/local/share/play-2.0.1/framework/../repository/local/commons-io/commons-io/2.0.1/jars/commons-io.jar
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: FAILED DOWNLOADS ::
[warn] :: ^ see resolution messages for details ^ ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: commons-io#commons-io;2.0.1!commons-io.jar

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

This is my current local repo status.

$ git pull
Already up-to-date.

$ git log --oneline
9f7acc6 fixed the path param name for getPet
d615dfb Bugfix to support discovery of java controllers in PlayApiReader

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

I guess this is the problem. The current sample https://github.com/wordnik/swagger-core/tree/master/samples/java-play2 is using jars from github repo.

from swagger-core.

fehguy avatar fehguy commented on May 2, 2024

@angelokh you can either publish locally or use the pre-compiled versions in the github repo. If you build locally, I'd recommend wiping your ivy cache, at least the com.wordnik artifacts.

from swagger-core.

brainwatch avatar brainwatch commented on May 2, 2024

It works fine.

from swagger-core.

angeloh avatar angeloh commented on May 2, 2024

Okay. If I browse http://localhost:9000/resources.json, it works fine. However, when I use it w/ swagger-ui, bunch of errors pop up. I will open another ticket.

from swagger-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.