What is a deployment overlay and how do I use it?
Issue
- Need to change any file of a deployment at runtime so that the application need not be edited.
- Patch deployment in JBOSS - How to change *.class file of a deployment at runtime so that the application need not be edited.
- How to do deployment overlays in JBoss EAP 6.1
- Is it possible to overlay a deployment descriptor of a sub-deployment inside an ear?
- How to change the content of web.xml file at runtime in JBoss EAP 6.1 ?
- Is it possible to define separate context-roots for multiple applications when
jboss-web.xml
are not defined for the applications? - Tried to use the overlay functionality over a directory instead over a single file. The CLI command is as follows:
deployment-overlay add --name=jspOverlay --content=/test_jsp/=/a/testing_jsp/ --deployments=*.war --redeploy-affected
Here /a/testing_jsp/
and /test_jsp/
are directories not a file hence getting the following ERROR stacktrace:
java.lang.RuntimeException: java.io.FileNotFoundException: /a/testing_jsp/ (It's a directory)
at org.jboss.as.controller.client.OperationBuilder.addFileAsAttachment(OperationBuilder.java:81)
at org.jboss.as.cli.handlers.DeploymentOverlayHandler.add(DeploymentOverlayHandler.java:708)
at org.jboss.as.cli.handlers.DeploymentOverlayHandler.doHandle(DeploymentOverlayHandler.java:381)
at org.jboss.as.cli.handlers.CommandHandlerWithHelp.handle(CommandHandlerWithHelp.java:86)
at org.jboss.as.cli.impl.CommandContextImpl.handle(CommandContextImpl.java:600)
at org.jboss.as.cli.impl.CommandContextImpl.handleSafe(CommandContextImpl.java:616)
at org.jboss.as.cli.impl.CommandContextImpl.interact(CommandContextImpl.java:1204)
at org.jboss.as.cli.impl.CliLauncher.main(CliLauncher.java:263)
at org.jboss.as.cli.CommandLineMain.main(CommandLineMain.java:34)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org.jboss.modules.Module.run(Module.java:292)
at org.jboss.modules.Main.main(Main.java:455)
Caused by: java.io.FileNotFoundException: /a/testing_jsp/ (It's a directory)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.<init>(FileInputStream.java:138)
at org.jboss.as.controller.client.OperationBuilder$FileStreamEntry.<init>(OperationBuilder.java:158)
at org.jboss.as.controller.client.OperationBuilder$FileStreamEntry.<init>(OperationBuilder.java:154)
at org.jboss.as.controller.client.OperationBuilder.addFileAsAttachment(OperationBuilder.java:75)
... 14 more
-
Is it possible to use this deployment overlays feature for overlaying directories as well?
-
How can I creating custom class loader that loades classes from a jar in specific directory and later use this class in my application?
Where can I find an example to this? The idea is to load jars at runtime in jboss.
Is this functionality exist out of the box? for example, can I add new jars to modules at runtime or load them somehow other then creating my own custom
classloader?
Environment
- Red Hat JBoss Enterprise Application Platform (EAP)
- 6.1.x and further 6.x releases
- 7.x
Subscriber exclusive content
A Red Hat subscription provides unlimited access to our knowledgebase, tools, and much more.