-
1. Re: Reading EAR/META-INF/application.xml from EJB or WAR module?
sfcoy Apr 24, 2013 10:15 AM (in response to henk53)The fact that this worked in older versions of JBoss was an (un)happy accident.
The content of an EAR file is not available in an application's classpath.
There's a chance that adding something like this jboss-deployment-structure.xml to your EAR/META-INF directory will work, but I have not tested it:
{code:xml}<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<resources>
<resource-root path="." />
</resources>
</deployment>
</jboss-deployment-structure>{code}
I'll add that you're probably better off moving your properties file into a module as described in How to put an external file in the classpath.
-
2. Re: Reading EAR/META-INF/application.xml from EJB or WAR module?
henk53 Apr 24, 2013 10:28 AM (in response to sfcoy)Hi,
Stephen Coy wrote:
The fact that this worked in older versions of JBoss was an (un)happy accident.
The content of an EAR file is not available in an application's classpath.
Hmmm, in my (perhaps not so) humble opinion this should then maybe change
There's a chance that adding something like this jboss-deployment-structure.xml to your EAR/META-INF directory will work, but I have not tested it:
Thanks, I'll give it a try.
Meanwhile I found that requesting a resource within the EJB, taking its URL and then working up to the EAR level does seem to work.
E.g.
In packaged mode, I get the following external form of the URL:
vfs:/content/myapp_ear.ear/myapp_business.jar/META-INF/dummy.xml
If I then skip passed the .jar in the path and construct a URL from the following:
vfs:/content/myapp_ear.ear/META-INF/application.xml
Then it thus works. For the exploded deployment the URL is slightly different, but the trick works the same way. What do you think, is this a viable solution?
-
3. Re: Reading EAR/META-INF/application.xml from EJB or WAR module?
sfcoy Apr 24, 2013 10:37 AM (in response to henk53)The JEE6 spec is fairly clear when discussing resource/class visibility.
Your solution may get you working for now, but any kind of JBoss upgrade could cause it to stop working because this behaviour is not mandated anywhere.
I'm also curious if it works when you deploy the application via the CLI and/or into a cluster.
-
4. Re: Reading EAR/META-INF/application.xml from EJB or WAR module?
henk53 Apr 24, 2013 10:49 AM (in response to sfcoy)Stephen Coy wrote:
The Java EE 6 spec is fairly clear when discussing resource/class visibility.
It seems to be indeed, but there's little that can't be changed for say Java EE 8, is there?
Your solution may get you working for now, but any kind of JBoss upgrade could cause it to stop working because this behaviour is not mandated anywhere.
I was afraid of that indeed but I guess I'll have to take my chances for now then and see if it's possible to DO get this behavior to be mandated. I never touch the CLI though, and always just copy to the deployment folder, but I'll check it out. Why would a CLI deployment be different? I'll also be sure to check what a cluster deployment does, thanks a lot for the hints!