Details
-
Bug
-
Status: Resolved
-
Minor
-
Resolution: Auto Closed
-
None
-
None
-
None
Description
I'm having some troubles converting an application to running under TomEE embedded.
The application is packaged as an EAR. It consists of an EJB JAR and a WAR. Previously it was deploying okay under Glassfish but now I'd like to run it on Heroku with TomEE embedded.
First I was wondering how to get the web.xml file picked up automatically. What folder does it need to live in? I tried every combination of webapp, WEB-INF and resources dir under the EAR and WAR and it never seemed like it was getting loaded. I am able to get it to load if I specify `appConfig.setWebXml("config/web.xml");` but I was wondering if it could be loaded.
I have similar but different issues with persistence. It seems that if I create a shaded EAR, persistence loads okay. If I don't shade everything together, then I get a zillion warnings about a PersistenceUnit being defined multiple times. Not sure what the difference is here.
Error message when running as standalone WAR (instead of shaded WAR) is:
SEVERE: FAIL ... : The reference @PersistenceUnit(name="emf", unitName="CRMServicePU") cannot be resolved as there are 2 units with the same name. Update your unitName to one of the following:../CRMServicePU%201578812000null ../CRMServicePU%20557735991null
What I would imagine is that when I call `deployClasspathAsWebApp()` it would deploy the WAR inside my EAR. Instead it loads everything in the EJB JAR but doesn't try deploying the webapp. If I specify a web.xml as I mentioned above with references to servlets in the WAR, it is unable to locate the servlet classes. They are present inside the WAR WEB-INF/classes dir. Why does it not locate the classes? Why does it not pick up the web.xml in the WAR automatically?