我创建了maven web项目。现在我想通过昆德拉图书馆连接Cassandra。
我将persistence.xml保存在Pages
文件夹中。但我收到以下错误:
src/main/resources/META-INF/
这意味着它只缺少 javax.persistence.PersistenceException: No Persistence provider for EntityManager named testing
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
kundera.ConnectServlet.connect(ConnectServlet.java:56)
kundera.ConnectServlet.doGet(ConnectServlet.java:34)
javax.servlet.http.HttpServlet.service(HttpServlet.java:621)
javax.servlet.http.HttpServlet.service(HttpServlet.java:728)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:51)
吗?
我的persistence.xml文件包含:
persistence.xml
我的Java代码是:
<persistence xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="testing">
<provider>com.impetus.kundera.KunderaPersistence</provider>
<properties>
<property name="kundera.nodes" value="localhost"/>
<property name="kundera.port" value="9160"/>
<property name="kundera.username" value="cassandra" />
<property name="kundera.password" value="cassandra" />
<property name="kundera.keyspace" value="cma"/>
<property name="kundera.dialect" value="cassandra"/>
<property name="kundera.ddl.auto.prepare" value="create" />
<property name="kundera.ddl.auto.prepare" value="update" />
<property name="kundera.client.lookup.class" value="com.impetus.client.cassandra.thrift.ThriftClientFactory" />
</properties>
</persistence-unit>
</persistence>
那么,对此有什么正确的解决方案?