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

MicroProfile Health check fails when server has an OSGi app (internal or external) or a WAR without any CDI beans #17

Closed
scottkurz opened this issue Sep 19, 2017 · 1 comment

Comments

@scottkurz
Copy link
Member

The common theme here is that the Health Check discovery can fail because of the presence of other deployed application modules that aren't themselves contributing Health Check beans. These can be true application modules or internal, "system" app modules.

In these cases, the health endpoint (e.g. http://localhost:9080/health) will return a response status of 500.

There are two main cases, with different response payloads (which will also include a stack trace):

In the one case, in which there is an OSGi application (external app or "system app") deployed contributing a web module, the error response looks like:

java.lang.IllegalStateException: ClassLoader ID is null for application component com.ibm.ws.microprofile.metrics#com.ibm.ws.microprofile.metrics. Verify the application component is installed.
	at com.ibm.ws.microprofile.health.services.impl.AppModuleContextService.getContextClassLoaderIdentifier(AppModuleContextService.java:151)
	at com.ibm.ws.microprofile.health.services.impl.AppModuleContextService.createThreadContext(AppModuleContextService.java:169)
	at com.ibm.ws.microprofile.health.services.impl.AppModuleContextService.createContextualProxy(AppModuleContextService.java:195)
	at com.ibm.ws.microprofile.health.services.impl.HealthExecutorImpl.runHealthChecks(HealthExecutorImpl.java:69)
	at com.ibm.ws.microprofile.health.internal.HealthCheckServiceImpl.performHealthCheck(HealthCheckServiceImpl.java:107)
	at com.ibm.ws.microprofile.health.internal.servlet.HealthCheckServlet.service(HealthCheckServlet.java:53)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1255)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:743)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:440)
        ... stack trace continues ...

In the second case, in which there is a WAR module deployed, but one in which there are zero discovered CDI-managed beans, the exception in the response looks like:

javax.naming.NameNotFoundException: javax.naming.NameNotFoundException: java:comp/BeanManager
	at com.ibm.ws.jndi.url.contexts.javacolon.internal.JavaURLContext.lookup(JavaURLContext.java:355)
	at com.ibm.ws.jndi.url.contexts.javacolon.internal.JavaURLContext.lookup(JavaURLContext.java:370)
	at org.apache.aries.jndi.DelegateContext.lookup(DelegateContext.java:161)
	at javax.naming.InitialContext.lookup(InitialContext.java:428)
	at com.ibm.ws.microprofile.health.services.impl.HealthCheckCDIBeanInvokerImpl.getHealthCheckBeans(HealthCheckCDIBeanInvokerImpl.java:71)
	at com.ibm.ws.microprofile.health.services.impl.HealthCheckCDIBeanInvokerImpl.checkAllBeans(HealthCheckCDIBeanInvokerImpl.java:51)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:90)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:55)
	at java.lang.reflect.Method.invoke(Method.java:508)
	at com.ibm.ws.context.service.serializable.ContextualInvocationHandler.invoke(ContextualInvocationHandler.java:76)
	at com.ibm.ws.context.service.serializable.ContextualInvocationHandler.invoke(ContextualInvocationHandler.java:97)
	at com.sun.proxy.$Proxy41.checkAllBeans(Unknown Source)
	at com.ibm.ws.microprofile.health.services.impl.HealthExecutorImpl.runHealthChecks(HealthExecutorImpl.java:72)
	at com.ibm.ws.microprofile.health.internal.HealthCheckServiceImpl.performHealthCheck(HealthCheckServiceImpl.java:107)
	at com.ibm.ws.microprofile.health.internal.servlet.HealthCheckServlet.service(HealthCheckServlet.java:53)
	at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.service(ServletWrapper.java:1255)
	at com.ibm.ws.webcontainer.servlet.ServletWrapper.handleRequest(ServletWrapper.java:743)
@scottkurz
Copy link
Member Author

Resolved

leochr pushed a commit to leochr/open-liberty that referenced this issue Feb 1, 2018
AidanPolese pushed a commit to AidanPolese/open-liberty that referenced this issue Sep 24, 2018
Temporary Ant scripts for continuous build; will write these as Gradl…
herman-kailey added a commit to herman-kailey/open-liberty that referenced this issue Oct 21, 2019
brenthdaniel added a commit to brenthdaniel/open-liberty that referenced this issue Jul 11, 2022
Move to official liberty UBI images and update to 20.0.0.3
mrsaldana added a commit to mrsaldana/open-liberty that referenced this issue Apr 29, 2024
…dition

Added fix for race condition while server starts up
jacobwdv pushed a commit to jacobwdv/open-liberty that referenced this issue Dec 12, 2024
add com.ibm.ws.common.crypto trace
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants