你先弄清楚INFO,WARNING,ERROR都是什么意思再说。

解决方案 »

  1.   

    INFO是什么意思,我是菜鸟,请回复
      

  2.   

    hibernate.cfg.xml里配置的JNDI检查一下吧
      

  3.   

    info是信息的意思,warning是警告的意思,error是错误的意思
    我这里没有用hibernate.cfg.xml,用的是applicationContext-common.xml配置数据源
      

  4.   

    我觉得应该贴配置数据库的代码,要贴也是贴error吧
      

  5.   

    没有ERROR,只有第一部分贴出来的那一部分
    数据库配置代码
    <?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/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
    default-autowire="byName" default-lazy-init="true"> <!-- 数据源定义,使用Apache DBCP 连接池 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName">
         <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
        </property>
    <property name="url">
    <value>jdbc:sqlserver://127.0.0.1:1433; DatabaseName=chinasei</value>
    </property>
    <property name="username">
    <value>sa</value>
    </property>
    <property name="password">
    <value>881206</value>
    </property>
    <property name="maxActive" value="${datasource.maxActive}" />
    <property name="maxIdle" value="${datasource.maxIdle}" />
    <property name="maxWait" value="${datasource.maxWait}" />
    <!--<property name="defaultAutoCommit" value="true" />
    <property name="removeAbandoned" value="true" />
    <property name="removeAbandonedTimeout" value="60" />
    <property name="validationQuery" value="select 1 " />
    <property name="testOnBorrow" value="true" />
    -->
        </bean> <!--Hibernate SessionFatory-->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mappingDirectoryLocations">
    <list>
    <value>classpath:/config/hibernate-hbm</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    </bean>

    <!-- 属性文件读入 -->
    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>classpath*:config/jdbc.properties</value>
    <value>classpath*:config/hibernate.properties</value>
    </list>
    </property>
    </bean> <!-- 事务配置 -->
    <aop:config proxy-target-class="true">
    <aop:advisor
    pointcut="execution(* com.chinasei.lwframework..*ServiceImpl.*(..))"
    advice-ref="txAdvice-demo" />
    </aop:config> <tx:advice id="txAdvice-demo">
    <tx:attributes>
    <tx:method name="get*" read-only="true" />
    <tx:method name="find*" read-only="true" />
    <tx:method name="is*" read-only="true" />
    <!--<tx:method name="search*" read-only="true" />
    --><tx:method name="*" propagation="REQUIRED" />
    </tx:attributes>
    </tx:advice> <bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean></beans>
      

  6.   

    数据库更新(比上边的多加了同个常量)
    <?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/aop http://www.springframework.org/schema/aop/spring-aop-2.0.xsd
               http://www.springframework.org/schema/tx http://www.springframework.org/schema/tx/spring-tx-2.0.xsd"
    default-autowire="byName" default-lazy-init="true"> <!-- 数据源定义,使用Apache DBCP 连接池 -->
    <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
        <property name="driverClassName">
         <value>com.microsoft.sqlserver.jdbc.SQLServerDriver</value>
        </property>
    <property name="url">
    <value>jdbc:sqlserver://127.0.0.1:1433; DatabaseName=chinasei</value>
    </property>
    <property name="username">
    <value>sa</value>
    </property>
    <property name="password">
    <value>881206</value>
    </property>
    <property name="maxActive" ><value>8</value></property>
    <property name="maxIdle"><value>4</value></property>
    <property name="maxWait"><value>1000</value></property>
    <!--<property name="defaultAutoCommit" value="true" />
    <property name="removeAbandoned" value="true" />
    <property name="removeAbandonedTimeout" value="60" />
    <property name="validationQuery" value="select 1 " />
    <property name="testOnBorrow" value="true" />
    -->
        </bean> <!--Hibernate SessionFatory-->
    <bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
    <property name="dataSource" ref="dataSource" />
    <property name="mappingDirectoryLocations">
    <list>
    <value>classpath:/config/hibernate-hbm</value>
    </list>
    </property>
    <property name="hibernateProperties">
    <props>
    <prop key="hibernate.dialect">org.hibernate.dialect.SQLServerDialect</prop>
    <prop key="hibernate.show_sql">true</prop>
    </props>
    </property>
    </bean>

    <!-- 属性文件读入 -->
    <bean id="propertyConfigurer"
    class="org.springframework.beans.factory.config.PropertyPlaceholderConfigurer">
    <property name="locations">
    <list>
    <value>classpath*:config/jdbc.properties</value>
    <value>classpath*:config/hibernate.properties</value>
    </list>
    </property>
    </bean> <!-- 事务配置 -->
    <aop:config proxy-target-class="true">
    <aop:advisor
    pointcut="execution(* com.chinasei.lwframework..*ServiceImpl.*(..))"
    advice-ref="txAdvice-demo" />
    </aop:config> <tx:advice id="txAdvice-demo">
    <tx:attributes>
    <tx:method name="get*" read-only="true" />
    <tx:method name="find*" read-only="true" />
    <tx:method name="is*" read-only="true" />
    <!--<tx:method name="search*" read-only="true" />
    --><tx:method name="*" propagation="REQUIRED" />
    </tx:attributes>
    </tx:advice> <bean id="transactionManager"
    class="org.springframework.orm.hibernate3.HibernateTransactionManager">
    <property name="sessionFactory" ref="sessionFactory" />
    </bean></beans>
      

  7.   

    修改成下面这个样子:<action name="login" method="login" class="com.chinasei.struts2.user.web.UserAction"></action>
    以下是错误信息:
    2013-12-16 10:43:33,000 INFO  [30250] [http-8080-1] support.DefaultListableBeanFactory - Destroying singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@1090c56: defining beans [loginAction,userAction,registAction,dataSource,sessionFactory,propertyConfigurer,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,txAdvice-demo,transactionManager,userDao,userService]; root of factory hierarchy
    2013-12-16 10:43:33 org.apache.catalina.loader.WebappClassLoader clearReferencesJdbc
    严重: A web application registered the JBDC driver [com.microsoft.sqlserver.jdbc.SQLServerDriver] but failed to unregister it when the web application was stopped. To prevent a memory leak, the JDBC Driver has been forcibly unregistered.
    2013-12-16 10:43:33 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
    严重: A web application created a ThreadLocal with key of type [null] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1bb73b0]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@1a84fae]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
    2013-12-16 10:43:33 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
    严重: A web application created a ThreadLocal with key of type [null] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1075056]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@12b71eb]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
    2013-12-16 10:43:33 org.apache.catalina.loader.WebappClassLoader clearThreadLocalMap
    严重: A web application created a ThreadLocal with key of type [null] (value [com.opensymphony.xwork2.inject.ContainerImpl$10@1bb73b0]) and a value of type [java.lang.Object[]] (value [[Ljava.lang.Object;@1441dc0]) but failed to remove it when the web application was stopped. To prevent a memory leak, the ThreadLocal has been forcibly removed.
    2013-12-16 10:43:35,203 INFO  [0] [http-8080-1] context.ContextLoader - Root WebApplicationContext: initialization started
    2013-12-16 10:43:35,343 INFO  [140] [http-8080-1] support.XmlWebApplicationContext - Refreshing org.springframework.web.context.support.XmlWebApplicationContext@60a77c: display name [Root WebApplicationContext]; startup date [Mon Dec 16 10:43:35 CST 2013]; root of context hierarchy
    2013-12-16 10:43:35,578 INFO  [375] [http-8080-1] xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Chapter32-1\WEB-INF\classes\config\applicationContext-action.xml]
    2013-12-16 10:43:37,437 INFO  [2234] [http-8080-1] xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Chapter32-1\WEB-INF\classes\config\applicationContext-common.xml]
    2013-12-16 10:43:37,843 INFO  [2640] [http-8080-1] xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Chapter32-1\WEB-INF\classes\config\applicationContext-dao.xml]
    2013-12-16 10:43:37,890 INFO  [2687] [http-8080-1] xml.XmlBeanDefinitionReader - Loading XML bean definitions from file [C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Chapter32-1\WEB-INF\classes\config\applicationContext-service.xml]
    2013-12-16 10:43:37,953 INFO  [2750] [http-8080-1] support.XmlWebApplicationContext - Bean factory for application context [org.springframework.web.context.support.XmlWebApplicationContext@60a77c]: org.springframework.beans.factory.support.DefaultListableBeanFactory@283253
    2013-12-16 10:43:38,468 INFO  [3265] [http-8080-1] config.PropertyPlaceholderConfigurer - Loading properties file from URL [file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/Chapter32-1/WEB-INF/classes/config/jdbc.properties]
    2013-12-16 10:43:38,468 INFO  [3265] [http-8080-1] config.PropertyPlaceholderConfigurer - Loading properties file from URL [file:/C:/Program%20Files/Apache%20Software%20Foundation/Tomcat%206.0/webapps/Chapter32-1/WEB-INF/classes/config/hibernate.properties]
    2013-12-16 10:43:38,671 INFO  [3468] [http-8080-1] support.DefaultListableBeanFactory - Pre-instantiating singletons in org.springframework.beans.factory.support.DefaultListableBeanFactory@283253: defining beans [loginAction,userAction,registAction,dataSource,sessionFactory,propertyConfigurer,org.springframework.aop.config.internalAutoProxyCreator,org.springframework.aop.support.DefaultBeanFactoryPointcutAdvisor#0,txAdvice-demo,transactionManager,userDao,userService]; root of factory hierarchy
    2013-12-16 10:43:39,031 INFO  [3828] [http-8080-1] context.ContextLoader - Root WebApplicationContext: initialization completed in 3828 ms
    2013-12-16 10:43:39,421 INFO  [4218] [http-8080-1] providers.XmlConfigurationProvider - Parsing configuration file [struts-default.xml]
    2013-12-16 10:43:40,296 INFO  [5093] [http-8080-1] providers.XmlConfigurationProvider - Parsing configuration file [struts-plugin.xml]
    2013-12-16 10:43:40,359 INFO  [5156] [http-8080-1] providers.XmlConfigurationProvider - Parsing configuration file [struts.xml]
    2013-12-16 10:43:40,375 INFO  [5172] [http-8080-1] config.BeanSelectionProvider - Loading global messages from i18n/MessageResources
    2013-12-16 10:43:40,890 INFO  [5687] [http-8080-1] spring.StrutsSpringObjectFactory - Initializing Struts-Spring integration...
    2013-12-16 10:43:40,890 INFO  [5687] [http-8080-1] spring.SpringObjectFactory - Setting autowire strategy to name
    2013-12-16 10:43:40,890 INFO  [5687] [http-8080-1] spring.StrutsSpringObjectFactory - ... initialized Struts-Spring integration successfully
    2013-12-16 10:43:53,812 WARN  [18609] [http-8080-3] components.ServletUrlRenderer - No configuration found for the specified action: 'login' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
    2013-12-16 10:43:54,671 WARN  [19468] [http-8080-3] components.ServletUrlRenderer - No configuration found for the specified action: 'login' in namespace: ''. Form action defaulting to 'action' attribute's literal value.
    2013-12-16 10:44:01,750 INFO  [26547] [http-8080-3] cfg.Environment - Hibernate 3.3.2.GA
    2013-12-16 10:44:01,781 INFO  [26578] [http-8080-3] cfg.Environment - hibernate.properties not found
    2013-12-16 10:44:01,796 INFO  [26593] [http-8080-3] cfg.Environment - Bytecode provider name : javassist
    2013-12-16 10:44:01,812 INFO  [26609] [http-8080-3] cfg.Environment - using JDK 1.4 java.sql.Timestamp handling
    2013-12-16 10:44:02,359 INFO  [27156] [http-8080-3] cfg.Configuration - Reading mappings from file: C:\Program Files\Apache Software Foundation\Tomcat 6.0\webapps\Chapter32-1\WEB-INF\classes\config\hibernate-hbm\Users.hbm.xml
    2013-12-16 10:44:02,812 INFO  [27609] [http-8080-3] cfg.HbmBinder - Mapping class: com.chinasei.lwframework.user.model.Users -> USERS
    2013-12-16 10:44:02,890 INFO  [27687] [http-8080-3] hibernate3.LocalSessionFactoryBean - Building new Hibernate SessionFactory
    2013-12-16 10:44:03,203 INFO  [28000] [http-8080-3] connection.ConnectionProviderFactory - Initializing connection provider: org.springframework.orm.hibernate3.LocalDataSourceConnectionProvider
    2013-12-16 10:44:03,765 INFO  [28562] [http-8080-3] cfg.SettingsFactory - RDBMS: Microsoft SQL Server, version: 9.00.1399
    2013-12-16 10:44:03,765 INFO  [28562] [http-8080-3] cfg.SettingsFactory - JDBC driver: Microsoft SQL Server JDBC Driver 3.0, version: 3.0.1301.101
    2013-12-16 10:44:03,937 INFO  [28734] [http-8080-3] dialect.Dialect - Using dialect: org.hibernate.dialect.SQLServerDialect
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] transaction.TransactionFactoryFactory - Transaction strategy: org.springframework.orm.hibernate3.SpringTransactionFactory
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] transaction.TransactionManagerLookupFactory - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Automatic flush during beforeCompletion(): disabled
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Automatic session close at end of transaction: disabled
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Scrollable result sets: enabled
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - JDBC3 getGeneratedKeys(): enabled
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Connection release mode: auto
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Default batch fetch size: 1
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Generate SQL with comments: disabled
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Order SQL updates by primary key: disabled
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Order SQL inserts for batching: disabled
    2013-12-16 10:44:04,000 INFO  [28797] [http-8080-3] cfg.SettingsFactory - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
    2013-12-16 10:44:04,015 INFO  [28812] [http-8080-3] ast.ASTQueryTranslatorFactory - Using ASTQueryTranslatorFactory