我的情况是这样的启动tomcat 服务器。后台没输出什么解析spring配置文件的信息。。
applicationConfiguration 的配置如下。<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean> <bean id="animalAction" class="com.lion.king.action.animal.AnimalAction">
<property name="as">
<ref bean="animalService"/>
</property>
</bean> <bean id="animalDAO" class="com.lion.king.DAO.animal.AnimalDAOImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="animalService" class="com.lion.king.service.animal.AnimalServiceImpl">
<property name="adi">
<ref bean="animalDAO"/>
</property>
</bean>
</beans>
说明。。我已经把实体类的配置在了 hibernate.cfg.xml中,而且数据库已经生成表(bean的属性我是从类里面copy来的 绝对没写错)
但是控制台没看到打印出说明解析配置文件的信息
我的log4f.xml配置如下
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=WARN
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.logger.org.hibernate=debug
logger.org.springframework=DEBUG
### log HQL query parser activity
log4j.logger.org.hibernate.hql.ast.AST=debug### log just the SQL
log4j.logger.org.hibernate.SQL=CONSOLE### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug### log HQL parse trees
log4j.logger.org.hibernate.hql=debug各位帮助解决下,如果还需要晒什么文件出来,请留言!!!!!!!!!坐等
applicationConfiguration 的配置如下。<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN 2.0//EN"
"http://www.springframework.org/dtd/spring-beans-2.0.dtd"><beans>
<bean id="sessionFactory" class="org.springframework.orm.hibernate3.LocalSessionFactoryBean">
<property name="configLocation">
<value>classpath:hibernate.cfg.xml</value>
</property>
</bean> <bean id="animalAction" class="com.lion.king.action.animal.AnimalAction">
<property name="as">
<ref bean="animalService"/>
</property>
</bean> <bean id="animalDAO" class="com.lion.king.DAO.animal.AnimalDAOImpl">
<property name="sessionFactory">
<ref bean="sessionFactory" />
</property>
</bean>
<bean id="animalService" class="com.lion.king.service.animal.AnimalServiceImpl">
<property name="adi">
<ref bean="animalDAO"/>
</property>
</bean>
</beans>
说明。。我已经把实体类的配置在了 hibernate.cfg.xml中,而且数据库已经生成表(bean的属性我是从类里面copy来的 绝对没写错)
但是控制台没看到打印出说明解析配置文件的信息
我的log4f.xml配置如下
### direct log messages to stdout ###
log4j.appender.stdout=org.apache.log4j.ConsoleAppender
log4j.appender.stdout.Target=System.out
log4j.appender.stdout.layout=org.apache.log4j.PatternLayout
# Print the date in ISO 8601 format
log4j.appender.A1.layout.ConversionPattern=%d [%t] %-5p %c - %m%n
### direct messages to file hibernate.log ###
#log4j.appender.file=org.apache.log4j.FileAppender
#log4j.appender.file.File=hibernate.log
#log4j.appender.file.layout=org.apache.log4j.PatternLayout
log4j.appender.file.layout.ConversionPattern=%d{ABSOLUTE} %5p %c{1}:%L - %m%n### set log levels - for more verbose logging change 'info' to 'debug' ###
log4j.rootLogger=WARN
log4j.appender.A1=org.apache.log4j.ConsoleAppender
log4j.appender.A1.layout=org.apache.log4j.PatternLayout
log4j.logger.org.hibernate=debug
logger.org.springframework=DEBUG
### log HQL query parser activity
log4j.logger.org.hibernate.hql.ast.AST=debug### log just the SQL
log4j.logger.org.hibernate.SQL=CONSOLE### log JDBC bind parameters ###
#log4j.logger.org.hibernate.type=info
#log4j.logger.org.hibernate.type=debug### log schema export/update ###
log4j.logger.org.hibernate.tool.hbm2ddl=debug### log HQL parse trees
log4j.logger.org.hibernate.hql=debug各位帮助解决下,如果还需要晒什么文件出来,请留言!!!!!!!!!坐等
解决方案 »
- 请各位大侠帮忙分析一下这个错误~!
- SQL问题,来帮帮忙啊
- /struts-tags
- 面试问题如何回答?
- 请教了:ibatis怎样查询某个时间范围内的记录?
- 谁来帮我解释下个TOMCAT的提示问题
- hibernate3.0连接sql server2000问题
- jsf ,sturts,Tapestry框架学习
- hibernate连接oracle数据库出错!请问如何解决?谢谢
- 用xdoclet生成hibernate映射文件的复合主键,怎么实现啊,头疼了半边
- struts2.0的基础问题
- 总是出现SQLServer 2000 Driver for JDBC]Connection reset 异常,大家帮忙看下
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:applicationContext-common.xml
</param-value>
</context-param> <!-- 配置Spring -->
<listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="http://java.sun.com/xml/ns/javaee"
xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
version="2.5">
<!-- 欢迎页面 -->
<welcome-file-list>
<welcome-file>/login/login.jsp</welcome-file>
</welcome-file-list>
<!-- spring 监听器配置 -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:applicationConfiguration*.xml</param-value>
</context-param> <listener>
<listener-class>
org.springframework.web.context.ContextLoaderListener
</listener-class>
</listener>
<!-- struts 过滤器配置 --> <filter>
<filter-name>struts2</filter-name>
<filter-class>
org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter
</filter-class>
</filter>
<filter-mapping>
<filter-name>struts2</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- 著名 Character Encoding filter -->
<filter>
<filter-name>encodingFilter</filter-name>
<filter-class>org.springframework.web.filter.CharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>UTF-8</param-value>
</init-param>
</filter>
<!--Hibernate Open Session in View Filter-->
<filter>
<filter-name>hibernateFilter</filter-name>
<filter-class>org.springframework.orm.hibernate3.support.OpenSessionInViewFilter</filter-class>
</filter>
<!-- Spring 刷新Introspector防止内存泄露 -->
<listener>
<listener-class>org.springframework.web.util.IntrospectorCleanupListener</listener-class>
</listener>
<!-- session超时定义,单位为分钟 -->
<session-config>
<session-timeout>5</session-timeout>
</session-config>
</web-app>
这个是我的web.xml
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.
就这个
还是有这个。
log4j:WARN No appenders could be found for logger (org.hibernate.type.BasicTypeRegistry).
log4j:WARN Please initialize the log4j system properly.
log4j:WARN See http://logging.apache.org/log4j/1.2/faq.html#noconfig for more info.