0

I have a set of microservices that I am developing. Everything works fine developing in maven.

(1) REGISTRY: I have a jhipster-registery running in the dev profile with at git configuration. It works fine and I can see my custom configurations.

./jhipster-registry-3.2.3.war --security.user.password=admin --jhipster.security.authentication.jwt.secret=my-secret-token-to-change-in-production2 --spring.profiles.active=dev --spring.cloud.config.server.git.uri=ssh://myuser@mygit.mycustomdomain.org/git/dev/microservices/registryconfig.git

(2) UAA: I have a uaa that launches both by maven (./mvnw) and by the packaged war file. It registers on the registry as member. It works successfully when I am testing out the other microservices. I launch this first.

-- 20180317-Additional update: The gateway runs fine when packaged as a war file. So only my microservices are having problems.

(3) MICROSERVICE with MAVEN: When I launch my microservice called dispatcher using the ./mvnw with dev profile it launches successfully with no problems and functions programmatically fine. So I would assume that once I package it into a war file that it would work exactly the same.

(4) MICROSERVICE with packaged dev WAR fails. : When I test the microservice outside of maven with a packaged war file ./mvnw -Pdev package then launch the war ./target/dispatcher/dispatcher-0.0.1-SNAPSHOT.war file it fails with


Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodSecurityInterceptor' defined in class path resource [org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: An AuthenticationManager is required

I do not know if this is the actual problem or related to it shutting down.

Thank you very much for your help.

---------------------------------------------------------
:: JHipster   :: Running Spring Boot 1.5.9.RELEASE ::
:: http://www.jhipster.tech ::

2018-03-16 20:53:03.442  INFO 3886 --- [           main] o.l.services.dispatcher.DispatcherApp    : The following profiles are active: swagger,dev
2018-03-16 20:53:11.741 DEBUG 3886 --- [           main] o.l.s.d.config.AsyncConfiguration        : Creating Async Task Executor
2018-03-16 20:53:12.767 DEBUG 3886 --- [           main] o.l.s.d.config.MetricsConfiguration      : Registering JVM gauges
2018-03-16 20:53:12.822 DEBUG 3886 --- [           main] o.l.s.d.config.MetricsConfiguration      : Monitoring the datasource
2018-03-16 20:53:12.822 DEBUG 3886 --- [           main] o.l.s.d.config.MetricsConfiguration      : Initializing Metrics JMX reporting
2018-03-16 20:53:14.015 DEBUG 3886 --- [           main] o.l.s.d.config.CacheConfiguration        : Configuring Hazelcast
2018-03-16 20:53:14.071 DEBUG 3886 --- [           main] o.l.s.d.config.CacheConfiguration        : Configuring Hazelcast clustering for instanceId: dispatcher
2018-03-16 20:53:14.073 DEBUG 3886 --- [           main] o.l.s.d.config.CacheConfiguration        : Application is running with the "dev" profile, Hazelcast cluster will only work with localhost instances
2018-03-16 20:53:14.211  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Initializing Eureka in region us-east-1
2018-03-16 20:53:14.560  INFO 3886 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON encoding codec LegacyJacksonJson
2018-03-16 20:53:14.560  INFO 3886 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using JSON decoding codec LegacyJacksonJson
2018-03-16 20:53:14.793  INFO 3886 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML encoding codec XStreamXml
2018-03-16 20:53:14.797  INFO 3886 --- [           main] c.n.d.provider.DiscoveryJerseyProvider   : Using XML decoding codec XStreamXml
2018-03-16 20:53:15.110  INFO 3886 --- [           main] c.n.d.s.r.aws.ConfigClusterResolver      : Resolving eureka endpoints via configuration
2018-03-16 20:53:15.151  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Disable delta property : false
2018-03-16 20:53:15.152  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Single vip registry refresh property : null
2018-03-16 20:53:15.152  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Force full registry fetch : false
2018-03-16 20:53:15.152  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Application is null : false
2018-03-16 20:53:15.153  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Registered Applications size is zero : true
2018-03-16 20:53:15.153  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Application version is -1: true
2018-03-16 20:53:15.153  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Getting all instance registry info from the eureka server
2018-03-16 20:53:15.360  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : The response status is 200
2018-03-16 20:53:15.362  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Starting heartbeat executor: renew interval is: 5
2018-03-16 20:53:15.369  INFO 3886 --- [           main] c.n.discovery.InstanceInfoReplicator     : InstanceInfoReplicator onDemand update allowed rate per min is 12
2018-03-16 20:53:15.372  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Discovery Client initialized at timestamp 1521233595372 with initial instances count: 1
2018-03-16 20:53:15.488  INFO 3886 --- [           main] com.hazelcast.instance.AddressPicker     : [LOCAL] [dev] [3.9.1] Picked [127.0.0.1]:15703, using socket ServerSocket[addr=/0:0:0:0:0:0:0:0,localport=15703], bind any local is true
2018-03-16 20:53:15.526  INFO 3886 --- [           main] com.hazelcast.system                     : [127.0.0.1]:15703 [dev] [3.9.1] Hazelcast 3.9.1 (20171130 - feca534) starting at [127.0.0.1]:15703
2018-03-16 20:53:15.526  INFO 3886 --- [           main] com.hazelcast.system                     : [127.0.0.1]:15703 [dev] [3.9.1] Copyright (c) 2008-2017, Hazelcast, Inc. All Rights Reserved.
2018-03-16 20:53:15.526  INFO 3886 --- [           main] com.hazelcast.system                     : [127.0.0.1]:15703 [dev] [3.9.1] Configured Hazelcast Serialization version: 1
2018-03-16 20:53:16.217  INFO 3886 --- [           main] c.h.s.i.o.impl.BackpressureRegulator     : [127.0.0.1]:15703 [dev] [3.9.1] Backpressure is disabled
2018-03-16 20:53:17.621  INFO 3886 --- [           main] com.hazelcast.instance.Node              : [127.0.0.1]:15703 [dev] [3.9.1] Creating TcpIpJoiner
2018-03-16 20:53:18.281  INFO 3886 --- [           main] c.h.s.i.o.impl.OperationExecutorImpl     : [127.0.0.1]:15703 [dev] [3.9.1] Starting 2 partition threads and 3 generic threads (1 dedicated for priority tasks)
2018-03-16 20:53:18.286  INFO 3886 --- [           main] c.h.internal.diagnostics.Diagnostics     : [127.0.0.1]:15703 [dev] [3.9.1] Diagnostics disabled. To enable add -Dhazelcast.diagnostics.enabled=true to the JVM arguments.
2018-03-16 20:53:18.297  INFO 3886 --- [           main] com.hazelcast.core.LifecycleService      : [127.0.0.1]:15703 [dev] [3.9.1] [127.0.0.1]:15703 is STARTING
2018-03-16 20:53:18.337  INFO 3886 --- [           main] com.hazelcast.system                     : [127.0.0.1]:15703 [dev] [3.9.1] Cluster version set to 3.9
2018-03-16 20:53:18.338  INFO 3886 --- [           main] c.h.internal.cluster.ClusterService      : [127.0.0.1]:15703 [dev] [3.9.1] 

Members {size:1, ver:1} [
    Member [127.0.0.1]:15703 - bac85484-097d-464e-bbd7-ec3bc19904ef this
]

