-
1. Re: Accessing a resource inside the EAR from a module
sfcoy Feb 16, 2012 7:47 PM (in response to newway)Please see Loading resource file from ear-file
-
2. Re: Accessing a resource inside the EAR from a module
newway Feb 19, 2012 7:20 AM (in response to sfcoy)If I understood this post correctly, then I think that putting the resource file at
MyEar/lib/MyJar/META-INF
should have solved the problem.
but the problem I have is that this works from a code that is written inside the EJB but if one line after that I call code that is written inside a module and this executes the exact same load - it fails.
Attached are:
- the EAR file is it is deployed inside jboss
- the module folder that you need to add to the modules
- 4 eclipse projects that are
- the module code
- the EJB code
- the jar that sits in the lib
- the EAR
if you will deploy iy to jboss you can expect the following output:
13:55:01,410 INFO [stdout] (MSC service thread 1-14) The following execution will pass 13:55:01,411 INFO [stdout] (MSC service thread 1-14) before read resource inside the ear 13:55:01,414 INFO [stdout] (MSC service thread 1-14) Told you 13:55:01,415 INFO [stdout] (MSC service thread 1-14) after read resource inside the ear 13:55:01,416 INFO [stdout] (MSC service thread 1-14) The following execution will fail 13:55:01,417 INFO [stdout] (MSC service thread 1-14) before read resource inside the module 13:55:01,421 INFO [stdout] (MSC service thread 1-14) Told you 13:55:01,422 ERROR [stderr] (MSC service thread 1-14) java.util.MissingResourceException: Can't find bundle for base name META-INF/logMessages, locale en_US 13:55:01,423 ERROR [stderr] (MSC service thread 1-14) at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1427) 13:55:01,424 ERROR [stderr] (MSC service thread 1-14) at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1250) 13:55:01,425 ERROR [stderr] (MSC service thread 1-14) at java.util.ResourceBundle.getBundle(ResourceBundle.java:705) 13:55:01,426 ERROR [stderr] (MSC service thread 1-14) at my.module.DemoModuleAction.loadResource(DemoModuleAction.java:7) 13:55:01,427 ERROR [stderr] (MSC service thread 1-14) at my.ejb.StartUp.startup(StartUp.java:37) ... 13:55:01,472 INFO [stdout] (MSC service thread 1-14) after read resource inside the module 13:55:01,474 INFO [org.jboss.as] (MSC service thread 1-3) JBAS015874: JBoss AS 7.1.0.Final "Thunder" started in 7481ms - Started 255 of 336 services (79 services are passive or on-demand) 13:55:01,519 INFO [org.jboss.as.server] (DeploymentScanner-threads - 2) JBAS018559: Deployed "DemoEAR.ear"
-
export_demo.zip 14.6 KB
-
Ear created and deployed.zip 3.2 KB
-
my.zip 1.3 KB
-
3. Re: Accessing a resource inside the EAR from a module
sfcoy Feb 19, 2012 6:08 PM (in response to newway)Is there any particular reason that you need to use a jboss module?
Typically code inside jboss modules will not have visibility of resources anywhere inside your EAR file.
-
4. Re: Accessing a resource inside the EAR from a module
newway Feb 20, 2012 7:27 AM (in response to sfcoy)I have a jar containing code that has a functionality that is shared by several applications.
it used to be in the lib folder - basically I thought that the same way I define the oracle driver as a module, I should also define my jar as a module.
the alternative is for each EAR to hold the jar in it's lib folder?
-
5. Re: Accessing a resource inside the EAR from a module
sfcoy Feb 21, 2012 4:50 AM (in response to newway)The problem with the module idea is that code inside modules cannot "see" resources inside your application.
Someone maybe able to provide a solution that plays fun and games with the classloading configuration.
Possibly the simplest solution would be to pass the ResourceBundle up your module code.
-
6. Re: Accessing a resource inside the EAR from a module
newway Feb 21, 2012 1:04 PM (in response to sfcoy)Thanks, this is the workaround i implemented so far.
I just wondered if i missed something in the modules concept.