Skip to content
This repository was archived by the owner on Dec 19, 2023. It is now read-only.

WAR deployment to Tomcat 9 throws IllegalStateException exception #165

Closed
khteh opened this issue Nov 28, 2018 · 21 comments
Closed

WAR deployment to Tomcat 9 throws IllegalStateException exception #165

khteh opened this issue Nov 28, 2018 · 21 comments

Comments

@khteh
Copy link

khteh commented Nov 28, 2018

IllegalStateException thrown when GraphQL project built as WAR deployed to Tomcat 9:

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serverEndpointExporter' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available

Relevant bug and suggested fix in spring.io: https://jira.spring.io/browse/SPR-12109

@khteh khteh changed the title WAR deployment to Tomcat 9 exception WAR deployment to Tomcat 9 IllegalStateException exception Nov 28, 2018
@khteh khteh changed the title WAR deployment to Tomcat 9 IllegalStateException exception WAR deployment to Tomcat 9 throws IllegalStateException exception Nov 28, 2018
@khteh
Copy link
Author

khteh commented Dec 7, 2018

Relevant bug and suggested fix in spring.io: https://jira.spring.io/browse/SPR-12109 doesn't work on Tomcat 9.

@oliemansm
Copy link
Member

@khteh You're referencing an apparently known bug in Spring about this. So sounds like they are working on a fix for that one. What do you expect by opening this issue here then? Is there something now that needs to be updated here to fix it?

@khteh
Copy link
Author

khteh commented Dec 11, 2018

@oliemansm, can you provide a link to the known issue in spring? Thanks.

@dengyuan1989
Copy link

dengyuan1989 commented Dec 14, 2018

@oliemansm I have the same issue by WAR deploy with Tomcat 8.5.35

@oliemansm
Copy link
Member

@khteh I'm referring to the known issue and link you reported here yourself: https://jira.spring.io/browse/SPR-12109

@khteh
Copy link
Author

khteh commented Dec 28, 2018

@shinobi81
Copy link

Hi, I don't know if this info could be useful
I got the same error:

2019-03-04 10:07:19.221 ERROR 4903 --- [ main] c.o.m.g.b.e.GraphQLErrorHandlerFactory : Cannot load class graphQLServletRegistrationBean. Error creating bean with name 'graphQLServletRegistrationBean': Requested bean is currently in creation: Is there an unresolvable circular reference?
2019-03-04 10:07:19.246 ERROR 4903 --- [ main] c.o.m.g.b.e.GraphQLErrorHandlerFactory : Cannot load class serverEndpointExporter. Error creating bean with name 'serverEndpointExporter' defined in class path resource [com/oembedler/moon/graphql/boot/GraphQLWebsocketAutoConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available

This is my configuration:
Spring boot version: 2.1.3.RELEASE
graphql-spring-boot-starter version: 5.4.1 and later

java -version
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)

mvn -version
Apache Maven 3.5.4 (1edded0938998edf8bf061f1ceb3cfdeccf443fe; 2018-06-17T20:33:14+02:00)
Maven home: /usr/local/Cellar/[email protected]/3.5.4/libexec
Java version: 11, vendor: Oracle Corporation, runtime: /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home
Default locale: en_IT, platform encoding: UTF-8
OS name: "mac os x", version: "10.13.6", arch: "x86_64", family: "mac"

@oliemansm
Copy link
Member

@shinobi81 Your issue should be fixed with the next release 5.7.2. And hopefully that will fix the issue for this original issue regarding WAR deployment as well, but not sure about that.

@khteh
Copy link
Author

khteh commented Mar 30, 2019 via email

@oliemansm
Copy link
Member

This weekend, maybe today even. Just going through the several projects to see if there are any issues I can fix and include. If you have a clone of the project you could pull in the latest changes and build a local snapshot to verify if it's working for you.

@unchai
Copy link

unchai commented Apr 26, 2019

Hello~ I'm using dependencies below, but got error:

spring-boot version : 2.1.4.RELEASE
graphql-spring-boot-starter version : 5.8.1
tomcat version : 8.5.40

Caused by: java.lang.RuntimeException: java.lang.IllegalStateException: javax.websocket.server.ServerContainer not available
at org.springframework.web.context.support.ServletContextAwareProcessor.postProcessBeforeInitialization(ServletContextAwareProcessor.java:108)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsBeforeInitialization(AbstractAutowireCapableBeanFactory.java:414)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1770)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:593)
... 62 more

@unchai
Copy link

unchai commented May 30, 2019

I avoided the error in the following ways.

-@SpringBootApplication
+@SpringBootApplication(exclude = {
+    GraphQLWebsocketAutoConfiguration.class
+})
public class Application extends SpringBootServletInitializer {
...
}

@sutra
Copy link

sutra commented Jun 26, 2019

Seems issue resolved after I upgrade spring boot from 2.1.5 to 2.1.6.

@oliemansm
Copy link
Member

Good to hear @sutra!

@oliemansm
Copy link
Member

@khteh Can you verify that upgrading Spring Boot to 2.1.6.RELEASE fixes the issue for you too?

@khteh
Copy link
Author

khteh commented Jun 28, 2019 via email

@sutra
Copy link

sutra commented Jun 28, 2019

Seems issue resolved after I upgrade spring boot from 2.1.5 to 2.1.6.

Seems not works every time.
Added graphql.servlet.websocket.enabled=false in application.properties now, and get it working. See

@ConditionalOnProperty(value = "graphql.servlet.websocket.enabled", havingValue = "true", matchIfMissing = true)

in com.oembedler.moon.graphql.boot.GraphQLWebsocketAutoConfiguration.

Now the question is why the matchIfMissing is set to true?

@slavap
Copy link

slavap commented Nov 16, 2019

Tomcat 8.5.35, Spring Boot 2.2.1, graphql-spring-boot-starter 5.11.0
Getting this error, only graphql.servlet.websocket.enabled=false helps.

@shinobi81
Copy link

Tomcat 9.0.31 should fix this bug
spring-projects/spring-framework#22131

@azunke
Copy link

azunke commented Feb 9, 2020

Thanks @slavap Your solution worked. Everything was ok with me locally using Oracle JDK. But as soon as i moved to OpenJDK, it started giving me error. The solution @slavap provided worked.

@oliemansm
Copy link
Member

So proven solution is to set graphql.servlet.websocket.enabled=false for this situation.

Mura-Mi added a commit to Mura-Mi/kt-spring-graphql-sandbox that referenced this issue Dec 12, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants