以下のコードを使用してEntityManagerを検索しようとしていますが、エラーが発生しています。私はそれをgoogledが、私はそれから何も得ることができませんでした。 これはジャーの問題のためです。私にいくつかの指針を案内してください。weblogic上のJPA EntityManagerのルックアップに関するクラスキャスト例外
私はweblogicバージョン12.1.3を使用しています。 JNDIツリーで
- >私は、JNDI名 "jpaem" を持っても、私はこのJNDIのために、それに気づいた - それは、クラスを示す: weblogic.jdbc.common.internal.RmiDataSource_12130_WLStub
Exception in thread "main" java.lang.ClassCastException: weblogic.jdbc.common.internal.RmiDataSource_12130_WLStub cannot be cast to javax.persistence.EntityManager
at JNDITest.main(JNDITest.java:33)
EntityManager entityManager = (EntityManager) context.lookup("jpaem");
My persistance.xml
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="2.1"
xmlns="http://xmlns.jcp.org/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/persistence http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd">
<persistence-unit name="Eclipselink_JPA" transaction-type="JTA">
<jta-data-source>jpaem</jta-data-source>
<class>jpa.Faxerror</class>
<properties>
<property name="eclipselink.target-database" value="Oracle" />
<property name="eclipselink.target-server" value="WebLogic" />
<property name="javax.persistence.jtaDataSource" value="jpaem"/>
</properties>
</persistence-unit>
</persistence>