-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Unable to build EntityManagerFactory
PostPosted: Tue Jul 14, 2009 4:06 pm 
Newbie

Joined: Tue Jul 14, 2009 3:34 pm
Posts: 2
Hey, all.

I just registered here because I'm in real trouble 'cause a PersistenceException on JBoss 5.0

I'm working on an Enterprise Application project on Eclipse Ganymede (3.4.2), with JBoss 5.0, JPA, JSF and Hibernate.

I have three modules inside the EAR: EJB, JPA and WEB. The JPA one is the one giving me trouble. Once I deploy and try to run the app, it says:

Code:
14:26:24,468 INFO  [SessionFactoryImpl] building session factory
14:26:24,468 INFO  [SessionFactoryObjectFactory] Not binding factory to JNDI, no JNDI name configured
14:26:24,468 ERROR [STDERR] javax.persistence.PersistenceException: [PersistenceUnit: TrackManJPA] Unable to build EntityManagerFactory
14:26:24,468 ERROR [STDERR]    at org.hibernate.ejb.Ejb3Configuration.buildEntityManagerFactory(Ejb3Configuration.java:677)
14:26:24,468 ERROR [STDERR]    at org.hibernate.ejb.HibernatePersistence.createEntityManagerFactory(HibernatePersistence.java:126)
14:26:24,468 ERROR [STDERR]    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:52)
14:26:24,468 ERROR [STDERR]    at javax.persistence.Persistence.createEntityManagerFactory(Persistence.java:34)
14:26:24,468 ERROR [STDERR]    at ebs.trackman.session.SessionAcceser.<init>(SessionAcceser.java:48)


@Stateful
SessionAcceser on line 48 says:
Code:

public class SessionAccesser
{

private EntityManager em;

@PersistenceContext(unitName="TrackManJPA")
private EntityManagerFactory emf;

public SessionAccesser()
{
/*LINE 48*/ emf = Persistence.createEntityManagerFactory("TrackManJPA");
em = emf.createEntityManager();
}


My persistence.xml is:

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="TrackManJPA" transaction-type="JTA">
   <provider>org.hibernate.ejb.HibernatePersistence</provider>
   <jta-data-source>java:/MySqlDS</jta-data-source>
      <properties>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQLInnoDBDialect"/>
         <property name="hibernate.connection.username" value="root" />
         <property name="hibernate.connection.url" value="jdbc:mysql://localhost:3306/trackman"/>
         <property name="hibernate.connection.driver_class" value="com.mysql.jdbc.Driver"/>
         <property name="hibernate.dialect" value="org.hibernate.dialect.MySQL5InnoDBDialect" />         
      </properties>
   </persistence-unit>
</persistence>


And I have an orm.xml:

Code:
<entity-mappings xmlns="http://java.sun.com/xml/ns/persistence/orm" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence/orm http://java.sun.com/xml/ns/persistence/orm_1_0.xsd" version="1.0">
   <entity class="ebs.trackman.entities.Usuario" access="PROPERTY">
      <table name="usuarios">
      </table>
   </entity>   
   <entity class="ebs.trackman.entities.Perfil" access="PROPERTY">
      <table name="perfiles">
      </table>
   </entity>
</entity-mappings>


For now, I have two entities: User and Profile, with annotations (@Entity, @Table, @Id, @GeneratedValue, @Column, etc.)
on their getters.
Any ideas on how to solve this?

Plus, at the end of the trace, it says that a ManagedBean is not bound, which is very strange due to the faces-config.xml-driven creation of these kinds of beans. As far as I know, JNDI does not have anything to do with ManagedBeans.

Thanks!


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.