sfr*_*frj 5 java mysql hibernate driver
当使用 hibernate 连接到 MySQLDB 并添加数据时,我遇到了一个非常奇怪的问题。
这是我得到的错误:
未找到 JDBC 驱动程序类:com.mysql.jdbc.Driver
这就是我的 hibernate.cfg.xml 的样子
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<property name="hibernate.connection.driver_class">com.mysql.jdbc.Driver</property>
<property name="hibernate.connection.url">jdbc:mysql://localhost:3306/fpa-webapp</property>
<property name="hibernate.dialect">org.hibernate.dialect.MySQLInnoDBDialect</property>
<property name="hibernate.connection.username">root</property>
<property name="hibernate.connection.password"></property>
<property name="hbm2ddl.auto">update</property>
<property name="hibernate.show_sql">true</property>
<property name="hibernate.format_sql">true</property>
</session-factory>
</hibernate-configuration>
Run Code Online (Sandbox Code Playgroud)
我不明白为什么当我导航到应用程序时会看到 500 错误;它说找不到驱动程序。
HTTP 错误 500
访问 /fpa-webapp/ 时出现问题。原因:
Run Code Online (Sandbox Code Playgroud)Exception constructing service 'ValueEncoderSource': Error invoking
服务构建器方法 org.apache.tapestry5.services.TapestryModule.buildValueEncoderSource(Map, InvalidationEventHub) (位于 TapestryModule.java:2287)(对于服务“ValueEncoderSource”):调用服务贡献方法 org.apache.tapestry5.hibernate.HibernateModule 时出错。贡献ValueEncoderSource(MappedConfiguration,boolean,HibernateSessionSource,Session,TypeCoercer,PropertyAccess,LoggerSource):构造服务'HibernateSessionSource'时出现异常:调用服务构建器方法org.apache.tapestry5.hibernate.HibernateCoreModule.buildHibernateSessionSource(Logger,List,RegistryShutdownHub)时出错(位于HibernateCoreModule) .java:123)(对于服务“HibernateSessionSource”):找不到 JDBC 驱动程序类:com.mysql.jdbc.Driver
我确信驱动程序位于类路径中。
可能是什么?
归档时间: |
|
查看次数: |
16910 次 |
最近记录: |