Hello list,

I'm trying to deploy a simple ejb-application (packaged to war) to
Tomee 6.0.29 (vanilla download) and I encountered some "strange"
behavior that might be a bug.

When my application was packaged the standard way

root.war/
--/META-INF
---->persistence.xml
--/WEB-INF
---->web.xml
---->classes/l
....

Openejb could not deploy it. In the log files I found the following:

ERROR - FAIL ... ListenerDaoBean:     Missing required persistence.xml
for @PersistenceContext ref "xxx" to unit "xxx".
...
...
...
ERROR - Unable to deploy collapsed ear in war /test-app-1.0-SNAPSHOT:
Exception: Module failed validation.


After a small debugging session I found out that the class responsible
for locating persistence.xml file is
org.apache.openejb.tomcat.catalina.TomcatWebAppBuilder.
//snippet line:595-597 from TomcatWebAppBuilder
 ResourceFinder finder = new ResourceFinder("",
standardContext.getLoader().getClassLoader());
//standardContext.getLoader().getClassLoader() returns
root.war/WEB-INF/classes instead of root.war/
 List<URL> persistenceUrls = finder.findAll("META-INF/persistence.xml");
 appModule.getAltDDs().put("persistence.xml", persistenceUrls);

When I placed persistence.xml in
root.war/WEB-INF/classes/META-INF/persistence.xml  the problem was
gone and application loaded correctly.

Is this desired behavior or should I file a bug report?

Best,

-- 
Aleksandr Ivanov

Reply via email to