报错信息:2012-7-19 16:41:30 org.apache.catalina.core.AprLifecycleListener init
信息: The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: D:\software\Java\jdk1.6.0_02\bin;D:\software\Apache Software Foundation\Tomcat 6.0\bin
2012-7-19 16:41:30 org.apache.coyote.http11.Http11Protocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2012-7-19 16:41:30 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 284 ms
2012-7-19 16:41:31 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2012-7-19 16:41:31 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/6.0.16
2012-7-19 16:41:31 org.apache.catalina.core.StandardContext addApplicationListener
信息: The listener "org.springframework.web.context.ContextLoaderListener" is already configured for this context. The duplicate definition has been ignored.
2012-7-19 16:41:31 org.apache.catalina.core.ApplicationContext log
信息: Initializing Spring root WebApplicationContext
log4j:WARN No appenders could be found for logger (org.springframework.web.context.ContextLoader).
log4j:WARN Please initialize the log4j system properly.
2012-7-19 16:41:33 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 'dataSource' defined in ServletContext resource [/WEB-INF/applicationContext.xml]: Initialization of bean failed; nested exception is java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 40
execution(*com.foraise.service.impl.*.*(..))
                                        ^ at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:527)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:190)
at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:580)
at org.springframework.context.support.AbstractApplicationContext.finishBeanFactoryInitialization(AbstractApplicationContext.java:895)
at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:425)
at org.springframework.web.context.ContextLoader.createWebApplicationContext(ContextLoader.java:276)
at org.springframework.web.context.ContextLoader.initWebApplicationContext(ContextLoader.java:197)
at org.springframework.web.context.ContextLoaderListener.contextInitialized(ContextLoaderListener.java:47)
at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:3843)
at org.apache.catalina.core.StandardContext.start(StandardContext.java:4350)
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:924)
at org.apache.catalina.startup.HostConfig.deployDirectories(HostConfig.java:887)
at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:492)
at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1147)
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:578)
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: java.lang.IllegalArgumentException: Pointcut is not well-formed: expecting 'name pattern' at character position 40
execution(*com.foraise.service.impl.*.*(..))
                                        ^ at org.aspectj.weaver.tools.PointcutParser.resolvePointcutExpression(PointcutParser.java:333)
at org.aspectj.weaver.tools.PointcutParser.parsePointcutExpression(PointcutParser.java:308)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.buildPointcutExpression(AspectJExpressionPointcut.java:204)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.checkReadyToMatch(AspectJExpressionPointcut.java:191)
at org.springframework.aop.aspectj.AspectJExpressionPointcut.getClassFilter(AspectJExpressionPointcut.java:172)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:200)
at org.springframework.aop.support.AopUtils.canApply(AopUtils.java:254)
at org.springframework.aop.support.AopUtils.findAdvisorsThatCanApply(AopUtils.java:286)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findAdvisorsThatCanApply(AbstractAdvisorAutoProxyCreator.java:117)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.findEligibleAdvisors(AbstractAdvisorAutoProxyCreator.java:87)
at org.springframework.aop.framework.autoproxy.AbstractAdvisorAutoProxyCreator.getAdvicesAndAdvisorsForBean(AbstractAdvisorAutoProxyCreator.java:68)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.wrapIfNecessary(AbstractAutoProxyCreator.java:359)
at org.springframework.aop.framework.autoproxy.AbstractAutoProxyCreator.postProcessAfterInitialization(AbstractAutoProxyCreator.java:322)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyBeanPostProcessorsAfterInitialization(AbstractAutowireCapableBeanFactory.java:407)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.initializeBean(AbstractAutowireCapableBeanFactory.java:1426)
at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:519)
... 35 more
2012-7-19 16:41:33 org.apache.catalina.core.StandardContext start
严重: Error listenerStart
2012-7-19 16:41:33 org.apache.catalina.core.StandardContext start
严重: Context [/redwood] startup failed due to previous errors
2012-7-19 16:41:33 org.apache.catalina.core.ApplicationContext log
信息: Closing Spring root WebApplicationContext
2012-7-19 16:41:33 org.apache.coyote.http11.Http11Protocol start
信息: Starting Coyote HTTP/1.1 on http-8080
2012-7-19 16:41:33 org.apache.jk.common.ChannelSocket init
信息: JK: ajp13 listening on /0.0.0.0:8009
2012-7-19 16:41:33 org.apache.jk.server.JkMain start
信息: Jk running ID=0 time=0/13  config=null
2012-7-19 16:41:33 org.apache.catalina.startup.Catalina start
信息: Server startup in 2536 ms

