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

REV Tamas tamas.rev at gmail.com
Fri Nov 12 06:49:27 EST 2010


Hi Steve,

Thank you for your reply and letting me know about the jboss forums.
Fortunately, I could make the thing work: I had to place the persistence
unit into
an ejb-jar, and add a jta datasource to the persistence.xml. Someday I'll
try it
again with separate jars.

Regards,
Tamas


On Thu, Nov 11, 2010 at 4:49 PM, Stephen Davidson <gorky at freenet.carleton.ca
> wrote:

> 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
>
> _______________________________________________
> jboss-user mailing list
> jboss-user at lists.jboss.org
> https://lists.jboss.org/mailman/listinfo/jboss-user
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.jboss.org/pipermail/jboss-user/attachments/20101112/38e04e08/attachment-0002.html 


More information about the jboss-user mailing list