llevo más de 2 días investigando para identificar el error en este proyecto pero no he tenido mucho éxito. No se si estoy haciendo mal la consulta, pero no encontré mucha información relacionada al error que encentro.
Estoy realizando una conexión de java a mongodb en entorno local usando spring-boot-starter-data-mongodb
. He buscado documentación y ejemplos para construir mi clase MongoConfig. Además, hago uso de spring-cloud-starter-config
, que permite que mi archivo .yml lo pueda referenciar desde github.
Sin embargo, al ejecutar el aplicativo como SprinBootApplication, me genera una excepción ExceptionInInitializerError
en MongoTemplate.
Les compartiré el .yml, las clases que utilizo y la excepción generada:
En el archivo .yml estoy declarando no solo la URI, sino también los datos de conexión, aunque no los uso todos.
#HTTP Server
server:
port: ${PORT:7000}
#Discovery Server Access
eureka:
client:
service-url:
default-zone: http://localhost:8761/eureka
instance:
status-page-url-path: /infoMiClase
health-check-url-path: /healthMiClase
metadata-map:
app-owner: Georgina
description: Testing Microservice
spring:
data:
mongodb:
uri: mongodb://user:pass@localhost:27017/db_name
database: db_name
port: 27017
host: localhost
username: user
password: pass
Esta es la clase MongoConfig:
@Configuration
@EnableMongoRepositories("com.x.package")
public class MongoConfig extends AbstractMongoClientConfiguration {
@Value("${spring.data.mongodb.uri}")
private String uri;
@Value("${spring.data.mongodb.database}")
private String database;
@Bean
@Override
public MongoClient mongoClient() {
//conString = "mongodb://user:passw@localhost:port/db_name
return MongoClients.create(uri);
}
@Override
protected String getDatabaseName() {
return database;
}
@Override
protected String getMappingBasePackage() {
return "com.x.package";
}
@Bean
@Override
public MongoTemplate mongoTemplate() throws Exception {
return new MongoTemplate(mongoClient(), getDatabaseName());
}
@Bean
public MongoDbFactory dbFactoryBean() throws Exception {
MongoDbFactory dbFactoryBean = new SimpleMongoClientDbFactory(mongoClient(), database);
return dbFactoryBean;
}
}
Ya he probado con eliminar algunos de los métodos, agregar otros.. y aun asi el error generado es idéntico.
Por último, esta es mi clase Application:
@SpringBootApplication
@EnableDiscoveryClient
public class MyclassApplication {
public static void main(String[] args) {
SpringApplication.run(MyclassApplication.class, args);
}
}
Y en la consola se muestra el log con la excepción generada:
[INFO ] 2020-02-10 00:32:16 [restartedMain] ConfigServicePropertySourceLocator - Fetching config from server at : http://localhost:5000
[INFO ] 2020-02-10 00:32:17 [restartedMain] ConfigServicePropertySourceLocator - Located environment: name=x.package, profiles=[default], label=null, version=1099c5eddeec953f0a0f7ae271107c9bfef376e5, state=null
[INFO ] 2020-02-10 00:32:17 [restartedMain] PropertySourceBootstrapConfiguration - Located property source: CompositePropertySource {name='configService', propertySources=[MapPropertySource {name='configClient'}]}
[INFO ] 2020-02-10 00:32:18 [restartedMain] RepositoryConfigurationDelegate - Bootstrapping Spring Data MongoDB repositories in DEFAULT mode.
[INFO ] 2020-02-10 00:32:18 [restartedMain] RepositoryConfigurationDelegate - Finished Spring Data repository scanning in 77ms. Found 1 MongoDB repository interfaces.
[INFO ] 2020-02-10 00:32:18 [restartedMain] GenericScope - BeanFactory id=93880b7e-3900-3ff7-a938-2947239e7c50
[INFO ] 2020-02-10 00:32:19 [restartedMain] PostProcessorRegistrationDelegate$BeanPostProcessorChecker - Bean 'org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration' of type [org.springframework.cloud.autoconfigure.ConfigurationPropertiesRebinderAutoConfiguration$$EnhancerBySpringCGLIB$$73f21667] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying)
[INFO ] 2020-02-10 00:32:19 [restartedMain] TomcatWebServer - Tomcat initialized with port(s): 7000 (http)
[INFO ] 2020-02-10 00:32:19 [restartedMain] Http11NioProtocol - Initializing ProtocolHandler ["http-nio-7000"]
[INFO ] 2020-02-10 00:32:19 [restartedMain] StandardService - Starting service [Tomcat]
[INFO ] 2020-02-10 00:32:19 [restartedMain] StandardEngine - Starting Servlet engine: [Apache Tomcat/9.0.30]
[INFO ] 2020-02-10 00:32:19 [restartedMain] [/] - Initializing Spring embedded WebApplicationContext
[INFO ] 2020-02-10 00:32:19 [restartedMain] ContextLoader - Root WebApplicationContext: initialization completed in 2168 ms
[INFO ] 2020-02-10 00:32:19 [restartedMain] cluster - Cluster created with settings {hosts=[localhost:27017], mode=SINGLE, requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=500}
[INFO ] 2020-02-10 00:32:20 [cluster-ClusterId{value='5e40eae3e4e5e75d67d95154', description='null'}-localhost:27017] connection - Opened connection [connectionId{localValue:1, serverValue:41}] to localhost:27017
[INFO ] 2020-02-10 00:32:20 [cluster-ClusterId{value='5e40eae3e4e5e75d67d95154', description='null'}-localhost:27017] cluster - Monitor thread successfully connected to server with description ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[3, 6, 13]}, minWireVersion=0, maxWireVersion=6, maxDocumentSize=16777216, logicalSessionTimeoutMinutes=30, roundTripTimeNanos=3904400}
[WARN ] 2020-02-10 00:32:20 [restartedMain] AnnotationConfigServletWebServerApplicationContext - Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyclassController': Unsatisfied dependency expressed through field 'MyclassService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyclassService': Unsatisfied dependency expressed through field 'MyclassRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyclassRepository': Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [com/x/package/config/MongoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is java.lang.ExceptionInInitializerError
[INFO ] 2020-02-10 00:32:20 [restartedMain] StandardService - Stopping service [Tomcat]
[INFO ] 2020-02-10 00:32:20 [restartedMain] ConditionEvaluationReportLoggingListener -
[ERROR] 2020-02-10 00:32:20 [restartedMain] SpringApplication - Application run failed
org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyclassController': Unsatisfied dependency expressed through field 'MyclassService'; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyclassService': Unsatisfied dependency expressed through field 'MyclassRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyclassRepository': Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [com/x/package/config/MongoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 24 more
Caused by: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'MyclassService': Unsatisfied dependency expressed through field 'MyclassRepository'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyclassRepository': Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [com/x/package/config/MongoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor$AutowiredFieldElement.inject(AutowiredAnnotationBeanPostProcessor.java:643) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:116) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.annotation.AutowiredAnnotationBeanPostProcessor.postProcessProperties(AutowiredAnnotationBeanPostProcessor.java:399) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1422) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'MyclassRepository': Cannot resolve reference to bean 'mongoTemplate' while setting bean property 'mongoOperations'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [com/x/package/config/MongoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:342) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1699) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1444) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 24 more
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoTemplate' defined in class path resource [com/x/package/config/MongoConfig.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 24 more
Caused by: org.springframework.beans.BeanInstantiationException: Failed to instantiate [org.springframework.data.mongodb.core.MongoTemplate]: Factory method 'mongoTemplate' threw exception; nested exception is java.lang.ExceptionInInitializerError
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:185) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1699) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:1444) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:594) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.config.DependencyDescriptor.resolveCandidate(DependencyDescriptor.java:276) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 24 more
Caused by: java.lang.ExceptionInInitializerError
at java.text.RBTableBuilder.build(RBTableBuilder.java:107) ~[?:1.8.0_211]
at java.text.RBCollationTables.<init>(RBCollationTables.java:83) ~[?:1.8.0_211]
at java.text.RuleBasedCollator.<init>(RuleBasedCollator.java:300) ~[?:1.8.0_211]
at java.text.RuleBasedCollator.<init>(RuleBasedCollator.java:281) ~[?:1.8.0_211]
at sun.util.locale.provider.CollatorProviderImpl.getInstance(CollatorProviderImpl.java:106) ~[?:1.8.0_211]
at java.text.Collator.getInstance(Collator.java:242) ~[?:1.8.0_211]
at java.text.Collator.getInstance(Collator.java:224) ~[?:1.8.0_211]
at org.springframework.data.mongodb.core.convert.GeoConverters.<clinit>(GeoConverters.java:71) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.convert.MongoCustomConversions.<clinit>(MongoCustomConversions.java:55) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.getDefaultMongoConverter(MongoTemplate.java:2852) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:258) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:234) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at com.x.package.config.MongoConfig.mongoTemplate(MongoConfig.java:53) ~[classes/:?]
at com.x.package.config.MongoConfig$$EnhancerBySpringCGLIB$$745df10d.CGLIB$mongoTemplate$0(<generated>) ~[classes/:?]
at com.x.package.config.MongoConfig$$EnhancerBySpringCGLIB$$745df10d$$FastClassBySpringCGLIB$$3f5863e6.invoke(<generated>) ~[classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at com.x.package.config.MongoConfig$$EnhancerBySpringCGLIB$$745df10d.mongoTemplate(<generated>) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_211]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_211]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_211]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.lambda$doGetBean$0(AbstractBeanFactory.java:323) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:321) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:202) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveReference(BeanDefinitionValueResolver.java:330) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:113) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
... 24 more
Caused by: java.lang.RuntimeException: could not locate data
at sun.text.normalizer.NormalizerImpl.<clinit>(NormalizerImpl.java:60) ~[?:1.8.0_211]
at java.text.RBTableBuilder.build(RBTableBuilder.java:107) ~[?:1.8.0_211]
at java.text.RBCollationTables.<init>(RBCollationTables.java:83) ~[?:1.8.0_211]
at java.text.RuleBasedCollator.<init>(RuleBasedCollator.java:300) ~[?:1.8.0_211]
at java.text.RuleBasedCollator.<init>(RuleBasedCollator.java:281) ~[?:1.8.0_211]
at sun.util.locale.provider.CollatorProviderImpl.getInstance(CollatorProviderImpl.java:106) ~[?:1.8.0_211]
at java.text.Collator.getInstance(Collator.java:242) ~[?:1.8.0_211]
at java.text.Collator.getInstance(Collator.java:224) ~[?:1.8.0_211]
at org.springframework.data.mongodb.core.convert.GeoConverters.<clinit>(GeoConverters.java:71) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.convert.MongoCustomConversions.<clinit>(MongoCustomConversions.java:55) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.getDefaultMongoConverter(MongoTemplate.java:2852) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:258) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at org.springframework.data.mongodb.core.MongoTemplate.<init>(MongoTemplate.java:234) ~[spring-data-mongodb-2.2.4.RELEASE.jar:2.2.4.RELEASE]
at com.x.package.config.MongoConfig.mongoTemplate(MongoConfig.java:53) ~[classes/:?]
at com.x.package.config.MongoConfig$$EnhancerBySpringCGLIB$$745df10d.CGLIB$mongoTemplate$0(<generated>) ~[classes/:?]
at com.x.package.config.MongoConfig$$EnhancerBySpringCGLIB$$745df10d$$FastClassBySpringCGLIB$$3f5863e6.invoke(<generated>) ~[classes/:?]
at org.springframework.cglib.proxy.MethodProxy.invokeSuper(MethodProxy.java:244) ~[spring-core-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.context.annotation.ConfigurationClassEnhancer$BeanMethodInterceptor.intercept(ConfigurationClassEnhancer.java:363) ~[spring-context-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at com.x.package.config.MongoConfig$$EnhancerBySpringCGLIB$$745df10d.mongoTemplate(<generated>) ~[classes/:?]
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) ~[?:1.8.0_211]
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) ~[?:1.8.0_211]
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) ~[?:1.8.0_211]
at java.lang.reflect.Method.invoke(Method.java:498) ~[?:1.8.0_211]
at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:154) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:651) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:636) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateUsingFactoryMethod(AbstractAutowireCapableBeanFactory.java:1338) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:1177) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:557) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:517) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at
... 24 more
Como se puede ver en la línea 15 y 16 de la consola, si se realiza la conexión con Mongo, pero luego se genera el error y se termina el proceso. Estoy usando spring-boot-starter-parent
con versión 2.2.3.RELEASE
.
Le ha pasado a alguien algo similar? Yo sospecho que es una configuración mínima que estoy pasando por alto y no me doy cuenta :( Gracias por su ayuda!
uri: mongodb://user:pass@localhost:27017/db_name
o quitasdatabase
al config