0 0

SPRING配置:org.springframework.beans.factory.BeanDefinitionStoreException5

同样的配置,我换了个工程,就报SPRING 配置文件错了.包我都导入了.
测试用例:
 
import java.util.HashMap;
import java.util.List;
import java.util.Map;
 
import junit.framework.TestCase;

import org.springframework.beans.factory.BeanFactory;
import org.springframework.context.support.ClassPathXmlApplicationContext;

import com.mylink.javacommon.util.SpringContextUtil;
import cn.org.rapid_framework.page.Page;
import cn.org.rapid_framework.page.PageRequest;



public class Test extends TestCase {

	private SpringContextUtil springContextUtil;

	protected void setUp() throws Exception {
		String[] param = new String[] {
				"spring/applicationContext-service.xml",
				"spring/applicationContext-resource.xml",
				"spring/applicationContext-ibatis3-dao.xml"  };
		ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(
				param);
		BeanFactory factory = context.getBeanFactory();
		// test = (Test) factory.getBean("testAction");
		springContextUtil = (SpringContextUtil) factory
				.getBean("SpringContextUtil");
		super.setUp();
	}

	protected void tearDown() throws Exception {
		if (null != springContextUtil) {
			springContextUtil = null;
		}
		super.tearDown();
	}

	public void testFindBusiByPageRequest() throws Exception {
		myTest();
	}
	/**
	 * 测试 入口
	*/
	private void myTest(){
		
	}
 
}



配置文件:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans"
	xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
	xmlns:context="http://www.springframework.org/schema/context"
	xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd"    default-autowire="byName" default-lazy-init="false">

 
	<context:component-scan base-package="com.*.infocenter.service.*.impl" />
	
	<context:component-scan base-package="com.*.feecenter.service.*.impl" />
	
	<context:component-scan base-package="com.mylink.infocenter.facade" /> 
	
 	<bean id="SpringContextUtil" class="com.mylink.javacommon.util.SpringContextUtil">
	</bean>

</beans>




************************************** 错误信息 **********************
org.springframework.beans.factory.BeanDefinitionStoreException: Line 6 in XML document from class path resource [spring/applicationContext-service.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.createSAXParseException(ErrorHandlerWrapper.java:195)
at com.sun.org.apache.xerces.internal.util.ErrorHandlerWrapper.error(ErrorHandlerWrapper.java:131)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:384)
at com.sun.org.apache.xerces.internal.impl.XMLErrorReporter.reportError(XMLErrorReporter.java:318)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.rootElementSpecified(XMLDTDValidator.java:1621)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.handleStartElement(XMLDTDValidator.java:1900)
at com.sun.org.apache.xerces.internal.impl.dtd.XMLDTDValidator.startElement(XMLDTDValidator.java:764)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanStartElement(XMLDocumentFragmentScannerImpl.java:1363)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$ContentDriver.scanRootElementHook(XMLDocumentScannerImpl.java:1318)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl$FragmentContentDriver.next(XMLDocumentFragmentScannerImpl.java:3103)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl$PrologDriver.next(XMLDocumentScannerImpl.java:922)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentScannerImpl.next(XMLDocumentScannerImpl.java:648)
at com.sun.org.apache.xerces.internal.impl.XMLDocumentFragmentScannerImpl.scanDocument(XMLDocumentFragmentScannerImpl.java:511)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:808)
at com.sun.org.apache.xerces.internal.parsers.XML11Configuration.parse(XML11Configuration.java:737)
at com.sun.org.apache.xerces.internal.parsers.XMLParser.parse(XMLParser.java:119)
at com.sun.org.apache.xerces.internal.parsers.DOMParser.parse(DOMParser.java:235)
at com.sun.org.apache.xerces.internal.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:284)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:222)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:173)
at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:148)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:126)
at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:142)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:113)
at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicationContext.java:81)
at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:89)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:269)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
at Test.setUp(Test.java:26)
at junit.framework.TestCase.runBare(TestCase.java:132)
at junit.framework.TestResult$1.protect(TestResult.java:110)
at junit.framework.TestResult.runProtected(TestResult.java:128)
at junit.framework.TestResult.run(TestResult.java:113)
at junit.framework.TestCase.run(TestCase.java:124)
at junit.framework.TestSuite.runTest(TestSuite.java:232)
at junit.framework.TestSuite.run(TestSuite.java:227)
at org.junit.internal.runners.JUnit38ClassRunner.run(JUnit38ClassRunner.java:83)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.run(JUnit4TestReference.java:38)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(TestExecution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:460)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:673)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:386)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)

******************************************************************************************

