JBoss deployment overlay - nested deployments - deployment

i'm trying deployement-overlay in my JBoss EAP 6.3.3 with an ear file included war file.
after reading this article : https://access.redhat.com/solutions/383393, i did this CLI command :
deployment-overlay add --name=eum_overlay --server-groups=SG_IHMS_APM --content=/spb-bo-voyage-2.0.0.war/template/template.xhtml=/tmp/template.xhtml --deployments=spb-voyage-2.0.0.ear --redeploy-affected but it doesn't work for me !
Have you got an idea ?
Thanks a lot
Ludo

With RedHat support help i found a solution and i want to share it with you :
first : the war inside the ear should not be a zip file (sometimes war file are zipped), in this case it doesn't work !
now you have an ear file with war file inside (unpack mode) and you want use JBoss deployment overlay, use this command :
deployment-overlay add --name=Overlay_Name --content=/name_of_the_war_file.war/folder_inside_war/file.xxx=path_to_file_that_will_overlay_the_file.xxx --deployments=name_of_the_ear_file.ear --server-groups=server_group_name --redeploy-affected
it works very fine for me !
Good use !
Ludo

Related

Jboss EAP download deployed war file

I have deployed a war file through management console of JBOSS EAP to my company server. I lost my source code accidentally deleted. How can i download the file that's now running on the server to my local machine. Please help me
When you have access to JBoss directory and you pack source code into jars so:
You deploy a war file through the management console your archive is saved on path:
JBOSS_HOME/standalone/tmp/vfs/deployment (in case when you are in standalone mode)
There you can see unpacked war file with jars. But java source code is usually converted to bitecode and you can not get code from it. Maybe you compose your jar with source code and you can see source code.
But unfortunately I don't know way how to do it through Management console.
In the management console of JBoss, go to "Deployments", click the applicable deployment, click "View". Then you have the possibility to browse through all files in the war. Downloading the full war means clicking the war, and on the right, click "Download".
(all based on the 3.0.19.Final console version)

how to download war files from wildfly 8

Wildfly 8:
Where are the deployed war files located on the server file system?
How do I download them? I tried using the JBoss CLI as well as the Web Interface.
Found the war files to be located here. In this directory I found several subdirectories. The war files were all named content and did not have an extension. I could figure out what they were based on file size and timestamp.
wildfly location\standalone\data\content
You want the files 'after' they have been deployed? This generally isn't a good idea as it isn't guaranteed to be exactly the same as the source archive.
The standard location for the deployment archives is ./standalone/deployments/ although this can be changed in the configuration.
After an archive is deployed you can see the exact location of there the deployed archive came from in the configuration, it will be written to the bottom of the xml file.
There is a download button to download the .war
in the management console localhost:9990
click the view button near your war
on top you will find a download icon
I found it in the %WILDFLY_HOME%\standalone\temp\ directory. If it is not present there then you can perform a search in all the subdirectories of the wildfly.

OpenShift Wildfly war file deployement using SFTP

