Eclipse3.2.1中不能连接MySQL数据库
我使用Eclipse3.2.1(WTP)+Spring2.0+Hibernate3编写一个很简单的数据库访问的WEB程序,数据库用的是MySQL5.0,spring.jar和mysql-connector-java-5.0.0-beta-bin.jar已加入到CLASSPATH中,但在启动TOMCAT后依然出错,调试了很长时间,请各位大虾帮帮忙,看看错在哪里,一定加分!
出错信息:
2007-2-24 10:20:09 org.apache.catalina.core.AprLifecycleListener lifecycleEvent
信息: The Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path: C:\Program Files\Java\jre1.5.0_10\bin;.;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;D:\Program Files\Java\jdk1.5.0_08\BIN;D:\Program Files\Real\Helix Producer Plus;d:\ant\bin;D:\Program Files\Microsoft Visual Studio\Common\Tools\WinNT;D:\Program Files\Microsoft Visual Studio\Common\MSDev98\Bin;D:\Program Files\Microsoft Visual Studio\Common\Tools;D:\Program Files\Microsoft Visual Studio\VC98\bin
2007-2-24 10:20:10 org.apache.coyote.http11.Http11BaseProtocol init
信息: Initializing Coyote HTTP/1.1 on http-8080
2007-2-24 10:20:10 org.apache.catalina.startup.Catalina load
信息: Initialization processed in 1375 ms
2007-2-24 10:20:10 org.apache.catalina.core.StandardService start
信息: Starting service Catalina
2007-2-24 10:20:10 org.apache.catalina.core.StandardEngine start
信息: Starting Servlet Engine: Apache Tomcat/5.5.17
2007-2-24 10:20:10 org.apache.catalina.core.StandardHost start
信息: XML validation disabled
2007-2-24 10:20:11 org.springframework.web.servlet.HttpServletBean init
信息: Initializing servlet 'classmaster '
2007-2-24 10:20:11 org.springframework.core.CollectionFactory <clinit>
信息: JDK 1.4+ collections available
2007-2-24 10:20:11 org.springframework.web.servlet.FrameworkServlet initServletBean
信息: FrameworkServlet 'classmaster ': initialization started
2007-2-24 10:20:11 org.apache.catalina.core.ApplicationContext log
信息: Loading WebApplicationContext for Spring FrameworkServlet 'classmaster '
2007-2-24 10:20:11 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions
信息: Loading XML bean definitions from ServletContext resource [/WEB-INF/classmaster-servlet.xml]
2007-2-24 10:20:11 org.springframework.context.support.AbstractRefreshableApplicationContext refreshBeanFactory
信息: Bean factory for application context [WebApplicationContext for namespace 'classmaster-servlet ']: org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,userDAO,userDAOProxy,/test.htm,viewResolver]; root of BeanFactory hierarchy
2007-2-24 10:20:11 org.springframework.context.support.AbstractApplicationContext refresh
信息: 7 beans defined in application context [WebApplicationContext for namespace 'classmaster-servlet ']
2007-2-24 10:20:11 org.springframework.context.support.AbstractApplicationContext initMessageSource
信息: Unable to locate MessageSource with name 'messageSource ': using default [org.springframework.context.support.DelegatingMessageSource@18b3364]
2007-2-24 10:20:11 org.springframework.context.support.AbstractApplicationContext initApplicationEventMulticaster
信息: Unable to locate ApplicationEventMulticaster with name 'applicationEventMulticaster ': using default [org.springframework.context.event.SimpleApplicationEventMulticaster@1175422]
2007-2-24 10:20:11 org.springframework.ui.context.support.UiApplicationContextUtils initThemeSource
信息: Unable to locate ThemeSource with name 'themeSource ': using default [org.springframework.ui.context.support.ResourceBundleThemeSource@4aa0ce]
2007-2-24 10:20:11 org.springframework.beans.factory.support.DefaultListableBeanFactory preInstantiateSingletons
信息: Pre-instantiating singletons in factory [org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,userDAO,userDAOProxy,/test.htm,viewResolver]; root of BeanFactory hierarchy]
2007-2-24 10:20:11 org.springframework.jdbc.datasource.DriverManagerDataSource setDriverClassName
信息: Loaded JDBC driver: com.mysql.jdbc.Driver
2007-2-24 10:20:11 org.springframework.beans.factory.support.DefaultSingletonBeanRegistry destroySingletons
信息: Destroying singletons in {org.springframework.beans.factory.support.DefaultListableBeanFactory defining beans [dataSource,sessionFactory,transactionManager,userDAO,userDAOProxy,/test.htm,viewResolver]; root of BeanFactory hierarchy}
2007-2-24 10:20:11 org.springframework.web.servlet.FrameworkServlet initServletBean
严重: Context initialization failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'sessionFactory ' defined in ServletContext resource [/WEB-INF/classmaster-servlet.xml]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [org.springframework.orm.hibernate3.LocalSessionFactoryBean]: Constructor threw exception; nested exception is java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
Caused by: java.lang.NoClassDefFoundError: org.hibernate.cfg.Configuration
at org.springframework.orm.hibernate3.LocalSessionFactoryBean.class$(LocalSessionFactoryBean.java:157)
at org.springframework.orm.hibernate3.LocalSessionFactoryBean. <init> (LocalSessionFactoryBean.java:157)
[解决办法]
org.hibernate.cfg.Configuration
这个类找不到
hibernate3.jar
放到classpath里面灭有