问题补充:
enet_java 写道
引用
org.springframework.beans.factory.BeanDefinitionStoreException: Line 6 in XML document from class path resource [spring/applicationContext-service.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".


前后两次的使用的jar文件是一致的吗?

enet_java 写道
引用
org.springframework.beans.factory.BeanDefinitionStoreException: Line 6 in XML document from class path resource [spring/applicationContext-service.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".


前后两次的使用的jar文件是一致的吗?



原来问题是:做webservice 时,xFie 里面打了一个spring 1.2 的包, 所以不认这种写法.
不过还是谢谢你.

问题补充:
shankezgp 写道
详细问题请咨询  http://shyboy10228.blog.163.com/



已经处理好了.谢谢各位
2010年10月18日 14:41

1个答案 按时间排序 按投票排序

0 0

采纳的答案

引用
org.springframework.beans.factory.BeanDefinitionStoreException: Line 6 in XML document from class path resource [spring/applicationContext-service.xml] is invalid; nested exception is org.xml.sax.SAXParseException: Document root element "beans", must match DOCTYPE root "null".


前后两次的使用的jar文件是一致的吗?

2010年10月18日 14:45

相关推荐

    org.spring-framework-3.0.4. 所有jar

    org.springframework.beans-3.0.4.RELEASE.jar org.springframework.context.support-3.0.4.RELEASE.jar org.springframework.context-3.0.4.RELEASE.jar org.springframework.core-3.0.4.RELEASE.jar org....

    spring-beans-5.2.0.RELEASE-API文档-中英对照版.zip

    Maven坐标:org.springframework:spring-beans:5.2.0.RELEASE; 标签:springframework、spring、beans、中英对照文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览...

    spring-beans-5.0.10.RELEASE-API文档-中文版.zip

    Maven坐标:org.springframework:spring-beans:5.0.10.RELEASE; 标签:spring、beans、springframework、jar包、java、API文档、中文版; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可...

    解决SpringDataJPA报错:org.hibernate.HibernateException: Access to DialectResolutionInfo cannot be null w

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'entityManagerFactory' defined in class path resource [org/springframework/boot/autoconfigure/orm/jpa/...

    org.springframework.transaction-3.1.2.RELEASE.zip

    org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'org.springframework.transaction.interceptor.TransactionInterceptor#0': Error setting property values; nested ...

    spring3.0.5 所有jar文件

    org.springframework.beans-3.0.5.RELEASE.jar org.springframework.context-3.0.5.RELEASE.jar org.springframework.context.support-3.0.5.RELEASE.jar org.springframework.core-3.0.5.RELEASE.jar org.spring...

    spring-beans-5.2.0.RELEASE-API文档-中文版.zip

    Maven坐标:org.springframework:spring-beans:5.2.0.RELEASE; 标签:springframework、spring、beans、中文文档、jar包、java; 使用方法:解压翻译后的API文档,用浏览器打开“index.html”文件,即可纵览文档...

    org.springframework.beans.factory.config.PropertyPlaceholderConfigurer

    `org.springframework.beans.factory.config.PropertyPlaceholderConfigurer` 是Spring框架中的一个重要组件,主要负责处理配置文件中的占位符替换。这个类是Spring在初始化bean时用来解析和注入环境变量或系统属性...

    测试spring中的org.springframework.beans.factory.InitializingBean

    在Spring框架中,`org.springframework.beans.factory.InitializingBean`接口是一个非常重要的概念,它用于标记那些需要在初始化完成后执行特定逻辑的bean。这个接口只包含一个方法:`afterPropertiesSet()`,当bean...

    asm-3.2.3.jar

    org.springframework.beans.factory org.springframework.beans.factory.access org.springframework.beans.factory.access.el org.springframework.beans.factory.annotation org.springframework.beans.factory....

    spring-framework-4.0.2.RELEASE官方完整包加官方文档

    总的来说,Spring Framework 4.0.2.RELEASE是一个强大且成熟的版本,它提供了全面的开发工具和功能,覆盖了从基础服务到复杂应用的各种需求。无论你是初学者还是经验丰富的开发者,这个版本都提供了丰富的资源来提升...

    org.springframework.flex-1.0.3.RELEASE.jar.zip

    org.springframework.flex-1.0.3.RELEASE.jar.zip用于JAR包,org.springframework.flex-1.0.3.RELEASE.jar.zip用于JAR包org.springframework.flex-1.0.3.RELEASE.jar.zip用于JAR包org.springframework.flex-1.0.3....

    resolver_java_wsdl.jar

    at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:142) ... 38 more Caused by: java.lang.ClassNotFoundException: ...

    org.springframework.web.servlet-3.0.1.RELEASE-A.jar

    nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'userController' defined in ServletContext resource [/WEB-INF/springMVC-servlet.xml]: Error ...

    spring boot exception handler.zip

    Spring Boot通过`logging`配置允许我们定制异常的日志级别和格式,以便更好地跟踪和诊断问题。 9. **单元测试异常处理** 在编写单元测试时,可以使用`assertThrows`或`expectThrows`断言来验证方法是否抛出预期的...

    spring3.0.0相关jar包

    org.springframework.beans-3.0.0.RELEASE org.springframework.context.support-3.0.0.RELEASE org.springframework.context-3.0.0.RELEASE org.springframework.core-3.0.0.RELEASE org.springframework....

    org.springframework.web.jar

    9. **Integration with other Spring Modules**:`org.springframework.web.jar`与Spring框架的其他模块紧密集成,如Spring Core、Spring Beans、Spring AOP等,共同构建出一个完整的应用框架。 总的来说,`org....

    spring3.1 官方全部jar包

    org.springframework.beans-3.1.RELEASE.jar org.springframework.context.support-3.1.RELEASE.jar org.springframework.context-3.1.RELEASE.jar org.springframework.core-3.1.RELEASE.jar org.spring...

    spring3.1.1jar及其关联jar

    org.springframework.beans-3.1.1.RELEASE org.springframework.context.support-3.1.1.RELEASE org.springframework.context-3.1.1.RELEASE org.springframework.core-3.1.1.RELEASE org.springframework....

    Spring所需jar包

    org.springframework.beans-3.0.0.RELEASE.jar org.springframework.context.support-3.0.0.RELEASE.jar org.springframework.context-3.0.0.RELEASE.jar org.springframework.core-3.0.0.RELEASE.jar org.spring...

Global site tag (gtag.js) - Google Analytics