Skip to Content
0
Former Member
Jul 07, 2009 at 12:21 AM

JPA Error: Could not get a value to be injected from the factory.

274 Views

Hello,

<br><br>

I have problem in the development of CRUD with JPA. I am working with NWDS EC 7.1 Ehp1 SP2. I have the following DCs:<br><br>

- <b>Dictionary</b>(deploy whit successfully)<br><br>

- <b>EJB</b> (deploy whit successfully)<br><br>

-


Entity

<br>@Entity

<br>@Table(name="<TABLE_NAME>", schema="SAPSR3DB")

<br>public class BusinessProcess implements Serializable {

<br> ....

<br>}

<br>* I also already tried without the scheme

<br><br>------- Session

<br>@Stateless(name="KpiSessionBean")

<br>public class KpiSessionBean implements KpiSessionLocal {

<br>&nbsp;&nbsp;<t>@PersistenceContext(unitName="kpiUnit")

<br>&nbsp;&nbsp;protected EntityManager em;

<br>&nbsp;&nbsp;....

<br>}

<br><br>------- persistence.xml

<br>&#60;persistence-unit name="kpiUnit">

<br>&nbsp;&nbsp;&#60;jta-data-source>CUSTOM_ALIAS</jta-data-source>

<br>&nbsp;&nbsp;&#60;/persistence-unit>

<br>&#60;/persistence>

<br><br>-.<b>EAR Application</b> (deploy whit successfully)

-


data-source-aliases.xml


<data-source-aliases xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="data-source-aliases.xsd">

<br>&nbsp;&nbsp;&#60;application-name>kpi2bpm/app&#60;/application-name>

<br>&nbsp;&nbsp;&#60;aliases>

<br>&nbsp;&nbsp;&#60;data-source-name>CUSTOM_DS&#60;/data-source-name>

<br>&nbsp;&nbsp;&#60;alias>CUSTOM_ALIAS&#60;/alias>

<br>&nbsp;&nbsp;&#60;/aliases>

<br>;&#60;/data-source-aliases>

<br><br>-.<b>EAR DataSource</b> (deploy whit successfully)

<br><br>----


data-sources.xml

<br>;&#60;data-sources>

<br>;&#60;data-source>

<br>&nbsp;&nbsp;&#60;data-source-name>CUSTOM_DS&#60;/data-source-name>

<br>&nbsp;&nbsp;&#60;driver-name>SYSTEM_DRIVER&#60;/driver-name>

<br>&nbsp;&nbsp;&#60;sql-engine>native_sql&#60;/sql-engine>

<br>&nbsp;&nbsp;&#60;jdbc-1.x>

<br>&nbsp;&nbsp;&#60;driver-class-name>oracle.jdbc.driver.OracleDriver&#60;/driver-class-name>

<br>&nbsp;&nbsp;&#60;url>jdbc:oracle:thin:@<i>&#60;host>:&#60;port>:&#60;SID></i>&#60;/url>

<br>&nbsp;&nbsp;&#60;user-name><i>&#60;user></i>&#60;/user-name>

<br>&nbsp;&nbsp;&#60;password>*****&#60;/password>

</jdbc-1.x>

<br>;&#60;data-source>

<br>;&#60;/data-sources>

<br>* I tried with sql-engine: native_sql, open_sql and vendor_sql.

<br>**.: In <i>nwa / Configuration Management / Infrastructure / Application Resources</i> the DataSource and Alias are with state fully available.

<br><br>- <b>WD CRUD</b> (deploy whit successfully)

<br><br><br>During the execute of the method create employee i am getting the following error: <b>u201CCould not get a value to be injected from the factory. u201C</b>

<br><br>

u2026u2026

<br>sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager.access$000 (StatelessInstanceLifecycleManager.java:23)

<br>at com.sap.engine.services.ejb3.runtime.impl.StatelessInstanceLifecycleManager$PoolUserImpl.createObject(StatelessInstanceLifecycleManager.java:34)

<br>at com.sap.engine.services.ejb3.util.pool.ContainerPoolImpl.doResizeOneStepUp(ContainerPoolImpl.java:373)

<br>... 103 more

<br>Caused by: com.sap.engine.lib.injection.InjectionException: Injection on field em of instance <br>br.com.braskem.kpi.ejb.session.KpiSessionBean@2ed53897 failed. <b>Could not get a value to be injected from the factory.</b>

<br>at com.sap.engine.lib.injection.FieldInjector.inject(FieldInjector.java:115)

<br>at com.sap.engine.lib.injection.InjectionMatrix.inject(InjectionMatrix.java:45)

<br>at com.sap.engine.services.ejb3.runtime.impl.Interceptors_DependencyInjection.invoke(Interceptors_DependencyInjection.java:22)

<br>... 119 more

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

<br><b>Error on entity >><i><ENTITY_NAME></i><<: The table >><i><TABLE_NAME></i><< does not exist.</b>

<br>u2026u2026

<br><br>I checked in <i>nwa/ Problem Management / Database / Open SQL Data Browser</i> the table exist, and also registered in C_DDDBTABLERT table.

<br><br>Any pointers to trouble shoot this ?

<br>Thank you very much!!