我遇到了一个spring bean配置问题(r3.2.2)。 应用程序在weblogic 10.3.5上运行,在项目启动时,我在下面的stacktrace中得到以下内容。在阅读其他一些帖子时,必须有一个数组构造函数。
任何人都知道为什么我会得到这个堆栈跟踪?
谢谢
Bean 'union.marshaller'
-> Constructor-arg
at org.springframework.beans.factory.parsing.FailFastProblemReporter.error(FailFastProblemReporter.java:68)
at org.springframework.beans.factory.parsing.ReaderContext.error(ReaderContext.java:85)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.error(BeanDefinitionParserDelegate.java:288)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:490)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:389)
at org.springframework.beans.factory.xml.BeanDefinitionParserDelegate.parseBeanDefinitionElement(BeanDefinitionParserDelegate.java:358)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.processBeanDefinition(DefaultBeanDefinitionDocumentReader.java:239)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseDefaultElement(DefaultBeanDefinitionDocumentReader.java:153)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.parseBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:132)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.registerBeanDefinitions(DefaultBeanDefinitionDocumentReader.java:92)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.registerBeanDefinitions(XmlBeanDefinitionReader.java:507)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:398)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:342)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:310)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:143)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:178)
at org.springframework.beans.factory.xml.DefaultBeanDefinitionDocumentReader.importBeanDefinitionResource(DefaultBeanDefinitionDocumentReader.java:174)
... 61 more
Caused by: org.springframework.beans.factory.parsing.BeanDefinitionParsingException: Configuration problem: Unknown property sub-element: [array]
我的xml配置:
<!-- custom marshaller to make union of 2 interfaces -->
<bean id="union.marshaller" class="be.test.jaxb.MergedJaxb2Marshaller">
<constructor-arg>
<array>
<ref bean="m1.marshaller"/>
<ref bean="m2.marshaller"/>
<ref bean="m3.marshaller"/>
</array>
</constructor-arg>
</bean>
我的课程:
package be.test.jaxb;
import org.springframework.oxm.jaxb.Jaxb2Marshaller;
import org.springframework.util.Assert;
public class MergedJaxb2Marshaller
extends Jaxb2Marshaller
{
private static final String COLON = ":";
public MergedJaxb2Marshaller(Jaxb2Marshaller... marshallers)
{
Assert.notNull(marshallers, "marshallers not valid [null]");
setContextPath(toMergedContextPath(marshallers));
}
private String toMergedContextPath(Jaxb2Marshaller... marshallers)
{
Assert.notNull(marshallers, "marshallers not valid [null]");
StringBuilder sb = new StringBuilder();
for (int i = 0; i < marshallers.length; i++) {
if (i == 0) {
sb.append(marshallers[i].getContextPath());
} else {
sb.append(":").append(marshallers[i].getContextPath());
}
}
return sb.toString();
}
}
我在发布此问题时已尝试使用列表(Declaring an array of objects in a Spring bean context)。但后来我得到以下内容:
引起:java.lang.NoSuchMethodError:org.springframework.util.xml.DomUtils.getChildElements(Lorg / w3c / dom / Element;)Ljava / util / List; 在org.springframework.ws.config.InterceptorsBeanDefinitionParser.parse(InterceptorsBeanDefinitionParser.java:52)