Open a netbeans issue, btw idea supports tomee rather well Le 6 janv. 2014 22:04, "Kay Wrobel" <[email protected]> a écrit :
> Alright. I've done somthing completely absurd right now, but it works. > > I've create an EJB Project inside NetBeans which only let's me pick from > GlassFish or JBoss as target runtimes. I then copied all my entities and > the session beans over to that project, and I also added a persistence unit > (via the wizard) to the project. I then changed the persistence provider to > OpenJPA to match what my original persistence unit looked like. Bon. > > I then compiled the EJB project and included it in my Web Application, > which IS pointing to TomEE Plus. The Web app was of course sanitized of any > entities and session beans as well as removed the persistence unit from it. > > I then rebuilt the web app and deployed it to TomEE with success. Then I > ran my web page to see if I get error messages again regarding multiple > persistence units or the NamedQuery not found error, and low and behold: > this works! Phew. > > So the only real tangible difference here is that I created an EJB Project > instead of a Java Class Library project. Wow. I mean, I'm happy now, but > why this is working if clearly, the EJB Project is targeting GlassFish and > not TomEE goes beyond me. I can only hope that someday, NetBeans gives > TomEE the proper Java EE treatment. Speaking of which: in NetBeans > Developer Snapshot (which is going to become NetBeans 8), I still can't add > an EJB Project with TomEE as its target. Even though developers had > promised that TomEE is now properly supported. Sigh. > > Thanks anyway to all who have given me input on this issue. Your help is > much appreciated. > > Kay > > > On 01/06/2014 02:50 PM, Romain Manni-Bucau wrote: > >> Share a project would help but im pretty sure you have an issue on your >> side or didnt follow what i said. >> Le 6 janv. 2014 21:03, "Kay Wrobel" <[email protected]> a écrit : >> >> I thought that's how I could make it work. Instead, I'm getting error on >>> deployment. TomEE think there are two persistence units of the same name >>> and litters the log with errors. >>> >>> When I move persistence.xml out of the jar back into the web app, I can >>> deploy successfully, but the entities become invisible. And even if I add >>> them manually to the persistence unit, it still doesn't work. >>> >>> So I'm stuck with what to do. I am using 1.6.0 Web Profile, but also >>> tested Plus. It's just not happening for me. And I HAVE to separate those >>> entities so I can pick and choose development entities over live >>> production >>> entities, which are slightly different. >>> >>> >>> On 01/06/2014 01:59 PM, Helge Waastad wrote: >>> >>> Hi, >>>> I usually add entities and persistence.xml (meta-inf) in a library jar. >>>> Then u also will have metamodels generated in the lib. >>>> Works for me. >>>> >>>> Br hw >>>> >>>> >>>> >>>> >>>> Sendt fra Galaxy TabKay Wrobel <[email protected]> skrev:Romain, >>>> >>>> I've done all that you said. Here's the break-down: >>>> >>>> * Java class library project contains JUST entity classes and >>>> session >>>> beans for them, no persistence.xml file >>>> * Web App is "linked" with the JAR project and is being placed into >>>> the WEB-INF/lib directory. I've inspected and confirmed this >>>> manually by looking the the produced war file. >>>> >>>> The application deploys without error and the log shows the session >>>> beans being activated. But as soon the session tries to run a named >>>> query, I'm getting error messages. Would it help if I created a smaller >>>> test project and posted it on Github? >>>> >>>> Kay >>>> >>>> >>>> >>>> On 01/06/2014 11:02 AM, Romain Manni-Bucau wrote: >>>> >>>> both would work, personally I'd put it in WEB-INF >>>>> Romain Manni-Bucau >>>>> Twitter: @rmannibucau >>>>> Blog: http://rmannibucau.wordpress.com/ >>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>> Github: https://github.com/rmannibucau >>>>> >>>>> >>>>> >>>>> 2014/1/6 Kay Wrobel <[email protected]>: >>>>> >>>>> Where should the persistence unit be located? Inside the jar >>>>>> containing >>>>>> the >>>>>> entities, or inside the web-app? >>>>>> >>>>>> >>>>>> On 01/06/2014 10:54 AM, Romain Manni-Bucau wrote: >>>>>> >>>>>> yes but you can just put entities in a jar, add it in web-inf/lib and >>>>>>> list your entities in your persistence unit (or use openejb scanning >>>>>>> feature >>>>>>> (http://rmannibucau.wordpress.com/2012/11/15/jpa-entities- >>>>>>> scanning-in-tomee/) >>>>>>> Romain Manni-Bucau >>>>>>> Twitter: @rmannibucau >>>>>>> Blog: http://rmannibucau.wordpress.com/ >>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>>> Github: https://github.com/rmannibucau >>>>>>> >>>>>>> >>>>>>> >>>>>>> 2014/1/6 Kay Wrobel <[email protected]>: >>>>>>> >>>>>>> Ok, here's my real problem: >>>>>>>> >>>>>>>> We have a project that has "almost the same" database in multiple >>>>>>>> locations. >>>>>>>> Basically, they are different revs of a database. E.g.: my >>>>>>>> development >>>>>>>> database which always has the latest, a production database @ >>>>>>>> customer1, >>>>>>>> another production database @customer2. Right now, my dev database >>>>>>>> and >>>>>>>> the >>>>>>>> one @ customer1 are out of sync. Fields were added in dev that are >>>>>>>> not in >>>>>>>> that customers schema. >>>>>>>> >>>>>>>> The web-app I'm writing will have to be deployed at customer1, but >>>>>>>> the >>>>>>>> enties I generated (with NetBeans wizard) don't match. So what I >>>>>>>> would >>>>>>>> like >>>>>>>> to do is separate the entity classes and session beans for them out >>>>>>>> of >>>>>>>> the >>>>>>>> web app and into a dedicated library. I think that dedicated library >>>>>>>> has >>>>>>>> to >>>>>>>> be an ejb module because if I simply mkove them into a simple java >>>>>>>> Class >>>>>>>> Library and add that to my web app, nothing works anymore. >>>>>>>> >>>>>>>> Do you see my need now? >>>>>>>> >>>>>>>> Kay >>>>>>>> >>>>>>>> >>>>>>>> On 01/04/2014 12:18 AM, Romain Manni-Bucau wrote: >>>>>>>> >>>>>>>> We support ears but I dont follow you when you say you want it, ear >>>>>>>>> are >>>>>>>>> great only if you have multiple wars in a single app. >>>>>>>>> >>>>>>>>> Jpa2 metamodel can be generated with mvn so it should be great with >>>>>>>>> netbeans. >>>>>>>>> Le 3 janv. 2014 22:59, "Kay Wrobel" <[email protected]> a écrit : >>>>>>>>> >>>>>>>>> I found that NetBeans, on deployment, copied the persistence.xml >>>>>>>>> >>>>>>>>>> file >>>>>>>>>> into >>>>>>>>>> the another location. I removed the Netbeans cache from my home >>>>>>>>>> directory >>>>>>>>>> and it stopped doing that. >>>>>>>>>> >>>>>>>>>> That said, a new issue arose. Apparently, the auto-generated >>>>>>>>>> Entity >>>>>>>>>> classes are not being generated anymore (the ones that end in an >>>>>>>>>> underscore). >>>>>>>>>> >>>>>>>>>> So maybe my approach as a whole is not what should be done. I read >>>>>>>>>> up a >>>>>>>>>> little, and what would more appropriate would be to create Java EE >>>>>>>>>> Enterprise module, into which I would then create sub-projects >>>>>>>>>> for a >>>>>>>>>> WAR >>>>>>>>>> and an EJB (containing entities and session beans). These would >>>>>>>>>> then be >>>>>>>>>> packaged to an EAR. But how to do that with Tomee and Netbeans >>>>>>>>>> goes >>>>>>>>>> beyond >>>>>>>>>> the scope of my question and Netbeans doesn't properly support >>>>>>>>>> Tomee >>>>>>>>>> yet, >>>>>>>>>> meaning I can't create such a project because it only gives my >>>>>>>>>> Glassfish >>>>>>>>>> as >>>>>>>>>> a choice. Bummer! >>>>>>>>>> >>>>>>>>>> But, from a Tomee perspective, does it support the concept of >>>>>>>>>> bundled >>>>>>>>>> WAR/EJB in EARs? >>>>>>>>>> >>>>>>>>>> On 01/03/2014 03:30 PM, Romain Manni-Bucau wrote: >>>>>>>>>> >>>>>>>>>> if you can reproduce it share your app but tomee has good >>>>>>>>>> glasses >>>>>>>>>> >>>>>>>>>>> normally ;) >>>>>>>>>>> Romain Manni-Bucau >>>>>>>>>>> Twitter: @rmannibucau >>>>>>>>>>> Blog: http://rmannibucau.wordpress.com/ >>>>>>>>>>> LinkedIn: http://fr.linkedin.com/in/rmannibucau >>>>>>>>>>> Github: https://github.com/rmannibucau >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> >>>>>>>>>>> 2014/1/3 Kay Wrobel <[email protected]>: >>>>>>>>>>> >>>>>>>>>>> But why is Tomee seeing two persistence units when there is >>>>>>>>>>> >>>>>>>>>>>> clearly >>>>>>>>>>>> on >>>>>>>>>>>> one >>>>>>>>>>>> persistence.xml ? I don't get it. >>>>>>>>>>>> >>>>>>>>>>>> >>>>>>>>>>>> On 01/03/2014 12:04 PM, Romain Manni-Bucau wrote: >>>>>>>>>>>> >>>>>>>>>>>> Here what i do: put persistence.xml in web-inf only and list >>>>>>>>>>>> >>>>>>>>>>>>> classes >>>>>>>>>>>>> and >>>>>>>>>>>>> use exclude unlisted (set to true). Not the only way but the >>>>>>>>>>>>> easier >>>>>>>>>>>>> to >>>>>>>>>>>>> understand >>>>>>>>>>>>> Le 3 janv. 2014 18:28, "Kay Wrobel" <[email protected]> a >>>>>>>>>>>>> écrit : >>>>>>>>>>>>> >>>>>>>>>>>>> Hi everyone. >>>>>>>>>>>>> >>>>>>>>>>>>> I would like some professional advice on this question. I'm >>>>>>>>>>>>>> using >>>>>>>>>>>>>> Tomee >>>>>>>>>>>>>> 1.6.0 Web Profile and have a working web app developed with >>>>>>>>>>>>>> NetBeans >>>>>>>>>>>>>> that >>>>>>>>>>>>>> contains entity classes and sessions beans to access those >>>>>>>>>>>>>> entities. >>>>>>>>>>>>>> The >>>>>>>>>>>>>> app works fine. Now I'm trying to separate these classes into >>>>>>>>>>>>>> a >>>>>>>>>>>>>> separate >>>>>>>>>>>>>> class library, but I'm hitting the error wall. >>>>>>>>>>>>>> >>>>>>>>>>>>>> First, thing that didn't work was that another class that >>>>>>>>>>>>>> still >>>>>>>>>>>>>> resides >>>>>>>>>>>>>> the web app can't find the named queries anymore defined in >>>>>>>>>>>>>> the >>>>>>>>>>>>>> entity >>>>>>>>>>>>>> classes. Upon reading a little about it, one suggestion was >>>>>>>>>>>>>> that >>>>>>>>>>>>>> the >>>>>>>>>>>>>> persistence.xml file should be located inside the JAR file >>>>>>>>>>>>>> that >>>>>>>>>>>>>> contains >>>>>>>>>>>>>> the entities, placed in the META-INF directory. After moving >>>>>>>>>>>>>> the >>>>>>>>>>>>>> persistence.xml into the JAR as well, I now get the following >>>>>>>>>>>>>> deployment >>>>>>>>>>>>>> errors: http://pastebin.com/fBFYaGKR >>>>>>>>>>>>>> >>>>>>>>>>>>>> First, off it now sees two persistence units??? Even though I >>>>>>>>>>>>>> completely >>>>>>>>>>>>>> remove the persistence.xml from the web app and placed it >>>>>>>>>>>>>> inside >>>>>>>>>>>>>> the >>>>>>>>>>>>>> JAR's >>>>>>>>>>>>>> META-INF directory? Also the log seems to be littered with >>>>>>>>>>>>>> multiple >>>>>>>>>>>>>> iterations of that error message per session bean. And it >>>>>>>>>>>>>> would >>>>>>>>>>>>>> be >>>>>>>>>>>>>> nice >>>>>>>>>>>>>> if >>>>>>>>>>>>>> it actually told me where the "two" PUs are. >>>>>>>>>>>>>> >>>>>>>>>>>>>> And just to clarify, after I moved the PU and the entities and >>>>>>>>>>>>>> session >>>>>>>>>>>>>> beans to the JAR, I added the JAR project back to the web app >>>>>>>>>>>>>> project, >>>>>>>>>>>>>> cleaned and rebuilt the JAR project first, then the web app. >>>>>>>>>>>>>> And >>>>>>>>>>>>>> then >>>>>>>>>>>>>> deployed the web app. >>>>>>>>>>>>>> >>>>>>>>>>>>>> So that's where I'm at right now, and I'm dumb-founded. >>>>>>>>>>>>>> Anybody >>>>>>>>>>>>>> know >>>>>>>>>>>>>> what >>>>>>>>>>>>>> the best practice here is? Or is it because I'm not using >>>>>>>>>>>>>> Tomee >>>>>>>>>>>>>> FULL >>>>>>>>>>>>>> vs >>>>>>>>>>>>>> Web >>>>>>>>>>>>>> Profile? >>>>>>>>>>>>>> >>>>>>>>>>>>>> Please help. Thank you, and Happy New Year. >>>>>>>>>>>>>> >>>>>>>>>>>>>> Kay >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >>>>>>>>>>>>>> >
