OpenLiberty / guide-microprofile-graphql

A guide on how to use MicroProfile GraphQL to query and update data from multiple services, and how to test GraphQL queries and mutations using an interactive GraphQL tool (GraphiQL).
https://openliberty.io/guides/microprofile-graphql.html
Other
1 stars 0 forks source link

Cannot start graphql service standalone with `mvn liberty:dev` #89

Closed Kenzku closed 4 months ago

Kenzku commented 1 year ago

clone this repo: https://openliberty.io/guides/microprofile-graphql.html

go to finish folder

run mvn -pl models install

go to graphql folder

run mvn liberty:dev

getting errors: type SystemInfo not found in schema

Not sure what does this mean.

[INFO] [ERROR   ] CWMGQ0001E: An error in the Liberty Project web module prevented the MicroProfile GraphQL application from starting.
[INFO] [WARNING ] CWWWC0001W: The [com.ibm.ws.io.smallrye.graphql.component.GraphQLServletContainerInitializer@112f62db] ServletContainerInitializer, located in the following application [Liberty Project], produced the following error while invoking the onStartup method: [jakarta.servlet.ServletException: graphql.AssertException: type SystemInfo not found in schema
[INFO]  at com.ibm.ws.io.smallrye.graphql.component.GraphQLServletContainerInitializer.onStartup(GraphQLServletContainerInitializer.java:198)
[INFO]  at [internal classes]
[INFO] Caused by: graphql.AssertException: type SystemInfo not found in schema
[INFO]  at graphql.Assert.assertNotNull(Assert.java:17)
[INFO]  ... 1 more
[INFO] ]

It works if I run with container:

mvn -pl models install
mvn package
docker build -t system:1.0-java11-SNAPSHOT --build-arg JAVA_VERSION=java11 system/.
docker build -t system:1.0-java17-SNAPSHOT --build-arg JAVA_VERSION=java17 system/.
docker build -t graphql:1.0-SNAPSHOT graphql/.
./scripts/startContainers.sh

full logs

java -version
openjdk version "17.0.6" 2023-01-17
IBM Semeru Runtime Open Edition 17.0.6.0 (build 17.0.6+10)
Eclipse OpenJ9 VM 17.0.6.0 (build openj9-0.36.0, JRE 17 Mac OS X aarch64-64-Bit 20230117_255 (JIT enabled, AOT enabled)
OpenJ9   - e68fb241f
OMR      - f491bbf6f
JCL      - 927b34f84c8 based on jdk-17.0.6+10)

mvn -version
Apache Maven 3.9.3 (21122926829f1ead511c958d89bd2f672198ae9f)
Maven home: /opt/homebrew/Cellar/maven/3.9.3/libexec
Java version: 17.0.6, vendor: IBM Corporation, runtime: /Users/kf/jdk-17.0.6+10/Contents/Home
Default locale: en_US, platform encoding: UTF-8
OS name: "mac os x", version: "13.4.1", arch: "aarch64", family: "mac"
guide-microprofile-graphql % cd finish 
finish % mvn -pl models install
[INFO] Scanning for projects...
[INFO] 
[INFO] ------< io.openliberty.guides:guide-microprofile-graphql-models >-------
[INFO] Building guide-microprofile-graphql-models 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- resources:3.3.1:resources (default-resources) @ guide-microprofile-graphql-models ---
[INFO] skip non existing resourceDirectory /Users/kf/Projects/guide-microprofile-graphql/finish/models/src/main/resources
[INFO] 
[INFO] --- compiler:3.11.0:compile (default-compile) @ guide-microprofile-graphql-models ---
[INFO] Changes detected - recompiling the module! :source
[INFO] Compiling 5 source files with javac [debug target 11] to target/classes
[WARNING] system modules path not set in conjunction with -source 11
[INFO] 
[INFO] --- resources:3.3.1:testResources (default-testResources) @ guide-microprofile-graphql-models ---
[INFO] skip non existing resourceDirectory /Users/kf/Projects/guide-microprofile-graphql/finish/models/src/test/resources
[INFO] 
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ guide-microprofile-graphql-models ---
[INFO] No sources to compile
[INFO] 
[INFO] --- surefire:3.1.2:test (default-test) @ guide-microprofile-graphql-models ---
[INFO] No tests to run.
[INFO] 
[INFO] --- jar:3.3.0:jar (default-jar) @ guide-microprofile-graphql-models ---
[INFO] Building jar: /Users/kf/Projects/guide-microprofile-graphql/finish/models/target/guide-microprofile-graphql-models-1.0-SNAPSHOT.jar
[INFO] 
[INFO] --- install:3.1.1:install (default-install) @ guide-microprofile-graphql-models ---
[INFO] Installing /Users/kf/Projects/guide-microprofile-graphql/finish/models/pom.xml to /Users/kf/.m2/repository/io/openliberty/guides/guide-microprofile-graphql-models/1.0-SNAPSHOT/guide-microprofile-graphql-models-1.0-SNAPSHOT.pom
[INFO] Installing /Users/kf/Projects/guide-microprofile-graphql/finish/models/target/guide-microprofile-graphql-models-1.0-SNAPSHOT.jar to /Users/kf/.m2/repository/io/openliberty/guides/guide-microprofile-graphql-models/1.0-SNAPSHOT/guide-microprofile-graphql-models-1.0-SNAPSHOT.jar
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  0.998 s
[INFO] Finished at: 2023-08-04T16:41:59+03:00
[INFO] ------------------------------------------------------------------------
 finish % cd graphql 
 graphql % mvn liberty:dev
[INFO] Scanning for projects...
[INFO] 
[INFO] ------< io.openliberty.guides:guide-microprofile-graphql-graphql >------
[INFO] Building guide-microprofile-graphql-graphql 1.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ war ]---------------------------------
[INFO] 
[INFO] --- liberty:3.8.2:dev (default-cli) @ guide-microprofile-graphql-graphql ---
[INFO] The recompileDependencies parameter is set to "false". On a file change only the affected classes will be recompiled.
[INFO] Running maven-resources-plugin:resources
[INFO] skip non existing resourceDirectory /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/src/main/resources
[INFO] Running maven-compiler-plugin:compile on /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/pom.xml
[INFO] Nothing to compile - all classes are up to date
[INFO] Running maven-resources-plugin:testResources
[INFO] skip non existing resourceDirectory /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/src/test/resources
[INFO] Running maven-compiler-plugin:testCompile on /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/pom.xml
[INFO] Nothing to compile - all classes are up to date
[INFO] Running liberty:create
[INFO] CWWKM2102I: Using artifact based assembly archive : io.openliberty:openliberty-kernel:null:23.0.0.7:zip.
[INFO] CWWKM2102I: Using installDirectory : /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp.
[INFO] CWWKM2102I: Using serverName : defaultServer.
[INFO] CWWKM2102I: Using serverDirectory : /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer.
[INFO] CWWKM2112I: Re-using previously installed assembly.
[INFO] Copying 1 file to /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer
[WARNING] /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer/configDropins/overrides/liberty-plugin-variable-config.xml file deleted before processing plugin configuration.
[INFO] CWWKM2144I: Update server configuration file server.xml from /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/src/main/liberty/config/server.xml.
[INFO] Running liberty:install-feature
[INFO] Parsing the server file for features and includes: defaultServer/server.xml
[INFO] Parsing the server file for features and includes: defaultServer/configDropins/overrides/liberty-plugin-variable-config.xml
[INFO] plugin listed esa: []
[INFO] Installing features: [jsonb-3.0, mpconfig-3.0, mpgraphql-2.0, restfulws-3.1, jsonp-2.1, mprestclient-3.0, cdi-4.0]

[INFO] The features are already installed, so no action is needed.
[WARNING] Overriding liberty plugin parameter, "looseApplication" to "true" and deploying application in looseApplication format
[INFO] Running liberty:deploy
[INFO] Copying 1 file to /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer
[WARNING] /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer/configDropins/overrides/liberty-plugin-variable-config.xml file deleted before processing plugin configuration.
[INFO] CWWKM2144I: Update server configuration file server.xml from /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/src/main/liberty/config/server.xml.
[INFO] CWWKM2185I: The liberty-maven-plugin configuration parameter "appsDirectory" value defaults to "apps".
[INFO] Application configuration is found in server.xml : guide-microprofile-graphql-graphql.war
[INFO] CWWKM2160I: Installing application guide-microprofile-graphql-graphql.war.xml.
[INFO] Copying 1 file to /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer
[WARNING] /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer/configDropins/overrides/liberty-plugin-variable-config.xml file deleted before processing plugin configuration.
[INFO] CWWKM2144I: Update server configuration file server.xml from /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/src/main/liberty/config/server.xml.
[INFO] CWWKM2001I: Invoke command is [/Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/bin/server, debug, defaultServer].
[INFO] 
[INFO] Listening for transport dt_socket at address: 7777
[INFO] Launching defaultServer (Open Liberty 23.0.0.7/wlp-1.0.79.cl230720230710-1201) on Eclipse OpenJ9 VM, version 17.0.6+10 (en_US)
[INFO] [AUDIT   ] CWWKE0001I: The server defaultServer has been launched.
[INFO] [AUDIT   ] CWWKG0093A: Processing configuration drop-ins resource: /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer/configDropins/overrides/liberty-plugin-variable-config.xml
[INFO] [AUDIT   ] CWWKZ0058I: Monitoring dropins for applications.
[INFO] CWWKM2010I: Searching for CWWKF0011I: in /Users/kf/Projects/guide-microprofile-graphql/finish/graphql/target/liberty/wlp/usr/servers/defaultServer/logs/messages.log. This search will timeout after 90 seconds.
[INFO] [AUDIT   ] CWWKT0016I: Web application available (default_host): http://172.20.10.14:9082/
[INFO] [WARNING ] Class [io.openliberty.guides.graphql.models.SystemInfo] is not indexed in Jandex. Can not scan Object Type, might not be mapped correctly
[INFO] [WARNING ] Class [io.openliberty.guides.graphql.models.SystemLoad] is not indexed in Jandex. Can not scan Object Type, might not be mapped correctly
[INFO] [ERROR   ] CWMGQ0001E: An error in the Liberty Project web module prevented the MicroProfile GraphQL application from starting.
[INFO] [WARNING ] CWWWC0001W: The [com.ibm.ws.io.smallrye.graphql.component.GraphQLServletContainerInitializer@112f62db] ServletContainerInitializer, located in the following application [Liberty Project], produced the following error while invoking the onStartup method: [jakarta.servlet.ServletException: graphql.AssertException: type SystemInfo not found in schema
[INFO]  at com.ibm.ws.io.smallrye.graphql.component.GraphQLServletContainerInitializer.onStartup(GraphQLServletContainerInitializer.java:198)
[INFO]  at [internal classes]
[INFO] Caused by: graphql.AssertException: type SystemInfo not found in schema
[INFO]  at graphql.Assert.assertNotNull(Assert.java:17)
[INFO]  ... 1 more
[INFO] ]
[INFO] [AUDIT   ] CWWKZ0001I: Application guide-microprofile-graphql-graphql started in 0.899 seconds.
[INFO] [ERROR   ] CWWKO0221E: TCP Channel defaultHttpEndpoint initialization did not succeed.  The socket bind did not succeed for host * and port 9082.  The port might already be in use.  Exception Message: Address already in use
[INFO] [AUDIT   ] CWWKT0017I: Web application removed (default_host): http://172.20.10.14:9082/
[INFO] [AUDIT   ] CWWKF0012I: The server installed the following features: [cdi-4.0, concurrent-3.0, jndi-1.0, jsonb-3.0, jsonp-2.1, mpConfig-3.0, mpContextPropagation-1.3, mpGraphQL-2.0, mpRestClient-3.0, restfulWS-3.1, restfulWSClient-3.1].
[INFO] [AUDIT   ] CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 2.074 seconds.
[INFO] CWWKM2015I: Match number: 1 is [8/4/23, 16:42:25:192 EEST] 00000033 com.ibm.ws.kernel.feature.internal.FeatureManager            A CWWKF0011I: The defaultServer server is ready to run a smarter planet. The defaultServer server started in 2.074 seconds..
[ERROR]  TCP Channel defaultHttpEndpoint initialization did not succeed.  The socket bind did not succeed for host * and port 9082.  The port might already be in use.  Exception Message: Address already in use
[INFO] ************************************************************************
[INFO] *    Liberty is running in dev mode.
[INFO] *        Automatic generation of features: [ Off ]
[INFO] *        h - see the help menu for available actions, type 'h' and press Enter.
[INFO] *        q - stop the server and quit dev mode, press Ctrl-C or type 'q' and press Enter.
[INFO] *        
[INFO] *    Liberty server port information:
[INFO] *        Liberty server HTTP port: [ 9082 ]
[INFO] *        Liberty debug port: [ 7777 ]
[INFO] ************************************************************************
[INFO] Source compilation was successful.
[INFO] Tests compilation was successful.
[INFO] [AUDIT   ] CWWKZ0009I: The application guide-microprofile-graphql-graphql has stopped successfully.
[INFO] [WARNING ] Class [io.openliberty.guides.graphql.models.SystemInfo] is not indexed in Jandex. Can not scan Object Type, might not be mapped correctly
[INFO] [WARNING ] Class [io.openliberty.guides.graphql.models.SystemLoad] is not indexed in Jandex. Can not scan Object Type, might not be mapped correctly
[INFO] [ERROR   ] CWMGQ0001E: An error in the Liberty Project web module prevented the MicroProfile GraphQL application from starting.
[INFO] [WARNING ] CWWWC0001W: The [com.ibm.ws.io.smallrye.graphql.component.GraphQLServletContainerInitializer@112f62db] ServletContainerInitializer, located in the following application [Liberty Project], produced the following error while invoking the onStartup method: [jakarta.servlet.ServletException: graphql.AssertException: type SystemInfo not found in schema
[INFO]  at com.ibm.ws.io.smallrye.graphql.component.GraphQLServletContainerInitializer.onStartup(GraphQLServletContainerInitializer.java:198)
[INFO]  at [internal classes]
[INFO] Caused by: graphql.AssertException: type SystemInfo not found in schema
[INFO]  at graphql.Assert.assertNotNull(Assert.java:17)
[INFO]  ... 1 more
[INFO] ]
[INFO] [AUDIT   ] CWWKZ0003I: The application guide-microprofile-graphql-graphql updated in 0.200 seconds.
Ruilin-Ma commented 1 year ago

Hello Kenzku,

I appreciate your message. Unfortunately, it seems that OpenLiberty's dev mode does not currently support loose GraphQL applications. You can refer to the issue discussion here. In this case, attempting to execute queries on the GraphQL might result in failures. Thank you for your understanding, and please do not hesitate to notify us of any additional concerns you may have.

gkwan-ibm commented 4 months ago

close