I am trying to deploy a war file in a WildFly gear through a SFTP client.
I have followed the directions described here:
https://www.openshift.com/kb/kb-e1088-how-to-deploy-pre-compiled-java-applications-war-and-ear-files-onto-your-openshift-gear but can't find anything about WildFly.
More specifically I was hoping to find app-root/dependencies/wildfly/deployments but as fas as I can tell there is no such directory.
Is there something I am missing or should I only use the git way for wildfly war deployement?
Thank you in advance
If you just want to easily deploy a war file, I would suggest using rhc port-forward (as shown here in the README https://github.com/openshift-cartridges/openshift-wildfly-cartridge/blob/master/README.md) and use the web interface to deploy it. I wrote that article and it does need to have WildFly added, I'll try to get it updated this week. From what I can see right off, you should put your war file into ~/wildfly/standalone/deployments to deploy it via SFTP. If you run this command find . -name "*deployed" when you ssh into your gear, you will see the ROOT.war.deployed in that directory.

Expand WAR or EAR files in jBoss AS 7

I'm deploying a WebService project into a jBoss AS7, and everything goes OK except that jBoss doesn't expand my WAR or EAR file.
Already tried copying the file to the "jboss-as-7.1.0.Final\standalone\deployments" folder and using the WebConsole, but in both cases the result was the same.
If I deploy from within Eclipse everything runs OK.
I need it to expand my file because in the application initialization I scan the class
directories looking for the correct class to instantiate using reflection.
EDIT : Don't know if this a particular situation with jBoss AS 7 or with the jBoss AS family, because I already used WebSphere and jBoss Web and both of them expanded the files.
EDIT2 : Added a System.out with the execution path
MyClass.class.getProtectionDomain().getCodeSource().getLocation().getPath();
and it returns the following path
C:\jboss-as-7.1.0.Final\bin\content\ServerEAR.ear\Server.war\WEB-INF\classes
witch doesn't exist. So I did a search for the class name and fount it at
C:\jboss-as-7.1.0.Final\standalone\tmp\vfs\deployment5a9e98d5c43716c3\Server.war-e31a657d2bc3bd0f\WEB-INF\classes\r30
Isn't it possible to force JBoss to extract the files to the deployment folder? Or how can I get the previous path at run time.
Had forgotten about this question, so this is the way that I solved it:
public String getRealFilePath(String aFilePath) throws Exception
{
org.jboss.vfs.VirtualFile vFile = org.jboss.vfs.VFS.getChild(aFilePath);
URI fileNameDecodedTmp = org.jboss.vfs.VFSUtils.getPhysicalURI(vFile);
path = fileNameDecodedTmp.getPath();
System.out.println(path);
return path;
}
So at runtime I just need to call getRealFilePath() with the original question values, and problem solved ;)
I believe that you cannot force Jboss7 to auto expand the war file when deploying.
You can, however, copy the already expanded war and you shouldn't have any problems.
Actually, if you look closely at the Eclipse deployment, you will notice that it copies the whole directory to the deployment directory, not the war file itself.
Why do you need to deploy exploded, by the way? If you need to access and read some files as resources, you can have a look at classpath resources
Please check you classpath setting. I faced the same problem recently, and solved it by added system environment variables:
CLASSPATH=.;
C:\Program Files\Java\jdk1.6.0_10\lib;
C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;
C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar; `

How do you unwar a .war file with ant on windows?

I'm only remotely familiar with what ant does, but apparently I have to setup a service that's run on jboss and put it into a deploy directory...
the problem is the .war file -- I only have winzip 7zip and ant and I dont know how to ge the contentsa out of the .war file to put it in the deploy directory...
are there other conf and build.xml files a well that are needed?
thanks for your help!
//edit
the problem is the instructions say to unwar the .war file. And I Dont know how to do this via JBOSS or any other means. How?
//edit
7zip unwar-ed the file but I'm not sure where to put the contents in jboss.
/server/ ?
Thanks for your help. As this is my first time doing this I'm completely clueless.
Usually you can just place the WAR file into the directory and the container will take care of unpacking it.
But, a WAR file is simply a ZIP file with a different extension, so you could also use any popular unzip tool (WinZip, WinRAR, 7Zip, etc) to unzip it manually if need be.
Ant has an unzip task as well.
JBoss should be able to deploy a war file and unpack it on it's own. You shouldn't be writing scripts that unpack war files for JBoss.
Using unzip task: http://ant.apache.org/manual/Tasks/unzip.html
Unless you have something else in mind1, you don't have to depoy you war in an "exploded" format (i.e. unpacked). Just deploy you war on JBoss and JBoss will deal with it. To do so, just copy your war into /server/default/deploy.
1 The only good reason I can see to deploy a war in an exploded format is if you plan to make incremental changes to the content (e.g. changing just a class) without deploying the whole webapp again. But this doesn't seem to be the case. So just deploy you war without unpacking it.