Quarkus project once covered to mutli-module form got 404 when hit the existing endpoints

感情迁移 提交于 2019-12-24 19:29:19

问题


quarkus.version:1.0.1.Final

Used to have working quarkus web project with rest-easy end-points.

Converted it to multi-module one.

Still use maven.

This way:

 my-project-service
   - my-project-api
     - data-api-object.java
     - pom.xml // dep on `quarkus-core` as `provided`
   - my-project-backend
     - pom.xml  + depends on my-project-api
   - pom.xml // managed dependencies defined

Similar to this example, actually.

All compiles and runs.

./mvnw compile quarkus:dev

I see log:

- [io.quarkus] (main) Quarkus 1.0.1.Final started in 1.595s. Listening on: http://0.0.0.0:8080
- [io.quarkus] (main) Installed features: [agroal, cdi, infinispan-client, jaeger, narayana-jta, reactive-pg-client, rest-client, resteasy, resteasy-jackson, smallrye-context-propagation, smallrye-fault-tolerance, smallrye-health, smallrye-metrics, smallrye-openapi, smallrye-opentracing, swagger-ui, vertx]

But when I hit once worked end-point:

http://localhost:8080/my-project-service/stuff

I got: 404

If I check my health-check url: http://localhost:8080/my-project-service/health/ready

In my-project-backend / ... / resources/application.properties

quarkus.application.name=my-project-service
quarkus.http.root-path=/my-project-service

so I actually have to call http://localhost:8080/my-project-service/. This has has not been changed.

I guess, the call never reached the app.

Q: What could be the problem?

UPDATE:

I got that null-pointer ex when run.

FYI: may /src/main/etc folders is empty - no sources in parent pom project ( pom).

Listening for transport dt_socket at address: 5005
Exception in thread "main" java.lang.RuntimeException: java.lang.NullPointerException
        at io.quarkus.dev.DevModeMain.main(DevModeMain.java:70)
Caused by: java.lang.NullPointerException
        at sun.nio.fs.UnixPath.normalizeAndCheck(UnixPath.java:77)

I did clean /target folder etc... did not help.

I can reach the http://localhost:8080/swagger-ui/ - it works but empty. once worked http://localhost:8080/my-project-service/swagger-ui/ get 404 as well.

(maybe related to this fix)

I tried to move resources/application.properties (not sure where it should be) to my root project. no effect.

P.S. I converted all (also) to Gralde. Same issue.

UPDATE 2:

  • switched to latest (now 1.1.0.CR1) version
  • now I see some new exceptions: -Failed to start Quarkus: java.lang.IllegalArgumentException: Multiple matching properties for name "datasource.url" even though I have one per env, only one for dev: %dev.quarkus.datasource.url

    I guess it is just a new bug. Rolling back where I was.

UPDATE3: If I compile native, application works/reacts on rest requests. Seems it is only about dev (and probably hot reload thing).


回答1:


So far, (based on git thread) to make it work:

  1. from the parent folder:

./mvnw clean install -DskipTests

, so it would resolve/register all deps/artifacts

  1. Then compile/run it from the child one, the one that is responsible for running the app, the back-end.

cd my-project-backend

mvn compile quarkus:dev

Only my-project-backend should contain the <build>..<plugin> <artifactId>quarkus-maven-plugin</artifactId> not the parent one.


About the version: to use the 1.1.0.CR1+ one, make sure we do not have have both of those deps: quarkus-agroal and the quarkus-reactive-pg-client dependencies.

Both of them define the quarkus.datasource.url that's why.. I leave only the quarkus-reactive-pg-client one.


Not sure if it should be this way. Or run from the parent, ultimately. TBD.

And native seems does not work. TBD.




回答2:


while trying it I hit this issue: https://github.com/quarkusio/quarkus/issues/6275

Did you hit this issue as well with the latest Quarkus version?



来源:https://stackoverflow.com/questions/59328770/quarkus-project-once-covered-to-mutli-module-form-got-404-when-hit-the-existing

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!