Sorry for the cross post: Java Database Connectivity (JDBC) forum...
http://forum.java.sun.com/thread.jspa?threadID=5169272
I am trying to use Java Persistence API outside a container. I get the following error:
[code]
javax.persistence.PersistenceException: No Persistence provider for EntityManager named default
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:89)
at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:60)
at com.sita.txns.unmarshal.main(unmarshal.java:25)
[/code]
[b]Main class:[/b]
[code]
public static void main(String[] args) {
// TODO Auto-generated method stub
try {
...
...
EntityManagerFactory emf = Persistence.createEntityManagerFactory("default");
...
...
} catch (Exception ex) {
ex.printStackTrace();
}
}
[/code]
[b]persistence.xml[/b]
[code]
<persistence>
<persistence-unit name="default" transaction-type="RESOURCE_LOCAL">
<provider>
oracle.toplink.essentials.PersistenceProvider
</provider>
<class>com.sita.txns.persistence.Inventory</class>
<class>com.sita.txns.persistence.Order</class>
<class>com.sita.txns.persistence.Item</class>
<properties>
<property name="toplink.logging.level" value="FINE"/>
<property name="toplink.jdbc.driver" value="oracle.jdbc.OracleDriver"/> <!-- update to match database-->
<property name="toplink.jdbc.url" value="jdbc:oracle:thin:@localhost:1521:XE;create=true"/> <!-- update to match database-->
<property name="toplink.jdbc.user" value="sita"/> <!-- update to match database-->
<property name="toplink.jdbc.password" value="txn"/> <!-- update to match database-->
</properties>
</persistence-unit>
</persistence>
[/code]
[b]Any ideas?????[/b]
I have placed the persistence.xml everywhere. The folder it is in is explicitly on the classpath.
I included the toplink jars from oracle.
http://www.oracle.com/technology/products/ias/toplink/jpa/download.html
3RD-PARTY-LICENSE.txt
CDDLv1.0.txt
README
toplink-essentials-agent.jar
toplink-essentials.jar
Thanks, Paul
[Message sent by forum member 'pbaker01' (pbaker01)]
http://forums.java.net/jive/thread.jspa?messageID=215697