Hello.
My project is composed by :
The backend is build using spring.
To use JPA, I added a persistence.xml file that looks like that :
In my spring config file, I added:
Then I retrieve the EntityManager in my dao's with :
When I deploy my webapp (with the backend as lib), I got this error :
when spring wants to instantiate my DAO.
I think that it's because the persistence.xml file isn't detected.
I've try to put this file in my webapp or in my backend under /src/main/resources/META-INF.
I use Weblogic.
What do I wrong?
Can someone help me please?
Tks.
Stephane
My project is composed by :
- a backend.jar project that contains entity, dao, services
- a webapp.war file for my webapp.
The backend is build using spring.
To use JPA, I added a persistence.xml file that looks like that :
Code:
<?xml version="1.0" encoding="UTF-8"?>
<persistence version="1.0" 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_1_0.xsd ">
<persistence-unit name="myUnit" transaction-type="JTA">
<provider>org.eclipse.persistence.jpa.PersistenceProvider</provider>
<jta-data-source>db.datasource</jta-data-source>
</persistence-unit>
</persistence>
Code:
<jee:jndi-lookup id="emf" jndi-name="persistence/myUnit" />
Code:
@PersistenceContext
private EntityManager entityManager;
Code:
Caused By: javax.naming.NameNotFoundException: While trying to lookup 'persistence.myUnit' didn't find subcontext 'persistence'. Resolved ''; remaining name 'persistence/myUnit'
at weblogic.jndi.internal.BasicNamingNode.newNameNotFoundException(BasicNamingNode.java:1139)
at weblogic.jndi.internal.BasicNamingNode.lookupHere(BasicNamingNode.java:247)
at weblogic.jndi.internal.ServerNamingNode.lookupHere(ServerNamingNode.java:182)
at weblogic.jndi.internal.BasicNamingNode.lookup(BasicNamingNode.java:206)
at weblogic.jndi.internal.WLEventContextImpl.lookup(WLEventContextImpl.java:254)
Truncated. see log file for complete stacktrace
>
I think that it's because the persistence.xml file isn't detected.
I've try to put this file in my webapp or in my backend under /src/main/resources/META-INF.
I use Weblogic.
What do I wrong?
Can someone help me please?
Tks.
Stephane