spring 配置文件
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<tx:advice id="txAdvice" transaction-manager="myHibTransactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="fooServiceOperation" expression="execution(* crm.nuandong.biz.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="fooServiceOperation" />
</aop:config> <bean id="myHibTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 数据库连接信息配置开始 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:SqlMapConfig.xml">
</property>
</bean>
<!-- 数据库连接信息配置结束 --> <!-- myeclipse自动生成的hibernate的配置信息 开始 -->
<bean id="AddressConfigDAO" class="crm.nuandong.dao.impl.hibernate.AddressConfigDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!--
///////////////////////////////////////////////////////////////////////////
///////////////////////////以下为 biz配置信息////////////////////////////////
///////////////////////////////////////////////////////////////////////////
-->
<bean id="AddressConfigBiz" class="crm.nuandong.biz.impl.AddressConfigBizImpl">
<property name="addressConfigDao" ref="AddressConfigDAO"></property>
</bean>
<!--
///////////////////////////////////////////////////////////////////////////
/////////////////////////以下为 action配置信息///////////////////////////////
///////////////////////////////////////////////////////////////////////////
--> <bean id="AddressConfigAction" class="crm.nuandong.action.AddressConfigAction"
autowire="byType" /> <!-- compass2.2 start -->
<bean id="annotationConfiguration"
class="org.compass.annotations.config.CompassAnnotationsConfiguration"></bean>
<bean id="compass" class="org.compass.spring.LocalCompassBean">
<property name="resourceDirectoryLocations">
<list>
<value>classpath:crm/nuandong</value>
</list>
</property>
<!-- anontaition式设置 -->
<property name="classMappings">
<list>
<value>crm.nuandong.pojo.Customer</value> </list>
</property>
<property name="compassConfiguration" ref="annotationConfiguration" />
<property name="compassSettings">
<props>
<prop key="compass.transaction.factory">
org.compass.spring.transaction.SpringSyncTransactionFactory</prop>
<prop key="compass.engine.highlighter.default.formatter.simple.pre"><![CDATA[<b><font color='red'>]]></prop>
<prop key="compass.engine.highlighter.default.formatter.simple.post"><![CDATA[</font></b>]]></prop>
<!-- 定义索引的存储位置 -->
<!--
<prop
key="compass.engine.connection">file://${user.home}/springside/compass</prop>
-->
<prop key="compass.engine.connection">/lucene/indexes</prop>
<!-- 定义分词器 -->
<!--
<prop
key="compass.engine.analyzer.MMAnalyzer.CustomAnalyzer">net.paoding.analysis.analyzer.PaodingAnalyzer
</prop>
-->
<prop key="compass.engine.analyzer.MMAnalyzer.CustomAnalyzer">org.mira.lucene.analysis.IK_CAnalyzer
</prop>
</props>
</property>
<property name="transactionManager" ref="myHibTransactionManager" />
</bean>
<bean id="hibernateGpsDevice"
class="org.compass.spring.device.hibernate.dep.SpringHibernate3GpsDevice">
<property name="name">
<value>hibernateDevice</value>
</property>
<property name="sessionFactory" ref="sessionFactory" />
<!--
<property name="mirrorDataChanges"> <value>true</value> </property>
-->
</bean>
<!-- 同步更新索引 -->
<bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps"
init-method="start" destroy-method="stop">
<property name="compass" ref="compass" />
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice" />
</list>
</property>
</bean>
<bean id="compassTemplate" class="org.compass.core.CompassTemplate">
<property name="compass" ref="compass" />
</bean>
<!-- 定时重建索引(利用quartz)或随Spring ApplicationContext启动而重建索引 -->
<bean id="compassIndexBuilder" class="crm.nuandong.dao.impl.compass.CompassIndexBuilder"
lazy-init="false">
<property name="compassGps" ref="compassGps" />
<property name="buildIndex" value="true" />
<property name="lazyTime" value="10" />
</bean>
<!-- compass2.2 end -->
</beans>hibernate配置文件<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="connection.url">
jdbc:sqlserver://localhost:1433
</property>
<property name="connection.username">sa</property>
<property name="connection.driver_class">
com.microsoft.sqlserver.jdbc.SQLServerDriver
</property> <property name="myeclipse.connection.profile">sqlserver</property>
<property name="show_sql">true</property>
<mapping resource="crm/nuandong/pojo/hibernate/UserDepartment.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/OrderDetail.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Product.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerLinkman.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Customer.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmulantMenaceRank.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/UserRole.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/ServiceType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/AddressConfig.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmulantCompanyType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmulantDynamic.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/ProductType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerPlan.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Roles.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/UserInfo.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmailConfig.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Emulant.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/OrderInfo.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerIndustry.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Service.hbm.xml" />
</session-factory></hibernate-configuration>
<?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:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="
http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd
http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd
http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd">
<tx:advice id="txAdvice" transaction-manager="myHibTransactionManager">
<tx:attributes>
<tx:method name="get*" read-only="true" />
<tx:method name="*" />
</tx:attributes>
</tx:advice>
<aop:config>
<aop:pointcut id="fooServiceOperation" expression="execution(* crm.nuandong.biz.*.*(..))" />
<aop:advisor advice-ref="txAdvice" pointcut-ref="fooServiceOperation" />
</aop:config> <bean id="myHibTransactionManager"
class="org.springframework.orm.hibernate3.HibernateTransactionManager">
<property name="sessionFactory" ref="sessionFactory"></property>
</bean>
<!-- 数据库连接信息配置开始 -->
<bean id="sessionFactory"
class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation" value="classpath:hibernate.cfg.xml">
</property>
</bean>
<bean id="sqlMapClient" class="org.springframework.orm.ibatis.SqlMapClientFactoryBean">
<property name="configLocation" value="classpath:SqlMapConfig.xml">
</property>
</bean>
<!-- 数据库连接信息配置结束 --> <!-- myeclipse自动生成的hibernate的配置信息 开始 -->
<bean id="AddressConfigDAO" class="crm.nuandong.dao.impl.hibernate.AddressConfigDAO">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<!--
///////////////////////////////////////////////////////////////////////////
///////////////////////////以下为 biz配置信息////////////////////////////////
///////////////////////////////////////////////////////////////////////////
-->
<bean id="AddressConfigBiz" class="crm.nuandong.biz.impl.AddressConfigBizImpl">
<property name="addressConfigDao" ref="AddressConfigDAO"></property>
</bean>
<!--
///////////////////////////////////////////////////////////////////////////
/////////////////////////以下为 action配置信息///////////////////////////////
///////////////////////////////////////////////////////////////////////////
--> <bean id="AddressConfigAction" class="crm.nuandong.action.AddressConfigAction"
autowire="byType" /> <!-- compass2.2 start -->
<bean id="annotationConfiguration"
class="org.compass.annotations.config.CompassAnnotationsConfiguration"></bean>
<bean id="compass" class="org.compass.spring.LocalCompassBean">
<property name="resourceDirectoryLocations">
<list>
<value>classpath:crm/nuandong</value>
</list>
</property>
<!-- anontaition式设置 -->
<property name="classMappings">
<list>
<value>crm.nuandong.pojo.Customer</value> </list>
</property>
<property name="compassConfiguration" ref="annotationConfiguration" />
<property name="compassSettings">
<props>
<prop key="compass.transaction.factory">
org.compass.spring.transaction.SpringSyncTransactionFactory</prop>
<prop key="compass.engine.highlighter.default.formatter.simple.pre"><![CDATA[<b><font color='red'>]]></prop>
<prop key="compass.engine.highlighter.default.formatter.simple.post"><![CDATA[</font></b>]]></prop>
<!-- 定义索引的存储位置 -->
<!--
<prop
key="compass.engine.connection">file://${user.home}/springside/compass</prop>
-->
<prop key="compass.engine.connection">/lucene/indexes</prop>
<!-- 定义分词器 -->
<!--
<prop
key="compass.engine.analyzer.MMAnalyzer.CustomAnalyzer">net.paoding.analysis.analyzer.PaodingAnalyzer
</prop>
-->
<prop key="compass.engine.analyzer.MMAnalyzer.CustomAnalyzer">org.mira.lucene.analysis.IK_CAnalyzer
</prop>
</props>
</property>
<property name="transactionManager" ref="myHibTransactionManager" />
</bean>
<bean id="hibernateGpsDevice"
class="org.compass.spring.device.hibernate.dep.SpringHibernate3GpsDevice">
<property name="name">
<value>hibernateDevice</value>
</property>
<property name="sessionFactory" ref="sessionFactory" />
<!--
<property name="mirrorDataChanges"> <value>true</value> </property>
-->
</bean>
<!-- 同步更新索引 -->
<bean id="compassGps" class="org.compass.gps.impl.SingleCompassGps"
init-method="start" destroy-method="stop">
<property name="compass" ref="compass" />
<property name="gpsDevices">
<list>
<ref local="hibernateGpsDevice" />
</list>
</property>
</bean>
<bean id="compassTemplate" class="org.compass.core.CompassTemplate">
<property name="compass" ref="compass" />
</bean>
<!-- 定时重建索引(利用quartz)或随Spring ApplicationContext启动而重建索引 -->
<bean id="compassIndexBuilder" class="crm.nuandong.dao.impl.compass.CompassIndexBuilder"
lazy-init="false">
<property name="compassGps" ref="compassGps" />
<property name="buildIndex" value="true" />
<property name="lazyTime" value="10" />
</bean>
<!-- compass2.2 end -->
</beans>hibernate配置文件<?xml version='1.0' encoding='UTF-8'?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd"> <!-- Generated by MyEclipse Hibernate Tools. -->
<hibernate-configuration> <session-factory>
<property name="dialect">
org.hibernate.dialect.SQLServerDialect
</property>
<property name="connection.url">
jdbc:sqlserver://localhost:1433
</property>
<property name="connection.username">sa</property>
<property name="connection.driver_class">
com.microsoft.sqlserver.jdbc.SQLServerDriver
</property> <property name="myeclipse.connection.profile">sqlserver</property>
<property name="show_sql">true</property>
<mapping resource="crm/nuandong/pojo/hibernate/UserDepartment.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/OrderDetail.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Product.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerLinkman.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Customer.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmulantMenaceRank.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/UserRole.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/ServiceType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/AddressConfig.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmulantCompanyType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmulantDynamic.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/ProductType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerPlan.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerType.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Roles.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/UserInfo.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/EmailConfig.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Emulant.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/OrderInfo.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/CustomerIndustry.hbm.xml" />
<mapping resource="crm/nuandong/pojo/hibernate/Service.hbm.xml" />
</session-factory></hibernate-configuration>
严重: Exception sending context initialized event to listener instance of class org.springframework.web.context.ContextLoaderListener
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'compass' defined in class path resource [applicationContext.xml]: Invocation of init method failed; nested exception is org.compass.core.config.ConfigurationException: No mapping match class [crm.nuandong.pojo.Customer]
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1338)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:473)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory$1.run(AbstractAutowireCapableBeanFactory.java:409)
at java.security.AccessController.doPrivileged(Native Method)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:380)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:264)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:261)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:185)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:164)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:423)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:728)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:380)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:255)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:199)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:45)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3827)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4336)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:760)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:740)
at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:525)
at org.apache.catalina.startup.HostConfig.deployDirectory(HostConfig.java:920)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:883)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1138)
at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:311)
at org.apache.catalina.util.LifecycleSupport.fireLifecycleEvent(LifecycleSupport.java:120)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1022)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1014)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:448)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:552)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:597)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
Caused by: org.compass.core.config.ConfigurationException: No mapping match class [crm.nuandong.pojo.Customer]
at org.compass.core.config.CompassConfiguration.addClass(CompassConfiguration.java:534)
at org.compass.spring.LocalCompassBean.afterPropertiesSet(LocalCompassBean.java:312)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.invokeInitMethods(AbstractAutowireCapableBeanFactory.java:1369)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1335)
... 39 more
package crm.nuandong.pojo;import java.util.HashSet;
import java.util.Set;import org.compass.annotations.Searchable;
import org.compass.annotations.SearchableId;
import org.compass.annotations.SearchableProperty;/**
* AddressConfig entity. @author MyEclipse Persistence Tools
*/
@Searchable
public class AddressConfig implements java.io.Serializable { // Fields @SearchableId
private Integer id;
@SearchableProperty(name = "parentId")
private Integer parentId;
@SearchableProperty(name = "name")
private String name;
@SearchableProperty(name = "description")
private String description;
@SearchableProperty(name = "emulants")
private Set emulants = new HashSet(0);
@SearchableProperty(name = "customers")
private Set customers = new HashSet(0); // Constructors /** default constructor */
public AddressConfig() {
} /** full constructor */
public AddressConfig(Integer parentId, String name, String description,
Set emulants, Set customers) {
this.parentId = parentId;
this.name = name;
this.description = description;
this.emulants = emulants;
this.customers = customers;
} // Property accessors public Integer getId() {
return this.id;
} public void setId(Integer id) {
this.id = id;
} public Integer getParentId() {
return this.parentId;
} public void setParentId(Integer parentId) {
this.parentId = parentId;
} public String getName() {
return this.name;
} public void setName(String name) {
this.name = name;
} public String getDescription() {
return this.description;
} public void setDescription(String description) {
this.description = description;
} public Set getEmulants() {
return this.emulants;
} public void setEmulants(Set emulants) {
this.emulants = emulants;
} public Set getCustomers() {
return this.customers;
} public void setCustomers(Set customers) {
this.customers = customers;
}}
<!DOCTYPE hibernate-mapping PUBLIC "-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<!--
Mapping file autogenerated by MyEclipse Persistence Tools
-->
<hibernate-mapping>
<class name="crm.nuandong.pojo.AddressConfig" table="AddressConfig" schema="dbo" catalog="NuanDongCrm">
<id name="id" type="java.lang.Integer">
<column name="Id" />
<generator class="native" />
</id>
<property name="parentId" type="java.lang.Integer">
<column name="ParentId" />
</property>
<property name="name" type="java.lang.String">
<column name="Name" length="50" />
</property>
<property name="description" type="java.lang.String">
<column name="Description" length="500" />
</property>
<set name="emulants" inverse="true">
<key>
<column name="AddressId" />
</key>
<one-to-many class="crm.nuandong.pojo.Emulant" />
</set>
<set name="customers" inverse="true">
<key>
<column name="CustomerAddressId" />
</key>
<one-to-many class="crm.nuandong.pojo.Customer" />
</set>
</class>
</hibernate-mapping>
没有映射
这个类在哪