首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >OpenJPA连接错误

OpenJPA连接错误
EN

Stack Overflow用户
提问于 2012-11-23 15:08:54
回答 1查看 4K关注 0票数 1

我将在OpenJPA -> http://plunchete.wordpress.com/2007/05/06/using-openjpa/上学习本教程

我得到了这个错误:

代码语言:javascript
复制
160  INFO   [main] openjpa.Runtime - OpenJPA dynamically loaded the class enhancer. Any classes that were not enhanced at build time will be enhanced when they are loaded by the JVM.
188  INFO   [main] openjpa.Runtime - Starting OpenJPA 2.2.1
Exception in thread "main" <openjpa-2.2.1-r422266:1396819 fatal user error
org.apache.openjpa.persistence.ArgumentException: A JDBC Driver or DataSource class
name must be specified in the ConnectionDriverName property. Available properties in
configuration are "org.apache.openjpa.jdbc.conf.JDBCConfigurationImpl@442ce698".
at
org.apache.openjpa.jdbc.schema.DataSourceFactory.newDataSource(DataSourceFactory.java:72)

Persistence.xml是这样的:

代码语言:javascript
复制
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0">
<persistence-unit name="example" transaction-type="RESOURCE_LOCAL">
<provider>
org.apache.openjpa.persistence.PersistenceProviderImpl
</provider>
<class>Person</class>
<properties>
<property name="openjpa.jdbc.SynchronizeMappings" value="buildSchema" />
<property name="openjpa.ConnectionDriverName" value="com.mysql.jdbc.Driver" />
<property name="openjpa.ConnectionURL" value="jdbc:mysql://localhost:3306/cs5200" /
<property name="openjpa.ConnectionUserName" value="root" />
<property name="openjpa.ConnectionPassword" value="" />
</properties>
</persistence-unit>
</persistence>
EN

回答 1

Stack Overflow用户

发布于 2012-11-23 16:17:22

错误是文件夹结构错误。

META-INF应该在src文件夹中。

事情不是这样的。我研究和测试了不同的东西,并提出了这个解决方案。

我希望它能在将来对某些人有所帮助。

票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/13524516

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档