启动tomcat报错:
2011-5-11 16:02:05 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: F:\workspace\Hnkjdx\WebRoot
2011-5-11 16:02:05 org.apache.coyote.http11.Http11BaseProtocol init
信息: 初始化 Coyote HTTP/1.1:http-8080
2011-5-11 16:02:05 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 781 ms
2011-5-11 16:02:05 org.apache.catalina.core.StandardService start
信息: 启动Catalina服务
2011-5-11 16:02:05 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.20
2011-5-11 16:02:05 org.apache.catalina.core.StandardHost start
信息: XML文件的有效性检测被停用

defining beans [dataSource,sessionFactory,singleGenericHibernateDAO,transactionManager,hibernateTemplate,baseTransaction,serviceAddress]; root of factory hierarchy
INFO - Closing Hibernate SessionFactory
INFO - closing
ERROR - Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAddress' defined in ServletContext resource [/WEB-INF/addressConf/applicationContext-common.xml]: Cannot create inner bean 'com.service.impl.ServiceAddressImpl#ccd21c' of type [com.service.impl.ServiceAddressImpl] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.service.impl.ServiceAddressImpl#ccd21c' defined in ServletContext resource [/WEB-INF/addressConf/applicationContext-common.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'singleGenericHibernateDAO' of bean class [com.service.impl.ServiceAddressImpl]: Bean property 'singleGenericHibernateDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.service.impl.ServiceAddressImpl#ccd21c' defined in ServletContext resource [/WEB-INF/addressConf/applicationContext-common.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'singleGenericHibernateDAO' of bean class [com.service.impl.ServiceAddressImpl]: Bean property 'singleGenericHibernateDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: 
org.springframework.beans.NotWritablePropertyException: Invalid property 'singleGenericHibernateDAO' of bean class [com.service.impl.ServiceAddressImpl]: Bean property 'singleGenericHibernateDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:793)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveInnerBean(BeanDefinitionValueResolver.java:215)
at org.springframework.beans.factory.support.BeanDefinitionValueResolver.resolveValueIfNecessary(BeanDefinitionValueResolver.java:122)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1100)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:862)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:424)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:251)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:156)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:248)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:160)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:284)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:244)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:187)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3763)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4211)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:709)
at org.apache.catalina.startup.Catalina.start(Catalina.java:551)
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:585)
at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
ERROR - 发送初始化事件给listenerorg.springframework.web.context.ContextLoaderListener时有异常
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'serviceAddress' defined in ServletContext resource [/WEB-INF/addressConf/applicationContext-common.xml]: Cannot create inner bean 'com.service.impl.ServiceAddressImpl#ccd21c' of type [com.service.impl.ServiceAddressImpl] while setting bean property 'target'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.service.impl.ServiceAddressImpl#ccd21c' defined in ServletContext resource [/WEB-INF/addressConf/applicationContext-common.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'singleGenericHibernateDAO' of bean class [com.service.impl.ServiceAddressImpl]: Bean property 'singleGenericHibernateDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: 
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'com.service.impl.ServiceAddressImpl#ccd21c' defined in ServletContext resource [/WEB-INF/addressConf/applicationContext-common.xml]: Error setting property values; nested exception is org.springframework.beans.NotWritablePropertyException: Invalid property 'singleGenericHibernateDAO' of bean class [com.service.impl.ServiceAddressImpl]: Bean property 'singleGenericHibernateDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
Caused by: 
org.springframework.beans.NotWritablePropertyException: Invalid property 'singleGenericHibernateDAO' of bean class [com.service.impl.ServiceAddressImpl]: Bean property 'singleGenericHibernateDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:793)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:645)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:78)
at org.springframework.beans.AbstractPropertyAccessor.setPropertyValues(AbstractPropertyAccessor.java:59)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1127)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:294)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:432)
2011-5-11 16:02:11 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2011-5-11 16:02:11 org.apache.catalina.core.StandardContext start
严重: 因为前面的错误无法启动上下文
INFO - Closing Spring root WebApplicationContext
2011-5-11 16:02:12 org.apache.coyote.http11.Http11BaseProtocol start