2018-03-16 20:53:18.409  INFO 3886 --- [           main] com.hazelcast.core.LifecycleService      : [127.0.0.1]:15703 [dev] [3.9.1] [127.0.0.1]:15703 is STARTED
2018-03-16 20:53:19.291  INFO 3886 --- [           main] o.l.s.dispatcher.config.WebConfigurer    : Web application configuration, using profiles: swagger
2018-03-16 20:53:19.292 DEBUG 3886 --- [           main] o.l.s.dispatcher.config.WebConfigurer    : Initializing Metrics registries
2018-03-16 20:53:19.297 DEBUG 3886 --- [           main] o.l.s.dispatcher.config.WebConfigurer    : Registering Metrics Filter
2018-03-16 20:53:19.297 DEBUG 3886 --- [           main] o.l.s.dispatcher.config.WebConfigurer    : Registering Metrics Servlet
2018-03-16 20:53:19.300 DEBUG 3886 --- [           main] o.l.s.dispatcher.config.WebConfigurer    : Initialize H2 console
2018-03-16 20:53:19.301  INFO 3886 --- [           main] o.l.s.dispatcher.config.WebConfigurer    : Web application fully configured
2018-03-16 20:53:20.272 DEBUG 3886 --- [           main] o.l.s.d.config.DatabaseConfiguration     : Configuring Liquibase
2018-03-16 20:53:20.297  WARN 3886 --- [cher-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase   : Starting Liquibase asynchronously, your database might not be ready at startup!
2018-03-16 20:53:20.431  INFO 3886 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_DISPATCHER/dispatcher:4b01cdcf216b23bd82b25f5a376f7f44 - Re-registering apps/DISPATCHER
2018-03-16 20:53:20.431  INFO 3886 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_DISPATCHER/dispatcher:4b01cdcf216b23bd82b25f5a376f7f44: registering service...
2018-03-16 20:53:20.542  INFO 3886 --- [tbeatExecutor-0] com.netflix.discovery.DiscoveryClient    : DiscoveryClient_DISPATCHER/dispatcher:4b01cdcf216b23bd82b25f5a376f7f44 - registration status: 204
2018-03-16 20:53:22.671 DEBUG 3886 --- [cher-Executor-1] i.g.j.c.liquibase.AsyncSpringLiquibase   : Liquibase has updated your database in 2373 ms
2018-03-16 20:53:23.278  INFO 3886 --- [           main] c.h.h.HazelcastCacheRegionFactory        : Starting up HazelcastCacheRegionFactory
2018-03-16 20:53:23.282  INFO 3886 --- [           main] c.h.h.i.IHazelcastInstanceFactory        : Using existing HazelcastInstance [dispatcher].
2018-03-16 20:53:28.252 DEBUG 3886 --- [           main] o.l.s.d.config.CacheConfiguration        : Starting HazelcastCacheManager
2018-03-16 20:53:29.720  WARN 3886 --- [           main] c.n.c.sources.URLConfigurationSource     : No URLs will be polled as dynamic configuration sources.
2018-03-16 20:53:30.294 DEBUG 3886 --- [           main] .l.s.d.c.o.OAuth2JwtAccessTokenConverter : Public key retrieved from OAuth2 server to create SignatureVerifier
2018-03-16 20:53:30.417  WARN 3886 --- [           main] ationConfigEmbeddedWebApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodSecurityInterceptor' defined in class path resource [org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: An AuthenticationManager is required
2018-03-16 20:53:30.438  INFO 3886 --- [           main] c.h.h.HazelcastCacheRegionFactory        : Shutting down HazelcastCacheRegionFactory
2018-03-16 20:53:30.439  WARN 3886 --- [           main] c.h.h.i.IHazelcastInstanceFactory        : hibernate.cache.hazelcast.shutdown_on_session_factory_close property is set to 'false'. Leaving current HazelcastInstance active! (Warning: Do not disable Hazelcast hazelcast.shutdownhook.enabled property!)
2018-03-16 20:53:30.439  INFO 3886 --- [           main] com.hazelcast.core.LifecycleService      : [127.0.0.1]:15703 [dev] [3.9.1] [127.0.0.1]:15703 is SHUTTING_DOWN
2018-03-16 20:53:30.444  INFO 3886 --- [           main] com.hazelcast.instance.Node              : [127.0.0.1]:15703 [dev] [3.9.1] Shutting down connection manager...
2018-03-16 20:53:30.447  INFO 3886 --- [           main] com.hazelcast.instance.Node              : [127.0.0.1]:15703 [dev] [3.9.1] Shutting down node engine...
2018-03-16 20:53:30.460  INFO 3886 --- [           main] com.hazelcast.instance.NodeExtension     : [127.0.0.1]:15703 [dev] [3.9.1] Destroying node NodeExtension.
2018-03-16 20:53:30.460  INFO 3886 --- [           main] com.hazelcast.instance.Node              : [127.0.0.1]:15703 [dev] [3.9.1] Hazelcast Shutdown is completed in 16 ms.
2018-03-16 20:53:30.466  INFO 3886 --- [           main] com.hazelcast.core.LifecycleService      : [127.0.0.1]:15703 [dev] [3.9.1] [127.0.0.1]:15703 is SHUTDOWN
2018-03-16 20:53:30.466  INFO 3886 --- [           main] o.l.s.d.config.CacheConfiguration        : Closing Cache Manager
2018-03-16 20:53:30.491  INFO 3886 --- [           main] com.netflix.discovery.DiscoveryClient    : Shutting down DiscoveryClient ...
2018-03-16 20:53:30.498  WARN 3886 --- [           main] .s.c.a.CommonAnnotationBeanPostProcessor : Invocation of destroy method failed on bean with name 'scopedTarget.eurekaClient': org.springframework.beans.factory.BeanCreationNotAllowedException: Error creating bean with name 'eurekaInstanceConfigBean': Singleton bean creation not allowed while singletons of this factory are in destruction (Do not request a bean from a BeanFactory in a destroy method implementation!)
2018-03-16 20:53:30.528 ERROR 3886 --- [           main] o.s.boot.SpringApplication               : Application startup failed

org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'methodSecurityInterceptor' defined in class path resource [org/springframework/security/config/annotation/method/configuration/GlobalMethodSecurityConfiguration.class]: Invocation of init method failed; nested exception is java.lang.IllegalArgumentException: An AuthenticationManager is required
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1628)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:555)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:483)
    at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:306)
    at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:230)
    at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:302)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:761)
    at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:867)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:543)
    at org.springframework.boot.context.embedded.EmbeddedWebApplicationContext.refresh(EmbeddedWebApplicationContext.java:122)
    at org.springframework.boot.SpringApplication.refresh(SpringApplication.java:693)
    at org.springframework.boot.SpringApplication.refreshContext(SpringApplication.java:360)
    at org.springframework.boot.SpringApplication.run(SpringApplication.java:303)
    at org.lightyourlamp.services.dispatcher.DispatcherApp.main(DispatcherApp.java:77)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.springframework.boot.loader.MainMethodRunner.run(MainMethodRunner.java:48)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:87)
    at org.springframework.boot.loader.Launcher.launch(Launcher.java:50)
    at org.springframework.boot.loader.WarLauncher.main(WarLauncher.java:59)
Caused by: java.lang.IllegalArgumentException: An AuthenticationManager is required
    at org.springframework.util.Assert.notNull(Assert.java:134)
    at org.springframework.security.access.intercept.AbstractSecurityInterceptor.afterPropertiesSet(AbstractSecurityInterceptor.java:121)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1687)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1624)
    ... 22 common frames omitted
DSManuel
  • 1
  • 1
  • I tried to reproduce using the default demo config repo https://github.com/jhipster/jhipster-registry-sample-config and the microservice loaded fine. Can you compare your config with that sample? – Jon Ruddell Mar 18 '18 at 02:53
  • Jon, Thank you so much, I think I just resolved it. It was version conflict with the spring jars from another jar I added. I discovered it by creating a blank microservice and it worked and connected. Then I added the jar into the project and it began to throw strange errors. So I modified the jars class path and it worked. My speculation is that when it was running in maven it used maven's repository with a different order in the class path. But when I packaged it as a war the class path order may have changed. Thank you so much. – DSManuel Mar 18 '18 at 18:05

0 Answers0