回复:ldg_2(绿豆糕) 按你的方法,我把那个XML文件放到了 classes 目录下,产生新的错误日志: --------------------------------- 09:24:01,833 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/E:/My%20Web/MSInfoSys/WEB-INF/classes/ehcache-failsafe.xml --------------------------------- 这是怎么回事,也就是这里,老是警告 configuration 找不到
回复:jyh_jack() 我的发布包中有 log4j.properties 这个包了
回复:eddie404956() 我现用的就是最新的 MyEclipse 5.0
No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/workspace/HibernateText/lib/ehcache-1.1.jar!/ehcache-failsafe.xml我这里也是这么显示的,但是运行很正常,你再看看下面有没有什么错误提示,把提示的内容全贴出来.
这是应用了 struts 结构提示信息,里面还是有那个错误 ----------------------------------------------------- log4j:WARN No appenders could be found for logger (org.apache.catalina.session.ManagerBase). log4j:WARN Please initialize the log4j system properly. 16:29:01,352 INFO Environment:464 - Hibernate 3.0.2 16:29:01,362 INFO Environment:477 - hibernate.properties not found 16:29:01,372 INFO Environment:510 - using CGLIB reflection optimizer 16:29:01,372 INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling 16:29:01,862 INFO Configuration:1160 - configuring from resource: /hibernate.cfg.xml 16:29:01,862 INFO Configuration:1131 - Configuration resource: /hibernate.cfg.xml 16:29:02,053 INFO Configuration:441 - Mapping resource: com/yourcompany/ManagerList.hbm.xml 16:29:02,263 INFO HbmBinder:258 - Mapping class: com.yourcompany.ManagerList -> ManagerList 16:29:02,313 INFO Configuration:1272 - Configured SessionFactory: null 16:29:02,313 INFO Configuration:852 - processing extends queue 16:29:02,313 INFO Configuration:856 - processing collection mappings 16:29:02,313 INFO Configuration:865 - processing association property references 16:29:02,313 INFO Configuration:894 - processing foreign key constraints 16:29:02,563 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!) 16:29:02,563 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20 16:29:02,563 INFO DriverManagerConnectionProvider:45 - autocommit mode: false 16:29:02,573 INFO DriverManagerConnectionProvider:80 - using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MsNews;SelectMethod=cursor 16:29:02,573 INFO DriverManagerConnectionProvider:86 - connection properties: {user=sa, password=****} 16:29:02,814 INFO SettingsFactory:71 - RDBMS: Microsoft SQL Server, version: Microsoft SQL Server 2000 - 8.00.2039 (Intel X86) May 3 2005 23:18:38 Copyright (c) 1988-2003 Microsoft Corporation Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)16:29:02,814 INFO SettingsFactory:72 - JDBC driver: SQLServer, version: 2.2.0029 16:29:02,884 INFO Dialect:92 - Using dialect: org.hibernate.dialect.SQLServerDialect 16:29:02,894 INFO SettingsFactory:130 - Scrollable result sets: enabled 16:29:02,894 INFO SettingsFactory:138 - JDBC3 getGeneratedKeys(): disabled 16:29:02,894 INFO SettingsFactory:150 - Aggressive release : disabled 16:29:02,904 INFO SettingsFactory:166 - Default batch fetch size: 1 16:29:02,904 INFO SettingsFactory:170 - Generate SQL with comments: disabled 16:29:02,904 INFO SettingsFactory:174 - Order SQL updates by primary key: disabled 16:29:02,904 INFO SettingsFactory:312 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory 16:29:02,954 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory 16:29:02,954 INFO SettingsFactory:182 - Query language substitutions: {} 16:29:02,964 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions) 16:29:02,964 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended) 16:29:02,974 INFO SettingsFactory:191 - Automatic flush during beforeCompletion(): disabled 16:29:02,974 INFO SettingsFactory:195 - Automatic session close at end of transaction: disabled 16:29:02,974 INFO SettingsFactory:201 - Second-level cache: enabled 16:29:02,974 INFO SettingsFactory:205 - Query cache: disabled 16:29:02,974 INFO SettingsFactory:299 - Cache provider: org.hibernate.cache.EhCacheProvider 16:29:03,375 INFO SettingsFactory:220 - Optimize cache for minimal puts: disabled 16:29:03,375 INFO SettingsFactory:229 - Structured second-level cache entries: enabled 16:29:03,395 INFO SettingsFactory:253 - Statistics: disabled 16:29:03,395 INFO SettingsFactory:257 - Deleted entity synthetic identifier rollback: disabled 16:29:03,405 INFO SettingsFactory:271 - Default entity-mode: pojo 16:29:03,665 INFO SessionFactoryImpl:148 - building session factory 16:29:03,685 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/My%20Web/test/WebRoot/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml Initial SessionFactory creation failed.org.hibernate.MappingException: could not instantiate id generator 16:29:03,935 ERROR [action]:253 - Servlet.service() for servlet action threw exception java.lang.ExceptionInInitializerError at com.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:22) at com.yourcompany.struts.form.AddAdminForm.validate(AddAdminForm.java:52) at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942) at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255) at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482) at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507) at javax.servlet.http.HttpServlet.service(HttpServlet.java:689) at javax.servlet.http.HttpServlet.service(HttpServlet.java:802) at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252) at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173) at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213) at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178) at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126) at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105) at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107) at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148) at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869) at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667) at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527) at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80) at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684) at java.lang.Thread.run(Thread.java:595) Caused by: org.hibernate.MappingException: could not instantiate id generator at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:92) at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:151) at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:174) at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055) at com.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:18) ... 21 more Caused by: org.hibernate.MappingException: could not interpret id generator strategy: hilo.hex at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass(IdentifierGeneratorFactory.java:103) at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:86) ... 25 more
Caused by: org.hibernate.MappingException: could not interpret id generator strategy: hilo.hex at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass主键生成器有问题
ehcache-1.1.jar
你最好在发布的目录中建一个log4j.properties文件.
//log4j.properties内容如下----------
log4j.rootLogger=info,CONSOLE
log4j.appender.CONSOLE=org.apache.log4j.ConsoleAppender
log4j.appender.CONSOLE.Target=System.out
log4j.appender.CONSOLE.layout=org.apache.log4j.PatternLayout
log4j.appender.CONSOLE.layout.ConversionPattern= %4p [%t] (%F:%L) - %m%n
//--------------
当然lib中要有log4j-1.2.11.jar的
然后再运行看看,这样能看到明确的错误是什么.
按你的方法,我把那个XML文件放到了 classes 目录下,产生新的错误日志:
---------------------------------
09:24:01,833 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: file:/E:/My%20Web/MSInfoSys/WEB-INF/classes/ehcache-failsafe.xml
---------------------------------
这是怎么回事,也就是这里,老是警告 configuration 找不到
我的发布包中有 log4j.properties 这个包了
我现用的就是最新的 MyEclipse 5.0
-----------------------------------------------------
log4j:WARN No appenders could be found for logger (org.apache.catalina.session.ManagerBase).
log4j:WARN Please initialize the log4j system properly.
16:29:01,352 INFO Environment:464 - Hibernate 3.0.2
16:29:01,362 INFO Environment:477 - hibernate.properties not found
16:29:01,372 INFO Environment:510 - using CGLIB reflection optimizer
16:29:01,372 INFO Environment:540 - using JDK 1.4 java.sql.Timestamp handling
16:29:01,862 INFO Configuration:1160 - configuring from resource: /hibernate.cfg.xml
16:29:01,862 INFO Configuration:1131 - Configuration resource: /hibernate.cfg.xml
16:29:02,053 INFO Configuration:441 - Mapping resource: com/yourcompany/ManagerList.hbm.xml
16:29:02,263 INFO HbmBinder:258 - Mapping class: com.yourcompany.ManagerList -> ManagerList
16:29:02,313 INFO Configuration:1272 - Configured SessionFactory: null
16:29:02,313 INFO Configuration:852 - processing extends queue
16:29:02,313 INFO Configuration:856 - processing collection mappings
16:29:02,313 INFO Configuration:865 - processing association property references
16:29:02,313 INFO Configuration:894 - processing foreign key constraints
16:29:02,563 INFO DriverManagerConnectionProvider:41 - Using Hibernate built-in connection pool (not for production use!)
16:29:02,563 INFO DriverManagerConnectionProvider:42 - Hibernate connection pool size: 20
16:29:02,563 INFO DriverManagerConnectionProvider:45 - autocommit mode: false
16:29:02,573 INFO DriverManagerConnectionProvider:80 - using driver: com.microsoft.jdbc.sqlserver.SQLServerDriver at URL: jdbc:microsoft:sqlserver://localhost:1433;DatabaseName=MsNews;SelectMethod=cursor
16:29:02,573 INFO DriverManagerConnectionProvider:86 - connection properties: {user=sa, password=****}
16:29:02,814 INFO SettingsFactory:71 - RDBMS: Microsoft SQL Server, version: Microsoft SQL Server 2000 - 8.00.2039 (Intel X86)
May 3 2005 23:18:38
Copyright (c) 1988-2003 Microsoft Corporation
Developer Edition on Windows NT 5.1 (Build 2600: Service Pack 2)16:29:02,814 INFO SettingsFactory:72 - JDBC driver: SQLServer, version: 2.2.0029
16:29:02,884 INFO Dialect:92 - Using dialect: org.hibernate.dialect.SQLServerDialect
16:29:02,894 INFO SettingsFactory:130 - Scrollable result sets: enabled
16:29:02,894 INFO SettingsFactory:138 - JDBC3 getGeneratedKeys(): disabled
16:29:02,894 INFO SettingsFactory:150 - Aggressive release : disabled
16:29:02,904 INFO SettingsFactory:166 - Default batch fetch size: 1
16:29:02,904 INFO SettingsFactory:170 - Generate SQL with comments: disabled
16:29:02,904 INFO SettingsFactory:174 - Order SQL updates by primary key: disabled
16:29:02,904 INFO SettingsFactory:312 - Query translator: org.hibernate.hql.ast.ASTQueryTranslatorFactory
16:29:02,954 INFO ASTQueryTranslatorFactory:21 - Using ASTQueryTranslatorFactory
16:29:02,954 INFO SettingsFactory:182 - Query language substitutions: {}
16:29:02,964 INFO TransactionFactoryFactory:31 - Using default transaction strategy (direct JDBC transactions)
16:29:02,964 INFO TransactionManagerLookupFactory:33 - No TransactionManagerLookup configured (in JTA environment, use of read-write or transactional second-level cache is not recommended)
16:29:02,974 INFO SettingsFactory:191 - Automatic flush during beforeCompletion(): disabled
16:29:02,974 INFO SettingsFactory:195 - Automatic session close at end of transaction: disabled
16:29:02,974 INFO SettingsFactory:201 - Second-level cache: enabled
16:29:02,974 INFO SettingsFactory:205 - Query cache: disabled
16:29:02,974 INFO SettingsFactory:299 - Cache provider: org.hibernate.cache.EhCacheProvider
16:29:03,375 INFO SettingsFactory:220 - Optimize cache for minimal puts: disabled
16:29:03,375 INFO SettingsFactory:229 - Structured second-level cache entries: enabled
16:29:03,395 INFO SettingsFactory:253 - Statistics: disabled
16:29:03,395 INFO SettingsFactory:257 - Deleted entity synthetic identifier rollback: disabled
16:29:03,405 INFO SettingsFactory:271 - Default entity-mode: pojo
16:29:03,665 INFO SessionFactoryImpl:148 - building session factory
16:29:03,685 WARN Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/E:/My%20Web/test/WebRoot/WEB-INF/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
Initial SessionFactory creation failed.org.hibernate.MappingException: could not instantiate id generator
16:29:03,935 ERROR [action]:253 - Servlet.service() for servlet action threw exception
java.lang.ExceptionInInitializerError
at com.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:22)
at com.yourcompany.struts.form.AddAdminForm.validate(AddAdminForm.java:52)
at org.apache.struts.action.RequestProcessor.processValidate(RequestProcessor.java:942)
at org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:255)
at org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
at org.apache.struts.action.ActionServlet.doGet(ActionServlet.java:507)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:689)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:252)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:173)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:213)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:178)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:126)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:105)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:107)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:148)
at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:869)
at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.processConnection(Http11BaseProtocol.java:667)
at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
at java.lang.Thread.run(Thread.java:595)
Caused by: org.hibernate.MappingException: could not instantiate id generator
at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:92)
at org.hibernate.mapping.SimpleValue.createIdentifierGenerator(SimpleValue.java:151)
at org.hibernate.impl.SessionFactoryImpl.<init>(SessionFactoryImpl.java:174)
at org.hibernate.cfg.Configuration.buildSessionFactory(Configuration.java:1055)
at com.HibernateSessionFactory.<clinit>(HibernateSessionFactory.java:18)
... 21 more
Caused by: org.hibernate.MappingException: could not interpret id generator strategy: hilo.hex
at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass(IdentifierGeneratorFactory.java:103)
at org.hibernate.id.IdentifierGeneratorFactory.create(IdentifierGeneratorFactory.java:86)
... 25 more
at org.hibernate.id.IdentifierGeneratorFactory.getIdentifierGeneratorClass主键生成器有问题