Hi,
I am trying TomEE for the first time.
I want to port a legacy Java Web Application from Glassfish to
TomEE.
Problem: I am unable to read resource files (.xml and
.properties) located in the EAR config folder.
I have code in an EJB Session which reads an xml file to
configure an import (for example).
Following Maven standards my folder looks like this:
EAR\src\main\application\config
test.xml
sample.properties
My code looks like this:
ClassLoader cl =
Thread.currentThread().getContextClassLoader();
URL url = cl.getResource("/config/sample.properties");
This setup works fine in Glassfish and Weblogic.
My code works if I move the resources to the WAR, but only when
called from code in the WAR.
Here is where I put the resources in the WAR to
make that work...
Web\src\main\resources\config
To port this legacy code I need to have the resources in the
EAR /config folder and call from EJB classes (as well as from classes in the
WAR).
Dev environment = myEclipse 2022 exploded EAR deployment.
apache-tomee-webprofile-8.0.13
I feel like this is a JNDI issue perhaps. Clearly the
Classloader is different when called from EJB class - compared to when called
from WAR class.
Does anyone know how to make this work with TomEE?
Thank You.