com.mysql.jdbc.Driver  已经在lib 下了啊 

解决方案 »

  1.   


    // =====================我这样可以连上,mysql5.0+的版本=============<bean id="dataSourceMysql"
    class="org.apache.commons.dbcp.BasicDataSource"
    destroy-method="close">
    <property name="driverClassName">
    <value>org.gjt.mm.mysql.Driver</value>
    </property>
    <property name="url">
    <value>jdbc:mysql://localhost:3306/test</value>
    </property>
    <property name="username">
    <value>root</value>
    </property>
    <property name="password">
    <value></value>
    </property>
    </bean>
      

  2.   

    这样还是有错误!
    09:05:52,984  INFO org.springframework.orm.hibernate3.LocalSessionFactoryBean:749 - Building new Hibernate SessionFactory
    09:05:53,687  WARN net.sf.ehcache.config.Configurator:126 - No configuration found. Configuring ehcache from ehcache-failsafe.xml found in the classpath: jar:file:/D:/eclipse/workspace/testProject/WEB-INF/lib/hibernate3.0.5/lib/ehcache-1.1.jar!/ehcache-failsafe.xml
    09:05:54,812  INFO org.springframework.orm.hibernate3.HibernateTransactionManager:396 - Using DataSource [org.apache.commons.dbcp.BasicDataSource@1cebc9f] of Hibernate SessionFactory for HibernateTransactionManager
    09:05:54,843  INFO org.springframework.orm.hibernate3.LocalSessionFactoryBean:1028 - Closing Hibernate SessionFactory
    java.lang.ExceptionInInitializerError
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:274)
    at junit.framework.TestSuite.createTest(TestSuite.java:131)
    at junit.framework.TestSuite.addTestMethod(TestSuite.java:114)
    at junit.framework.TestSuite.<init>(TestSuite.java:75)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.getTest(RemoteTestRunner.java:399)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:445)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:344)
    at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:196)
    Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'dao' defined in file [D:\eclipse\workspace\testProject\WEB-INF\classes\com\config\applicationContext-hibernate.xml]: Error setting property values; nested exception is PropertyAccessExceptionsException (1 errors)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1066)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.populateBean(AbstractAutowireCapableBeanFactory.java:857)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:378)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:233)
    at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:145)
    at org.springframework.beans.factory.support.DefaultListableBeanFactory.preInstantiateSingletons(DefaultListableBeanFactory.java:283)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:313)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:87)
    at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.java:72)
    at com.service.base.dao.BaseDAOTestCase.<clinit>(BaseDAOTestCase.java:36)
    ... 11 more
    Caused by: PropertyAccessExceptionsException (1 errors)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:781)
    at org.springframework.beans.BeanWrapperImpl.setPropertyValues(BeanWrapperImpl.java:753)
    at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.applyPropertyValues(AbstractAutowireCapableBeanFactory.java:1057)
    ... 20 more
      

  3.   

    09:05:54,843  INFO org.springframework.orm.hibernate3.LocalSessionFactoryBean:1028 - Closing Hibernate SessionFactory为什么close了
      

  4.   

    我用的是 hibernate3 为什么总是提示 早不到 net/sf/hibernate/SessionFactory 这个好象是2的包,我上面的配置文件哪个用了2的包???