[jboss-user] newbie question: jpa and ejb - no default PersistenceUnit

Stephen Davidson gorky at freenet.carleton.ca
Thu Nov 11 10:49:01 EST 2010


Greetings.

While there is a way to get this to work, I do apologize for not knowing 
it offhand.  And unfortunately, this mailing list is no longer monitored 
by anyone from the JBoss Group.

Feel free to try the Forums.

Regards,
Steve

On 11/10/2010 05:30 AM, REV Tamas wrote:
> Hi,
>
> I'm new to JBoss and Eclipse. I've been using NetBeans and GlassFish for
> Java EE development.
>
> Now I'm working on a very simple PoC just to see how I can use these
> technologies. I have a very simple
> JPA project. It contains a persistence xml and a few entities, inherited
> from each other.
> persistence.xml excrept:
> <persistence version="1.0" ...>
> <persistence-unit name="HotelPoi" transaction-type="JTA">
>          ...
> </persistence-unit>
> </persistence>
>
>
> I have an EJB project too, it contains a stateless session bean. The
> bean injects a persistence unit this way:
> @PersistenceUnit(name="HotelPoi")
> EntityManager em;
>
> I receive the following deploy-time exception:
>
> 2010-11-10 12:19:51,656 DEBUG [org.jboss.ejb3.Ejb3Module] Starting
> failed jboss.j2ee:service=EJB3,module=HotelPoiFinder.jar
> java.lang.RuntimeException: Illegal @PersistenceUnit on
> javax.persistence.EntityManager com.edreams.poi.finder.PoiFinder.em
> :There is no default persistence unit in this deployment.
>          at
> org.jboss.injection.PersistenceUnitHandler.handleFieldAnnotations(PersistenceUnitHandler.java:247)
>          at
> org.jboss.injection.InjectionUtil.processFieldAnnotations(InjectionUtil.java:137)
>          at
> org.jboss.injection.InjectionUtil.processAnnotations(InjectionUtil.java:174)
>
> I double-checked the ear and it contains the JpaProject in the lib
> directory. I placed it in the root dir too and receive the same exception.
>
> I'm using JBoss 4.2.3.GA <http://4.2.3.GA> and Eclipse with the
> following build id:  20100617-1415
>
> Do you have any ideas how to make this injection work?
>
> Best Regards,
> Tamas
>
>
>
> _______________________________________________
> jboss-user mailing list
> jboss-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-user



More information about the jboss-user mailing list