我得到一个例外,在我的盒子里部署一个战争,它在另一个工作正常

时间:2013-07-12 13:19:47

标签: java linux tomcat deployment war

我有一个Linux盒子,里面有最新版本的Java(java / jdk1.7.0_25)和tomcat(apache-tomcat-7.0.42)。当我部署战争时,我得到:

ERROR 2013-07-12 09:55:36,591: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'engageOrderConfig': Invocation of init method failed; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'deliveryDtoToEngageRetailTransactionDelivery': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: com.company.engage.adapter.converter.customer.CustomerDTOToRetailTransactionCustomerExtension com.company.engage.order.adapter.converter.DeliveryDtoToEngageRetailTransactionDelivery.customerConverter; nested exception is org.springframework.beans.factory.NoSuchBeanDefinitionException: No matching bean of type [com.company.engage.adapter.converter.customer.CustomerDTOToRetailTransactionCustomerExtension] found for dependency: expected at least 1 bean which qualifies as autowire candidate for this dependency. Dependency annotations: {@org.springframework.beans.factory.annotation.Autowired(required=true)}

还有其他一些......

事情是在另一个linux盒子中部署这场战争,它没有任何问题。

我尝试了几个版本的tomcat,我改为OpenJDK。另外,我从linux框中复制了tomcat,它正在部署jar而没有错误,我也遇到了同样的错误。

任何人都能对此有所了解吗?

修改:Full Stacktrace

1 个答案:

答案 0 :(得分:0)

将注释限定符添加到bean中的依赖项 例如:

public interface I{

}

public class IImpl1 implements I {
}

public class IImpl2 implements I {
}

class A {
//Without qualifier the exception that you see will be thrown
@Qualifier("impl1")

@Autowired
private I i;
}