解决方案 »

  1.   

    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:context="http://www.springframework.org/schema/context"
    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-3.0.xsd
    http://www.springframework.org/schema/aop http://www.springframework.org/schema/aop/spring-aop-3.0.xsd
    http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-3.0.xsd
    http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
    <bean id="dataSource"
    class="org.apache.commons.dbcp.BasicDataSource">
    <property name="driverClassName"
    value="com.mysql.jdbc.Driver">
    </property>
    <property name="url"
    value="jdbc:mysql://localhost:3306/redwooddb">
    </property>
    <property name="username" value="root"></property>
    <property name="password" value="123654"></property>
    </bean>
    <bean id="sessionFactory"
    class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource">
    <ref bean="dataSource" />
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">
    org.hibernate.dialect.MySQLDialect
    </prop>
    </props>
    </property>
    <property name="mappingResources">
    <list>
    <value>com/foraise/entity/Furnituretype.hbm.xml</value>
    <value>com/foraise/entity/Redwoodparameter.hbm.xml</value>
    <value>com/foraise/entity/Images.hbm.xml</value>
    <value>com/foraise/entity/News.hbm.xml</value>
    <value>com/foraise/entity/Users.hbm.xml</value></list>
    </property></bean>
    <bean id="FurnituretypeDAO"
    class="com.foraise.dao.impl.FurnituretypeDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <bean id="RedwoodparameterDAO"
    class="com.foraise.dao.impl.RedwoodparameterDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <bean id="ImagesDAO" class="com.foraise.dao.impl.ImagesDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <bean id="NewsDAO" class="com.foraise.dao.impl.NewsDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <bean id="UsersDAO" class="com.foraise.dao.impl.UsersDAO">
    <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>
    </bean>
    <bean id="LoginService" class="com.foraise.service.impl.LoginService">
    <property name="usersDAO" ref="UsersDAO"/>
    </bean>
    <bean id="LoginAction" class="com.foraise.action.LoginAction">
    <property name="loginservice" ref="LoginService"/>
    </bean>

    <!-- 配置事务管理器 -->
    <bean id="transactionManager" class="org.springframework.orm.hibernate3.HibernateTransactionManager">
        <property name="sessionFactory">
    <ref bean="sessionFactory" />
    </property>    
    </bean>

    <!--配置事务的传播特性-->
        <tx:advice id="txAdvice" transaction-manager="transactionManager">
      <tx:attributes>
    <tx:method name="save*" propagation="REQUIRED"/>
    <tx:method name="update*" propagation="REQUIRED"/>
    <tx:method name="delete*" propagation="REQUIRED"/>
    <tx:method name="add*" propagation="REQUIRED"/>
    <tx:method name="del*" propagation="REQUIRED"/>
    <tx:method name="*" read-only="true"/>
      </tx:attributes>
        </tx:advice>

    <!-- 哪些类的哪些方法参与事务 -->
        <aop:config>
    <aop:pointcut id="allServiceMethod" expression="execution(*com.foraise.service.impl.*.*(..))"/>
    <aop:advisor pointcut-ref="allServiceMethod" advice-ref="txAdvice"/>
        </aop:config>

    </beans>
      

  2.   

    应该是你的(*com.foraise.service.impl.*.*(..)写的有问题,检查下路径
      

  3.   

    应该是你的(*com.foraise.service.impl.*.*(..)写的有问题,检查下路径
      

  4.   

    pointcut表达式 第一个星号 和后面之间要有一个空格。
    如:execution(* com.foraise.service.impl.*.*(..))
      

  5.   

    楼主这个错误并不是spring配置事务所报出的错误,而spring的面向切向(AOP)的配置文件的错误。
    关于spring 的aop编程,楼主可以搜搜,有很多。<aop:pointcut id="allServiceMethod" expression="execution(*com.foraise.service.impl.*.*(..))"/>这一句的意思是定义一个切面,以用来拦截业务bean,判断是否有相应业务bean的权限。
    expression里面配置的是需要拦截的哪些类,及哪些方法。关于具体写法,这有个例子:
    http://tonylian.iteye.com/blog/850132
      

  6.   

    <aop:pointcut id="allServiceMethod" expression="execution(*com.foraise.service.impl.*.*(..))"/>这一句的意思是定义一个切面,以用来拦截业务bean。比如,在进入一个业务类之前,判断是否有相应访问业务bean的权限。
      

  7.   

    expression="execution (* com.baba.dao..*(..))"