这是hibernate3.1+struts2.0+spring1.2环境搭建好发布之后出现的问题,项目中没有代码错误,搭建的环境在别的机子上可以正常发布以及实现各种逻辑。重装Tomcat ,换了工作区还是不行,都是同一种错误提示,提示如下:2009-8-6 19:22:10 org.apache.catalina.core.AprLifecycleListener init
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\Java\jdk1.5.0_12\bin;D:\Tomcat 6.0\bin
2009-8-6 19:22:10 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8000
2009-8-6 19:22:10 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 866 ms
2009-8-6 19:22:10 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2009-8-6 19:22:10 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.14
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2009-8-6 19:22:12 org.apache.catalina.core.ApplicationContext log
信息: Loading Spring root WebApplicationContext
2009-8-6 19:22:15 org.apache.catalina.core.StandardContext listenerStart
严重: 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 'deptproxy' defined in class path resource [beans.xml]: Error setting property values; nested exception is PropertyAccessExceptionsException (1 errors)
PropertyAccessExceptionsException (1 errors)
org.springframework.beans.MethodInvocationException: Property 'transactionAttributes' threw exception; nested exception is java.lang.NoSuchMethodError: org.springframework.util.StringUtils.containsWhitespace(Ljava/lang/String;)Z
java.lang.NoSuchMethodError: org.springframework.util.StringUtils.containsWhitespace(Ljava/lang/String;)Z
at org.springframework.transaction.interceptor.TransactionAttributeEditor.setAsText(TransactionAttributeEditor.java:60)
at org.springframework.transaction.interceptor.NameMatchTransactionAttributeSource.setProperties(NameMatchTransactionAttributeSource.java:87)
at org.springframework.transaction.interceptor.TransactionAspectSupport.setTransactionAttributes(TransactionAspectSupport.java:153)
at org.springframework.transaction.interceptor.TransactionProxyFactoryBean.setTransactionAttributes(TransactionProxyFactoryBean.java:185)
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.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:707)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:572)
at org.springframework.beans.BeanWrapperImpl.setPropertyValue(BeanWrapperImpl.java:737)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:764)
at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:753)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1057)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:378)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:277)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
at org.springframework.web.context.support.AbstractRefreshableWebApplicationContext.refresh(AbstractRefreshableWebApplicationContext.java:139)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:252)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:190)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:49)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3830)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4337)
at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:791)
at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:771)
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:117)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1053)
at org.apache.catalina.core.StandardHost.start(StandardHost.java:719)
at org.apache.catalina.core.ContainerBase.start(ContainerBase.java:1045)
at org.apache.catalina.core.StandardEngine.start(StandardEngine.java:443)
at org.apache.catalina.core.StandardService.start(StandardService.java:516)
at org.apache.catalina.core.StandardServer.start(StandardServer.java:710)
at org.apache.catalina.startup.Catalina.start(Catalina.java:566)
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:288)
at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:413)
2009-8-6 19:22:15 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2009-8-6 19:22:15 org.apache.catalina.core.StandardContext start
严重: Context [/SSH] startup failed due to previous errors
2009-8-6 19:22:15 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2009-8-6 19:22:15 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8000
2009-8-6 19:22:15 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2009-8-6 19:22:15 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/32  config=null
2009-8-6 19:22:15 org.apache.catalina.startup.Catalina start
信息: Server startup in 5470 ms

解决方案 »

  1.   

    'transactionAttributes' 配置文件里这个属性和类的属性不一致吧。
      

  2.   

    ‘transactionAttributes’是spring配置文件中的事务代理中的一个属性,导入源码后,在源码中是可以看到其set方法的。
    <bean id="baseproxy" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean" abstract="true" >
        <property name="transactionManager" ref="tr"></property>
        <property name="transactionAttributes">
          <props>
            <prop key="insert*">PROPAGATION_REQUIRED</prop>
            <prop key="save*">PROPAGATION_REQUIRED</prop>
            <prop key="update*">PROPAGATION_REQUIRED</prop>
            <prop key="delete*">PROPAGATION_REQUIRED</prop>
            <prop key="get*">PROPAGATION_REQUIRED,readOnly</prop>
            <prop key="find*">PROPAGATION_REQUIRED,readOnly</prop>
          </props>  
       </property>
    </bean>