日期:2014-05-17  浏览次数:20637 次

struts2+hibernate配置异常问题
org.hibernate.InvalidMappingException: Could not parse mapping document from file hibernate.cfg.xml
org.hibernate.cfg.Configuration.addFile(Configuration.java:291)
com.test.action.LoginAction.execute(LoginAction.java:34)
sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
java.lang.reflect.Method.invoke(Unknown Source)
com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:440)
com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:279)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:242)
com.opensymphony.xwork2.interceptor.DefaultWorkflowInterceptor.doIntercept(DefaultWorkflowInterceptor.java:163)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.validator.ValidationInterceptor.doIntercept(ValidationInterceptor.java:249)
org.apache.struts2.interceptor.validation.AnnotationValidationInterceptor.doIntercept(AnnotationValidationInterceptor.java:68)
com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:87)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)
com.opensymphony.xwork2.interceptor.ConversionErrorInterceptor.intercept(ConversionErrorInterceptor.java:122)
com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:236)


控制台的
信息: Server startup in 1727 ms
11625 [http-8081-2] INFO cfg.Environment - Hibernate 3.2.0
11625 [http-8081-2] INFO cfg.Environment - loaded properties from resource hibernate.properties: {hibernate.connection.password=****, hibernate.c3p0.acquire_increment=2, hibernate.c3p0.idle_test_period=1000, hibernate.show_sql=false, hibernate.c3p0.checkoutTimeout=40000, hibernate.c3p0.max_statements=200, hibernate.jdbc.batch_size=25, hibernate.bytecode.use_reflection_optimizer=false, hibernate.jdbc.fetch_size=25, hibernate.c3p0.validate=false, hibernate.c3p0.timeout=120, hibernate.c3p0.min_size=0, hibernate.format_sql=false, hibernate.connection.username=root, hibernate.transaction.auto_close_session=true, hibernate.connection.driver_class=com.mysql.jdbc.ReplicationDriver, hibernate.current_session_context_class=thread, hibernate.c3p0.max_size=10, hibernate.connection.provider_class=org.hibernate.connection.C3P0ConnectionProvider, hibernate.transaction.factory_class=org.hibernate.transaction.JDBCTransactionFactory, hibernate.dialect=org.hibernate.dialect.MySQLDialect, hibernate.connection.url=jdbc:mysql://localhost:3306/logindb?characterEncoding=gb2312}
11625 [http-8081-2] INFO cfg.Environment - Bytecode provider name : cglib
11640 [http-8081-2] INFO cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
11750 [http-8081-2] INFO cfg.Configuration - configuring from resource: /hibernate.cfg.xml
11750 [http-8081-2] INFO cfg.Configuration - Configuration resource: /hibernate.cfg.xml
11859 [http-8081-2] INFO cfg.Configuration - Reading mappings from resource: com/test/model/logindb.hbm.xml
11984 [http-8081-2] INFO cfg.HbmBinder - Mapping class: com.test.action.LoginAction -> customer
12015 [http-8081-2] INFO cfg.Configuration - Configured SessionFactory: null
12015 [http-8081-2] INFO cfg.Configuration - Reading mappings from file: hibernate.cfg.xml



/practice/src/hibernate.cfg.xml: