This is my first post on StackOverflow, so let me know if I'm breaking any rules.
As for the question:
I have a JBOSS project divided as follows:
myproject
-myproject-ear
-myproject-ejb
-mypackage
-myQuartzClass.java
-myproject-web
-src
-main
-webapp
-protected
-sql
-mySqlQuery.sql
Thing is, I need to get the path (and then read the file) to "mySqlQuery.sql") from within the "MyQuartzClass.java". Is it possible? I know I can use FacesContext.getCurrentInstance().getExternalContext().getRealPath from within a ManagedBean, but can I use something similar from within my EJB classes?
Thanks
At least for WAR deployments, you can have a ContextListener load some information into a static field of a non-@Startup-annotated EJB. There's a code sample at https://github.com/IanDarwin/GetWebFilesInEJB.git
I have not tested it on the legacy EAR deployment; if it doesn't work there, might give some people the incentive to simplify their lives a bit :-)