解决方案 »

  1.   


    web.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <web-app version="2.4" 
    xmlns="http://java.sun.com/xml/ns/j2ee" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" 
    xsi:schemaLocation="http://java.sun.com/xml/ns/j2ee 
    http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd">
      <welcome-file-list>
        <welcome-file>AddressDemo.jsp</welcome-file>
      </welcome-file-list>
      <!-- Spring的配置文件 -->
    <context-param>
    <param-name>contextConfigLocation</param-name>
    <param-value>
    <!--财务管理-->
    /WEB-INF/addressConf/applicationContext-common.xml
    </param-value>
    </context-param>
    <!-- 通过上下文监听实现载入Spring插件 -->
    <listener>
    <listener-class>
    org.springframework.web.context.ContextLoaderListener
    </listener-class>
    </listener>
    <!-- Struts -->
    <servlet>
    <servlet-name>action</servlet-name>
    <servlet-class>
    org.apache.struts.action.ActionServlet
    </servlet-class> <init-param>
    <param-name>config</param-name>
    <param-value>
    /WEB-INF/addressConf/struts-config-common.xml
    </param-value>
    </init-param>
    <init-param>
    <param-name>debug</param-name>
    <param-value>3</param-value>
    </init-param>
    <init-param>
    <param-name>detail</param-name>
    <param-value>3</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
    <servlet-name>action</servlet-name>
    <url-pattern>*.do</url-pattern>
    </servlet-mapping>
    </web-app>applicationContext-common.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <beans xmlns="http://www.springframework.org/schema/beans"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.0.xsd">
    <bean id="dataSource"
    class="org.springframework.jdbc.datasource.DriverManagerDataSource">
    <property name="driverClassName">
    <value>oracle.jdbc.driver.OracleDriver</value>
    </property>
    <property name="url">
    <value>jdbc:oracle:thin:@192.168.1.190:1521:orcl</value>
    </property>
    <property name="username">
    <value>test</value>
    </property>
    <property name="password">
    <value>test</value>
    </property>
       </bean>
    <!-- 配置Hibernate会话工厂 -->
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <!-- 在此可以配置Hibernate会话工厂的属性 -->
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.Oracle9Dialect
    </prop> <!--<prop key="hibernate.dialect">
    org.hibernate.dialect.SQLServerDialect
    </prop>
    -->
    <prop key="hibernate.jdbc.fetch_size">30</prop>
    <prop key="hibernate.jdbc.batch_size">30</prop>
    <prop key="hibernate.show_sql">true</prop>
    <prop key="hibernate.connection.release_mode">
    auto
    </prop>
    <!--<prop key="hibernate.hbm2ddl.auto">update</prop>
    -->
    </props>
    </property>
    <!-- 在此可以匹配*.hbm.xml映射文件 -->
    <property name="mappingDirectoryLocations">
    <list>
    <!-- 消息管理 -->
    <value>classpath:com/bean</value>
    </list>
    </property>
    </bean>
    <!--配制single泛型DAO-->
    <bean id="singleGenericHibernateDAO" parent="baseTransaction">
    <property name="target">
    <bean
    class="com.qzdatasoft.comm.generic.impl.SingleGenericHibernateDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    </property>
    </bean>
    <!--配制single泛型DAO-->
    <!-- <bean id="singleGenericHibernateDAO"-->
    <!-- class="com.qzdatasoft.comm.generic.impl.SingleGenericHibernateDAO">-->
    <!-- <property name="sessionFactory">-->
    <!-- <ref bean="sessionFactory" />-->
    <!-- </property>-->
    <!-- </bean>-->
    <!-- 配置事务管理器 -->
    <bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean> <!-- 配置Hibernate模板 -->
    <bean id="hibernateTemplate"
    class="org.springframework.orm.hibernate3.HibernateTemplate">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <!--配置事物代理-->
    <bean id="baseTransaction"
    class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean"
    abstract="true">
    <property name="transactionManager">
    <ref bean="transactionManager" />
    </property>
    <property name="proxyTargetClass" value="true" />
    <property name="transactionAttributes">
    <props>
    <prop key="save*">PROPAGATION_REQUIRED</prop>
    <prop key="modify*">PROPAGATION_REQUIRED</prop>
    <prop key="update*">PROPAGATION_REQUIRED</prop>
    <prop key="write*">PROPAGATION_REQUIRED</prop>
    <prop key="del*">PROPAGATION_REQUIRED</prop>
    <prop key="edit*">PROPAGATION_REQUIRED</prop>
    <prop key="add*">PROPAGATION_REQUIRED</prop>
    <prop key="insert*">PROPAGATION_REQUIRED</prop>
    <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
    <prop key="validate*">
    PROPAGATION_REQUIRED,readOnly
    </prop>
    <!-- 自动编排课表禁用事务 -->
    <prop key="autoPk">PROPAGATION_NEVER</prop>
    <!-- 自动安排考试禁用事务 -->
    <prop key="AutoPaiKao">PROPAGATION_NEVER</prop>
    <prop key="*">PROPAGATION_REQUIRED</prop>
    </props>
    </property>
    </bean>
    <!-- 角色信息管理 -->
    <bean id="serviceAddress" parent="baseTransaction">
    <property name="target">
    <bean
    class="com.service.impl.ServiceAddressImpl">
    <property name="singleGenericHibernateDAO">
    <ref bean="singleGenericHibernateDAO" />
    </property>
    </bean>
    </property>
    </bean>
    </beans>struts-conf.xml
    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE struts-config PUBLIC "-//Apache Software Foundation//DTD Struts Configuration 1.1//EN" "http://jakarta.apache.org/struts/dtds/struts-config_1_1.dtd"><struts-config>
    <form-beans>
    <form-bean name="addressForm"
    type="com.web.form.AddressForm" />
    </form-beans> <action-mappings>
    <!-- addressAction -->
    <action parameter="method" path="/grantauth" name="addressForm"
    type="com.web.action.AddressAction">
    <forward name="addressSuccess" path="/AddressDemo.jsp" />
    </action>
    </action-mappings>
    </struts-config>
    哪位高手有ssh基本教材,有视频也行,发个给我,不胜感激。[email protected]邮箱。谢谢
      

  2.   

    是你 的    applicationContext-common.xml   这个 名字 不对,你拷的时候都不看的。那你能学到什么
      

  3.   

     用这个名字是没有问题。spring中没有规定只能用applicationContext.xml。
      

  4.   

      可能是这个问题<!--配制single泛型DAO-->
    <bean id="singleGenericHibernateDAO" parent="baseTransaction">
    <property name="target">
    <bean
    class="com.qzdatasoft.comm.generic.impl.SingleGenericHibernateDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    </property>
    </bean>
    这个里面的bean 是继承了baseTransaction 基类,写法错误。
    类似为:(如果为抽象类,请加abstract = true)<bean id="singleGenericHibernateDAO" parent="baseTransaction" class="com.qzdatasoft.comm.generic.impl.SingleGenericHibernateDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    你没有给singleGenericHibernateDAO 定义 class属性,spring如何给你管理?
    报的错误中,target 对应的类为 com.qzdatasoft.comm.generic.impl.SingleGenericHibernateDAO,提示seter geter 方法无效,楼主检查一下。
    bean: singleGenericHibernateDAO 中如果真有target,需要有get set 方法,,如果没有用到注解注入属性的话。
      

  5.   


    org.springframework.beans.NotWritablePropertyException: Invalid property 'singleGenericHibernateDAO' of bean class [com.service.impl.ServiceAddressImpl]: Bean property 'singleGenericHibernateDAO' is not writable or has an invalid setter method. Does the parameter type of the setter match the return type of the getter?你singleGenericHibernateDAO类的set、get方法有没有错
      

  6.   

    或则是ServiceAddressImpl注入singleGenericHibernateDAO配置有没有错