Cloud foundry Cloudfoundry&x2B;SpringData&x2B;MongoDB…可以';不部署

Cloud foundry Cloudfoundry&x2B;SpringData&x2B;MongoDB…可以';不部署,cloud-foundry,vmc,spring-data-mongodb,Cloud Foundry,Vmc,Spring Data Mongodb,我有一个基于Spring数据和MongoDB的简单项目。当我使用以下Spring上下文将此项目部署到云时: <?xml version="1.0" encoding="UTF-8"?> http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/cont

我有一个基于Spring数据和MongoDB的简单项目。当我使用以下Spring上下文将此项目部署到云时:

<?xml version="1.0" encoding="UTF-8"?>

http://www.springframework.org/schema/aop/spring-aop-3.1.xsd http://www.springframework.org/schema/beans http://www.springframework.org/schema/context http://www.springframework.org/schema/jee http://www.springframework.org/schema/tx http://schema.cloudfoundry.org/spring http://www.springframework.org/schema/data/jpa http://www.springframework.org/schema/util http://www.springframework.org/schema/data/mongo “>


resource.loader=class
class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader


它失败于:


原因:org.springframework.beans.beans实例化异常:无法实例化bean类[org.springframework.data.mongodb.core.MongoTemplate]:构造函数引发异常;嵌套异常为java.lan
.IllegalArgumentException:[断言失败]-此参数是必需的;它不能为null
位于org.springframework.beans.BeanUtils.InstanceClass(BeanUtils.java:162)
位于org.springframework.beans.factory.support.SimpleInstallationStrategy.instantiate(SimpleInstallationStrategy.java:110)
位于org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
…还有68个
原因:java.lang.IllegalArgumentException:[断言失败]-此参数是必需的;它不能为null
位于org.springframework.util.Assert.notNull(Assert.java:112)
位于org.springframework.util.Assert.notNull(Assert.java:123)
位于org.springframework.data.mongodb.core.MongoTemplate(MongoTemplate.java:196)
位于org.springframework.data.mongodb.core.MongoTemplate(MongoTemplate.java:185)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance0(本机方法)
位于sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
在sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
位于java.lang.reflect.Constructor.newInstance(Constructor.java:513)
位于org.springframework.beans.BeanUtils.InstanceClass(BeanUtils.java:147)
…70多个
正在停止Tomcat,因为上下文已停止

它在一个月前就开始工作了。API有什么变化


谢谢

您的问题似乎是运行时jar。请尝试使用最新的cloudfoundry运行时。

问题是运行时jar用户。我使用的是cloudfoundry-runtime-0.8.1,而最新版本是0.8.2。已解决。我在推送socket时收到连接到mongodb的错误。我必须添加cloudfoundry依赖项吗?
<context:property-placeholder location="classpath:services.properties" />

<context:annotation-config />

<bean id="gadgetizerApplication" class="it.ids.gadgetizer.GadgetizerApplication">
</bean>

<bean id="gadgetizerService" class="it.ids.gadgetizer.service.impl.GadgetServiceImpl">
    <property name="mongoTemplate" ref="mongoTemplate" />
    <property name="mailSender" ref="mailSender"/>
    <property name="velocityEngine" ref="velocityEngine"/>      
</bean>

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

<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
    <property name="host" value="mail.xxx.xxx" />   
    <property name="username" value="xxx"/>
    <property name="password" value="xxx"/>
    <property name="port" value="2525"/>
</bean>

<bean id="velocityEngine" class="org.springframework.ui.velocity.VelocityEngineFactoryBean">
  <property name="velocityProperties">
     <value>
      resource.loader=class
      class.resource.loader.class=org.apache.velocity.runtime.resource.loader.ClasspathResourceLoader
     </value>
  </property>
<beans profile="development">
    <mongo:db-factory id="mongoDbFactory" dbname="${mongo.dbname}" host="${mongo.host}" port="${mongo.port}" />
</beans>

<beans profile="cloud">
    <cloud:mongo-db-factory id="mongoDbFactory" service-name="${mongo.cloud.service_name}" />
</beans>

Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.data.mongodb.core.MongoTemplate]: Constructor threw exception; nested exception is java.lan
.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:162)
        at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:110)
        at org.springframework.beans.factory.support.ConstructorResolver.autowireConstructor(ConstructorResolver.java:280)
        ... 68 more
Caused by: java.lang.IllegalArgumentException: [Assertion failed] - this argument is required; it must not be null
        at org.springframework.util.Assert.notNull(Assert.java:112)
        at org.springframework.util.Assert.notNull(Assert.java:123)
        at org.springframework.data.mongodb.core.MongoTemplate.(MongoTemplate.java:196)
        at org.springframework.data.mongodb.core.MongoTemplate.(MongoTemplate.java:185)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
        at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:147)
        ... 70 more
Stopping Tomcat because the context stopped.