Note that there are some explanatory texts on larger screens.

plurals
  1. POJPA - createEntityManagerFactory returns Null
    text
    copied!<p>Noob question here. I'm following <a href="http://schuchert.wikispaces.com/JPA+Tutorial+1+-+Getting+Started#Create%20Your%20First%20Entity" rel="nofollow noreferrer">this example/tutorial</a> to try and isolate a problem I keep getting on my main project. Problem is, the entityManagerFactory keeps returning null (thus, I get a NullPointerExcept when trying to run the first JUnit test.)</p> <p>I'm currently on Eclipse Indigo (JavaEE) - JRE7 - Hibernate 3.6.7 and JBoss 7</p> <p>And here's my persistence.xml (again, a copipasta taken right from the tutorial)</p> <pre><code>&lt;persistence&gt; &lt;persistence-unit name="examplePersistenceUnit" transaction-type="RESOURCE_LOCAL"&gt; &lt;properties&gt; &lt;property name="hibernate.show_sql" value="false" /&gt; &lt;property name="hibernate.format_sql" value="false" /&gt; &lt;property name="hibernate.connection.driver_class" value="org.hsqldb.jdbcDriver" /&gt; &lt;property name="hibernate.connection.url" value="jdbc:hsqldb:mem:mem:aname" /&gt; &lt;property name="hibernate.connection.username" value="sa" /&gt; &lt;property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect" /&gt; &lt;property name="hibernate.hbm2ddl.auto" value="create" /&gt; &lt;/properties&gt; &lt;/persistence-unit&gt; &lt;/persistence&gt; </code></pre> <p>Things I've already tried/found out so far:</p> <ul> <li><p>Seems this problem <a href="https://stackoverflow.com/questions/7189066/jpa-entitymanager-is-not-initialized-null">tends to occur</a> if you try to create a factory with a persistence unit that is not listed in the persistence.xml</p></li> <li><p>Double-checked that the necessary JARs are included in Eclipse's Build Path Libraries, which Google suggested may be a possible cause for a createEntityManagerFactory() call to short-circuit and return null (instead of just throwing an exception or logging a message)</p></li> <li><p>Might be due to a possible error <a href="https://stackoverflow.com/questions/4003069/jpa-and-derby-null-pointer-exception">whilst configuring</a> Hibernate connection?</p></li> </ul> <p>I've been hitting this wall for the past couple of weeks, so it goes without saying that any help/general direction tips are MUCH appreciated :D</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload