Ошибка при подключении к кластеру DocumentDB - PullRequest
0 голосов
/ 26 сентября 2019

Я создал образ докера, когда я запускаю этот образ докера, я получаю ошибку ниже на сервере.Пожалуйста, помогите мне, если с этой проблемой я пробовал это в течение 2-3 дней ... Но не смог найти никакого решения.

11:59:28,436 ERROR [org.jboss.msc.service.fail] (MSC service thread 1-1) MSC000001: Failed to start service jboss.undertow.deployment.default-server.default-host./giftregistry: org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./giftregistry: Failed to start service
        at org.jboss.msc.service.ServiceControllerImpl$StartTask.run(ServiceControllerImpl.java:1904) [jboss-msc-1.2.2.Final.jar:1.2.2.Final]
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1152) [rt.jar:1.7.0_201]
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:622) [rt.jar:1.7.0_201]
        at java.lang.Thread.run(Thread.java:748) [rt.jar:1.7.0_201]
Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'createRegistryController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private com.giftregistry.services.RegistryService com.giftregistry.controller.CreateRegistryController.registryService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'RegistryService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.giftregistry.dao.RegistryRepository com.giftregistry.services.RegistryServiceImpl.registryRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'registryRepositoryImpl': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private org.springframework.data.mongodb.core.MongoTemplate com.giftregistry.dao.RegistryRepositoryImpl.mongoOperation; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoOperation' defined in URL [file:////opt/jboss/wildfly/standalone/configuration/persistence.xml]: Cannot resolve reference to bean 'mongoDbFactory' while setting constructor argument; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'mongoDbFactory': Cannot resolve reference to bean 'mongo' while setting constructor argument; nested exception is org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongo' defined in URL [file:////opt/jboss/wildfly/standalone/configuration/persistence.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.mongodb.MongoAuthority]: Could not convert constructor argument value of type [java.util.ArrayList] to required type [com.mongodb.MongoAuthority]: Failed to convert value of type 'java.util.ArrayList' to required type 'com.mongodb.MongoAuthority'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.util.ArrayList] to required type [com.mongodb.MongoAuthority]: no matching editors or conversion strategy found
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongo' defined in URL [file:////opt/jboss/wildfly/standalone/configuration/persistence.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [com.mongodb.ServerAddress]: Could not convert constructor argument value of type [java.util.ArrayList] to required type [com.mongodb.ServerAddress]: Failed to convert value of type 'java.util.ArrayList' to required type 'com.mongodb.ServerAddress'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.util.ArrayList] to required type [com.mongodb.ServerAddress]: no matching editors or conversion strategy found
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongo' defined in URL [file:////opt/jboss/wildfly/standalone/configuration/persistence.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.lang.String]: Could not convert constructor argument value of type [java.util.ArrayList] to required type [java.lang.String]: Failed to convert value of type 'java.util.ArrayList' to required type 'java.lang.String'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.util.ArrayList] to required type [java.lang.String]: no matching editors or conversion strategy found
Related cause: org.springframework.beans.factory.UnsatisfiedDependencyException: Error creating bean with name 'mongo' defined in URL [file:////opt/jboss/wildfly/standalone/configuration/persistence.xml]: Unsatisfied dependency expressed through constructor argument with index 0 of type [java.util.List]: Could not convert constructor argument value of type [java.util.ArrayList] to required type [java.util.List]: Failed to convert value of type 'java.util.ArrayList' to required type 'java.util.List'; nested exception is java.lang.IllegalStateException: Cannot convert value of type [java.lang.String] to required type [com.mongodb.ServerAddress]: no matching editors or conversion strategy found

Конфигурация XML для mongoTemplate, используемого в JAVA:


        <bean id="mongo" class="com.mongodb.Mongo">
                <constructor-arg>
                <list>
                        <value>mongodb://dbUser:password@giftregistry-db.cluster-c3ekl0nftuic.us-east-2.docdb.amazonaws.com:27017/?replicaSet=rs0</value>
                </list>
                </constructor-arg>
                <constructor-arg name="options" ref="mongoOptions"/>
        </bean>
        <bean id="mongoOptions" class="com.mongodb.MongoOptions">
                <property name="connectionsPerHost" value="40"></property>
                <property name="threadsAllowedToBlockForConnectionMultiplier" value="10"></property>
                <property name="connectTimeout" value="15000"></property>
                <property name="maxWaitTime" value="60000"></property>
                <property name="autoConnectRetry" value="true"></property>
                <property name="socketKeepAlive" value="true"></property>
                <property name="socketTimeout" value="60000"></property>
        </bean>

        <mongo:db-factory id="mongoDbFactory" dbname="giftRegistry" mongo-ref="mongo" />

        <bean id="mappingMongoConverter" class="org.springframework.data.mongodb.core.convert.MappingMongoConverter">
                <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
                <constructor-arg name="mappingContext">
                        <bean class="org.springframework.data.mongodb.core.mapping.MongoMappingContext" />
                </constructor-arg>
                <property name="typeMapper">
                        <bean class="org.springframework.data.mongodb.core.convert.DefaultMongoTypeMapper">
                                <constructor-arg name="typeKey">
                                        <null />
                                </constructor-arg>
                        </bean>
                </property>
        </bean>

        <bean id="mongoOperation" class="org.springframework.data.mongodb.core.MongoTemplate">
                <constructor-arg name="mongoDbFactory" ref="mongoDbFactory" />
                <constructor-arg name="mongoConverter" ref="mappingMongoConverter" />
        </bean>
...