Thanks a lot David! I finally succeeded [1].
LieGrue, strub [1] http://svn.apache.org/viewvc/incubator/openwebbeans/trunk/webbeans-geronimo/src/main/java/org/apache/webbeans/spi/ee/openejb/JPAServiceOpenEJBImpl.java?view=markup --- David Blevins <[email protected]> schrieb am Mi, 22.4.2009: > Von: David Blevins <[email protected]> > Betreff: Re: using OpenEJB in JUnit tests > An: [email protected] > Datum: Mittwoch, 22. April 2009, 23:06 > > On Apr 16, 2009, at 1:25 AM, Mark Struberg wrote: > > > > > That might be, I hooked a break point to > JtaEntityManager and it has > > never been reached. > > > > Imho the creation of it should happen as soon as a > persistence.xml > > is there, wdyt? > > I dropped a break point in > PersistenceBuilder.createEntityManagerFactory(..) and it > definitely is > getting called and the resulting EntityManagerFactory bound > to > "openejb/PersistenceUnit/" even when there are no > references in the > application to the persistence unit. > > Seems with that and the code you had in the "obtaining > the > JtaEntityManager" thread, it would get you most the way > there. > > > -David > > > > > --- David Blevins <[email protected]> > schrieb am Do, 16.4.2009: > > > >> Von: David Blevins <[email protected]> > >> Betreff: Re: using OpenEJB in JUnit tests > >> An: [email protected] > >> Datum: Donnerstag, 16. April 2009, 5:15 > >> > >> On Apr 13, 2009, at 1:45 AM, Mark Struberg wrote: > >> > >>> Hi David! > >>> > >>>> Do you have any log output you could > post? > >>> I've attached a tee of the mvn test output and > the > >> surefire log. > >>> > >>>> As a trivial implementation you could > maybe just > >> list the > >>>> units under openejb/PersistenceUnit/, chop > off the > >> hash code > >>> Thanks for pointing this again! I was not > clear enough > >> in my previous post: the problem is that there > isn't any > >> openejb/PersistenceUnit node at all - I only can > find > >> openejb/ejb. > >>> > >>> I debuged through and found that the > JtaEntityManager > >> doesn't get initialised at all, because the > >> JndiEncBuilder#build() doesn't get called but only > the > >> JndiBuilder#build(). So I have a few questions: > >>> 1.) What is the difference between those 2? > >>> 2.) How can I force the ContextFactory to call > the > >> JndiEncBuilder or does it make no sense at all? > >>> 3.) Is this way to get the JtaEntityManager > basically > >> correct, or is there another way where we still > can be sure > >> that EJBs and WebBeans get the same > JtaEntityManager > >> instance? > >> > >> Seems like as there are no actual references to > the > >> persistence unit in the app, we simply do not > create the > >> persistence unit. Doesn't seem quite right, > have to > >> dig closer, but that's my current guess as to why > nothing > >> shows up. > >> > >> -David > >> > >>> > >>> > >>> --- David Blevins <[email protected]> > >> schrieb am Mo, 13.4.2009: > >>>> Von: David Blevins <[email protected]> > >>>> Betreff: Re: using OpenEJB in JUnit tests > >>>> An: [email protected] > >>>> Datum: Montag, 13. April 2009, 0:40 > >>>> > >>>> On Apr 12, 2009, at 2:41 PM, Mark Struberg > wrote: > >>>> > >>>>> > >>>>> Hi! > >>>>> > >>>>> Somehow this doesn't work. > >>>>> > >>>>> If I startup OpenEJB like the examples > do: > >>>>> > >>>>>> Properties p = new Properties(); > >>>>>> > p.put(Context.INITIAL_CONTEXT_FACTORY, > >>>> > >> > "org.apache.openejb.client.LocalInitialContextFactory"); > >>>>>> Context context = new > InitialContext(p); > >>>>> > >>>>> then no JtaEntityManager gets > initialised. > >>>>> > >>>>> Do I have to add additional > properties? > >>>>> > >>>>> persistence.xml and all other things > should be > >> in > >>>> place. > >>>>> > >>>>> The source is currently only in my git > repo: > >>>>> http://ns1.backwork.net/git/index.php?p=openwebbeans.git > >>>> > >>>> Do you have any log output you could > post? > >>>> > >>>> > >>>> Regarding your question on IRC: > >>>> > >>>> [13:32] > >>>> <struberg> hi david! > fine to > >> see you > >>>> around :) > >>>> [13:32] > >>>> <struberg> I have a > little > >> question > >>>> concerning the OpenWebBeans/OpenEJB > integration > >>>> [13:32] > >>>> <struberg> I started > the EJB > >>>> container but cannot find my > PersistenceUnit in > >> the JNDI > >>>> context > >>>> [13:33] > >>>> <struberg> factory = > >>>> (EntityManagerFactory) > >>>> context.lookup("openejb/PersistenceUnit/" > + > >> unitName); > >>>> [13:33] > >>>> <struberg> any ideas? > >>>> > >>>> I mentioned this in the "obtaining the > >> JtaEntityManager" > >>>> thread: > >>>> > >>>> On Mar 25, 2009, at 7:59 PM, David Blevins > wrote: > >>>> > >>>>> The tricky part of that is the unit > names have > >> a hash > >>>> code on them to get around the issue that > they > >> aren't > >>>> required to be unique outside the > persistence.xml > >> file and > >>>> there can be multiple persistence.xml > files in an > >> app. > >>>> As a trivial implementation you could > maybe just > >> list the > >>>> units under openejb/PersistenceUnit/, chop > off the > >> hash code > >>>> and use the first one with a matching > name. > >> Supporting > >>>> the case where the user has multiple units > of the > >> same name > >>>> could be a feature to add later. > >>>> > >>>> > >>>> The long and short of that is we don't > use > >>>> "openejb/PersistenceUnit/" + unitName as > the JNDI > >> name, so > >>>> that won't work as is. > >>>> > >>>> -David > >>>> > >>>> > >>> > >>> > >>> > >> <TEST- > >> > org.apache.webbeans.test.geronimo.openejb.OpenEJBIntegrationTest.xml> > >> > >> > > > > > > > > > >
