I have a Spring Boot app that works fine when running with the built-in Tomcat. When I exclude the built-in Tomcat instance and deploy in IBM Liberty, most services/controllers work fine. However, 2 of my services fail to autowire, receiving a NPE when they are invoked.
The logs I'm seeing are:
Actual Error
Caused by: java.lang.NullPointerException
at com.services.adminsuite.features.linkedattributes.controllers.LinkedAttributesController.getAllConfigurations(LinkedAttributesController.java:122)
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 org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:189)
at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:138)
at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:102)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:895)
at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:800)
at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:87)
at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1038)
at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:942)
at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1005)
Startup discrepancies
[AUDIT ] CWWKG0102I: Found conflicting settings for defaultKeyStore instance of keyStore configuration.
Property password has conflicting values:
Secure value is set in file:/opt/IBM/JazzTeamServer702-app10/wlp/usr/servers/pxs/GeneratedSSLInclude.xml.
Secure value is set in file:/opt/IBM/JazzTeamServer702-app10/wlp/usr/servers/pxs/server.xml.
Property password will be set to the value defined in file:/opt/IBM/JazzTeamServer702-app10/wlp/usr/servers/pxs/server.xml.
[AUDIT ] CWWKZ0058I: Monitoring dropins for applications.
[WARNING ] CWWKT0023W: The configured defaultHostName pxsjts could not be resolved, using localhost instead.
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9081/ibm/adminCenter/serverConfig-1.0/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9081/adminCenter/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9081/ibm/adminCenter/explore-1.0/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9081/IBMJMXConnectorREST/
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9081/ibm/api/
[WARNING ] CWNEN0047W: Resource annotations on the fields of the org.springframework.web.servlet.view.tiles3.TilesConfigurer$CompositeELResolverImpl class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver
[WARNING ] CWNEN0049W: Resource annotations on the methods of the org.springframework.web.servlet.view.tiles3.TilesConfigurer$CompositeELResolverImpl class will be ignored. The annotations could not be obtained because of the exception : java.lang.NoClassDefFoundError: org.apache.tiles.el.ScopeELResolver
21:18:13.805 [Default Executor-thread-3] INFO org.springframework.data.jpa.repository.cdi.JpaRepositoryExtension - Activating CDI extension for Spring Data JPA repositories.
[AUDIT ] CWWKT0016I: Web application available (default_host): http://localhost:9081/pxs/
. ____ _ __ _ _
/\\ / ___'_ __ _ _(_)_ __ __ _ \ \ \ \
( ( )\___ | '_ | '_| | '_ \/ _` | \ \ \ \
\\/ ___)| |_)| | | | | || (_| | ) ) ) )
' |____| .__|_| |_|_| |_\__, | / / / /
=========|_|==============|___/=/_/_/_/
:: Spring Boot :: (v2.1.1.RELEASE)
2021-07-13 21:18:15.656 INFO 123564 --- [ecutor-thread-4] c.p.services.adminsuite.WebInitializer : Starting WebInitializer on with PID 123564 (/opt/IBM/JazzTeamServer702-app10/wlp/usr/servers/pxs/apps/expanded/pxs.war/WEB-INF/classes started by in /opt/IBM/JazzTeamServer702-app10/wlp/usr/servers/pxs)
2021-07-13 21:18:15.657 INFO 123564 --- [ecutor-thread-4] c.p.services.adminsuite.WebInitializer : The following profiles are active: prod
2021-07-13 21:18:16.755 INFO 123564 --- [ecutor-thread-4] .s.d.r.c.RepositoryConfigurationDelegate : Bootstrapping Spring Data repositories in DEFAULT mode.
2021-07-13 21:18:16.906 INFO 123564 --- [ecutor-thread-4] .s.d.r.c.RepositoryConfigurationDelegate : Finished Spring Data repository scanning in 144ms. Found 13 repository interfaces.
2021-07-13 21:18:17.424 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$c4bbc7fd] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.460 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration' of type [org.springframework.security.config.annotation.configuration.ObjectPostProcessorConfiguration$$EnhancerBySpringCGLIB$$5d699037] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.466 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'objectPostProcessor' of type [org.springframework.security.config.annotation.configuration.AutowireBeanFactoryObjectPostProcessor] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.469 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler@f8b13266' of type [org.springframework.security.access.expression.method.DefaultMethodSecurityExpressionHandler] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.472 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityConfiguration' of type [com.services.adminsuite.core.config.MethodSecurityConfiguration$$EnhancerBySpringCGLIB$$e74ada7b] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.481 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.security.config.annotation.method.configuration.Jsr250MetadataSourceConfiguration' of type [org.springframework.security.config.annotation.method.configuration.Jsr250MetadataSourceConfiguration$$EnhancerBySpringCGLIB$$a7934aff] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.484 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'jsr250MethodSecurityMetadataSource' of type [org.springframework.security.access.annotation.Jsr250MethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.485 INFO 123564 --- [ecutor-thread-4] trationDelegate$BeanPostProcessorChecker : Bean 'methodSecurityMetadataSource' of type [org.springframework.security.access.method.DelegatingMethodSecurityMetadataSource] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
2021-07-13 21:18:17.511 INFO 123564 --- [ecutor-thread-4] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1832 ms
The org.apache.tiles.el.ScopeELResolver NoClassDefFound error I've seen elsewhere in others logs when using Liberty, so doesn't seem related but not for sure. The BeanPostProcessor ones are interesting though, but not for sure there either (commented out method security on the class but it's still occurring).
Do you know why there would be any difference between how Liberty processes these and Tomcat? Or any tips for debugging this?
Thank you, Matt
Turns out the controller endpoints with the problem (3 of them), for some reason were missing access modifier. Adding protected to the methods fixed the issue. It wasn't an issue in Tomcat, but only when running on Liberty. Thank you again for the help (and apologize for the late response as went on vacation soon after posting it)