Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

io.smallrye.graphql.entry.http.GraphQLServerWebSocket java.lang.NoClassDefFoundError: org.jboss.logging.Logger #27534

Closed
urbandroid opened this issue Jan 31, 2024 · 3 comments
Labels
Needs member attention release bug This bug is present in a released version of Open Liberty

Comments

@urbandroid
Copy link

urbandroid commented Jan 31, 2024

Describe the bug
I'm trying to GraphQL server to run on OpenLiberty and it complains at start that :
smallrye/smallrye-graphql#2018
I initially opened issue at the smallrye and got feedback from them to open here. I have managed to
make it work with payara, wildfly and openliberty but open liberty fails if below dependency not added.

```
<dependency>
		<groupId>org.jboss.logging</groupId>
		<artifactId>jboss-logging</artifactId>
		<version>3.5.3.Final</version>
	</dependency> 



> `[WARNING ] CWNEN0047W: Resource annotations on the fields of the io.smallrye.graphql.entry.http.GraphQLServerWebSocket class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.jboss.logging.Logger
> [AUDIT ] CWWKT0016I: Web application available (default_host): http://ac6a5b861e67:9080/deneme2-web/
> [ERROR ] SRVE0283E: Exception caught while initializing context: java.lang.NoClassDefFoundError: org.jboss.logging.Logger
> at io.smallrye.graphql.entry.http.SmallRyeGraphQLServletLogging.(SmallRyeGraphQLServletLogging.java:17)
> at io.smallrye.graphql.entry.http.IndexInitializer.createIndex(IndexInitializer.java:55)
> at io.smallrye.graphql.entry.http.StartupListener.contextInitialized(StartupListener.java:55)
> at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2465)
> at [internal classes]
> 
> [ERROR ] SRVE0265E: Error occured while notifying listeners of web application start: java.lang.NoClassDefFoundError: org.jboss.logging.Logger
> at io.smallrye.graphql.entry.http.SmallRyeGraphQLServletLogging.(SmallRyeGraphQLServletLogging.java:17)
> at io.smallrye.graphql.entry.http.IndexInitializer.createIndex(IndexInitializer.java:55)
> at io.smallrye.graphql.entry.http.StartupListener.contextInitialized(StartupListener.java:55)
> at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextCreated(WebApp.java:2465)
> at [internal classes]
> 
> [AUDIT ] CWWKZ0012I: The application deneme2-ear was not started.
> [AUDIT ] CWWKT0017I: Web application removed (default_host): http://ac6a5b861e67:9080/deneme2-web/
> [ERROR ] SRVE0285E: Exception caught while destroying context: java.lang.NoClassDefFoundError: io.smallrye.graphql.entry.http.SmallRyeGraphQLServletLogging (initialization failure)
> at java.base/java.lang.J9VMInternals.initializationAlreadyFailed(J9VMInternals.java:156)
> at io.smallrye.graphql.entry.http.StartupListener.contextDestroyed(StartupListener.java:69)
> at com.ibm.ws.webcontainer.webapp.WebApp.notifyServletContextDestroyed(WebApp.java:2697)
> at [internal classes]
> 

**Steps to Reproduce**  
https://github.com/urbandroid/graphql-jakarta/commit/28d97e3ae00727fed386a0020c02a3390f26995b run this commit with 
1. mvn clean install 
2. docker build -f payara/Dockerfile -t urbandroid/deneme2 .
3. docker run -it --name payara -p 8080:8080 urbandroid/deneme2


**Expected behavior**  
Deployment should succeed just like it does with payara and wildfly. 

**Diagnostic information:**  
 - openliberty/open-liberty:full-java11-openj9-ubi docker image
 - Affected feature(s) : GraphQL
 - Java Version: openjdk version "11.0.21" 2023-10-17
IBM Semeru Runtime Open Edition 11.0.21.0 (build 11.0.21+9)
Eclipse OpenJ9 VM 11.0.21.0 (build openj9-0.41.0, JRE 11 Linux amd64-64-Bit Compressed References 20231122_912 (JIT enabled, AOT enabled)
OpenJ9   - 461bf3c70
OMR      - 5eee6ad9d
JCL      - 0fd7a05277 based on jdk-11.0.21+9)

 - server.xml configuration:

> <?xml version="1.0" encoding="UTF-8"?>
> <server description="new server">
> 
>     <!-- Enable features -->
>     <featureManager>
>         <feature>jakartaee-10.0</feature>
>     </featureManager>
> 
>     <!-- This template enables security. To get the full use of all the capabilities, a keystore and user registry are required. -->
>     
>     <!-- For the keystore, default keys are generated and stored in a keystore. To provide the keystore password, generate an 
>          encoded password using bin/securityUtility encode and add it below in the password attribute of the keyStore element. 
>          Then uncomment the keyStore element. -->
>     <!--
>     <keyStore password=""/> 
>     -->
>     
>     <!--For a user registry configuration, configure your user registry. For example, configure a basic user registry using the
>         basicRegistry element. Specify your own user name below in the name attribute of the user element. For the password, 
>         generate an encoded password using bin/securityUtility encode and add it in the password attribute of the user element. 
>         Then uncomment the user element. -->
>     <basicRegistry id="basic" realm="BasicRealm"> 
>         <!-- <user name="yourUserName" password="" />  --> 
>     </basicRegistry>
>     
> 
>                   
>     <!-- Automatically expand WAR files and EAR files -->
>     <applicationManager autoExpand="true"/>
> 
> </server>


`When org.jboss.logging and microprofile config added to dependency it works but i shouldn't be required according to smallrye team since it is a provided dependency and it works without this two dependency with payara and wildfly so i think it is a bug.`



@NottyCode
Copy link
Member

Looking at the smallrye bug report I think they are saying that if you used the Liberty mpGraphQL-2.0 feature you wouldn't need to use this dependency, and you are right you wouldn't. We have some guides for how to use it here, and the documentation for our mpGraphQL-2.0 feature is here.

In your case though it looks like you have packaged the smallrye graphql in your application and are not using the mpGraphQL-2.0 feature. If you choose to go this route then Liberty will treat the smallrye graphql as application code at which point you are required to package the dependencies of smallrye graphql as a part of your application. The org.jboss.logging.Logger class is not part of the Jakarta EE API you have configured, and runtimes are not obliged to package it for your application use. I would guess that WildFly and Payara do package the code, and package it in a way your application has visibility to it which is why it works there. Liberty does not package it for application use, we choose not to do this because doing so would limit your ability to independently manage the open dependencies in your application from Liberty.

I see in the smallrye bug report that the smallrye team don't want to change this dependency from provided scope to compile scope, that is really a question for them, but it seems unreasonable and incorrect to expect that all runtimes provides this dependency. I suspect the same issue will arise when using Tomcat.

@urbandroid
Copy link
Author

Thank you @NottyCode my initial guess was the same hence i opened bug there first.

@NottyCode
Copy link
Member

Based on the conversation over in the Smallrye issue and based on the thread here I'm going to close this issue since it does appear everyone here agrees this is a bug in Smallrye.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Needs member attention release bug This bug is present in a released version of Open Liberty
Projects
None yet
Development

No branches or pull requests

3 participants