Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

JPA error

Hello Experts,

I am developing a proof of concept wherein I am creating JPA entities in Dynamic web project and using a servlet to retrieve information.

Please ignore the name odata in below code snippets as ithis has nothing to do with odata.

I am getting below error :

WebServletException: Web container failed to find a resource needed for injection, the following class [com.EXIDVPServFactory] cannot be put into service.

Caused by: java.lang.RuntimeException: The persistence unit is inconsistent with the database schema:

Error on entity >>model.ZaeExidvp<<: The table >>ZAE_EXIDVP<< does not exist.

My persistence.xml looks like :

<?xml version="1.0" encoding="UTF-8"?>

<persistence version="1.0" xmlns="" xmlns:xsi="" xsi:schemaLocation="">

  <persistence-unit name="basicodata" transaction-type="RESOURCE_LOCAL">





                     <property name="javax.persistence.jdbc.url" value="XXXXXXXXXXXX"/>

                     <property name="javax.persistence.jdbc.user" value="sapsr3db"/>

                     <property name="javax.persistence.jdbc.password" value="XXXXXX"/>

                     <property name="javax.persistence.jdbc.driver" value="oracle.jdbc.driver.OracleDriver"/>




The servlet that I am using is :

package com;


import model.*;

import javax.servlet.ServletException;

import javax.servlet.http.HttpServlet;

import javax.servlet.http.HttpServletRequest;

import javax.servlet.http.HttpServletResponse;

import javax.persistence.*;


* Servlet implementation class EXIDVPServFactory


public class EXIDVPServFactory extends HttpServlet {

  //@PersistenceUnit (unitName = "basicodata")

  private static final String PERSISTENCE_UNIT_NAME = "basicodata";


  private static final long serialVersionUID = 1L;



     * @see HttpServlet#HttpServlet()


    public EXIDVPServFactory() {


        // TODO Auto-generated constructor stub



  * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse response)


  protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

  //EntityManager em = emf.createEntityManager();

  EntityManagerFactory emf = Persistence.createEntityManagerFactory(PERSISTENCE_UNIT_NAME);

  EntityManager em = emf.createEntityManager();

  // ODataJPAContext oDatJPAContext = this.getODataJPAContext();

  String aufnr = request.getParameter("aufnr");

  ZaeExidvp exidvp = em.find(ZaeExidvp.class, aufnr);




  * @see HttpServlet#doPost(HttpServletRequest request, HttpServletResponse response)


  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

  // TODO Auto-generated method stub



CLASS ZAE_EXIDVP (Entity object)

package model;


import javax.persistence.*;

import java.sql.Timestamp;


* The persistent class for the ZAE_EXIDVP database table.





public class ZaeExidvp implements Serializable {

  private static final long serialVersionUID = 1L;


  private ZaeExidvpPK id;

    public ZaeExidvp() {


  public ZaeExidvpPK getId() {



  public void setId(ZaeExidvpPK id) { = id;



I have created a simple HTML page that will send one aufnr id as parameter to servlet.

Please assist me in resolving this.

Former Member

Well, the error says it all Your table ZAE_EXIDVP does not yet exist. Can you check if it exists, and you are connecting to the correct tablespace?

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question