Wildfly10: Configuring deployment runtime name with XML - wildfly

Can I set the runtime name of a deployment by configuring a XML file inside .war file?
besides the file name of the .war, is there a way to configure the name and runtime name of a deployment using XML?

You can do it in jboss-web.xml and place that in WEB-INF. Here is sample.
<?xml version="1.0"?> <jboss-web><context-root>Hello</context-root></jboss-web>
Read more here Changing Context Root

Related

Deployment of webapp in wildfly using Context Descriptors

I searched using "How to set Context Path in Wildfly", but got no success. Can anyone help me on how to do it..?
I've used the following code to set the Context Path in tomcat where I can access my application directly using localhost:8080/myApp
myApp.xml contains as follows and placed at $CATALINA_BASE\conf\[enginename]\[hostname]\myApp.xml
<Context path="myApp" docBase="G:\workspace\j2ee\myProject\myWebApp\WebContent" />
similar or equivalent type of configuration want to use in Wildfly server.
In your standalone.xml configuration you want to add a deployment like this:
<deployments>
<deployment name="myProject" runtime-name="myProject.war">
<fs-archive path="G:/workspace/j2ee/myProject/myWebApp/WebContent"/>
</deployment>
</deployments>
Then within WebContent/WEB-INF create a file called jboss-web.xml with a configuration similar to:
<?xml version="1.0"?>
<jboss-web>
<context-root>/my-context-path</context-root>
</jboss-web>
If this doesn't work you may need to rename WebContent directory to WebContent.war, even if it is exploded it may want .war in the name.

Setting context-root path in Jboss

I want to deploy an application outside the "deploy" folder of JBoss in JBoss 6.0.0
my folder names must be specified in URL syntax. For example, to specify that C:/rev/deploy be used for deployment,inside deploy folder I placed my war file i.e,ORNC.war so I edited my profile.xml as
<property name="applicationURIs">
<list elementClass="java.net.URI">
<value>${jboss.server.home.url}deploy</value>
<!-- Add your own deploy folder -->
<value>file:///C:/rev/deploy</value>
</list>
</property>
After this I restarted my server. Now I am trying accessing: http://localhost:8000/rev/deploy/ORNC,
I am getting an error resource not available. How can I acess it? Please help me
Finally I got the answer my question ,Actually we need to create a jboss-web.xml file with below coding
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>/rev/deploy/ORNC</context-root>
</jboss-web>
After that I placed this xml file in my WEB-INF folder of my WAR file.Now I can access my war file through http://localhost:8080/rev/deploy/ORNC
By referring this I get an solution for my question
JBoss 7: how to change a WAR context root
Thanks for Mr.simkam and Stackoverflow.

Deploy .war file from another directory to Tomcat 6

If it is possible, how do I deploy a war file from another directory (say D:\foo.war) to Tomcat 6, without copying it into the webapps directory of Tomcat?
If not, is there any configuration to change the default webapp folder to some other folder?
You can do both.
how do I deploy a war file from another directory (say D:\foo.war) to Tomcat 6, without copying it into the webapps directory of Tomcat?
Add a Context xml file to conf/Catalina/localhost. The name of the file should be the name that you want for the context. For example, if my URL is http://your.domain.com/my-context then the name of the file would be my-context.xml. Inside that XML file add something like this.
<?xml version="1.0"?>
<Context docBase="d:\foo.war">
</Context>
The docBase attribute should point to your WAR file or an exploded WAR directory. See more on this here.
If not, is there any configuration to change the default webapp folder to some other folder?
In conf/server.xml locate your Host tag and set the appBase attribute. This defaults to webapps, but you can change it to any location that you like.
Ex:
<Host appBase="d:\my-web-apps" ...>
For best results, point to local storage and not network storage (i.e. NFS or Samba).
Simply specify a context entry in your server.xml (under <Host> </Host>
<Context docBase="xyz/abc.war" path="/myapp" reloadable="true"/>

Context pointing to external directory in Jetty 9

I want to deploy a .war file to Jetty by setting up a context that points to my external .war (outside webapps folder). I know how to do this in Tomcat, but I can't figure out how to do this for Jetty 9.
In Tomcat I placed an .xml file to configure my context in $CATALINA_HOME/conf/Catalina/localhost :
<?xml version='1.0' encoding='utf-8'?>
<!-- Context fragment for deploying ServletExample.war -->
<Context path="/CurrencyServlet" docBase="/Users/macbook/Desktop/School/Java/Temp/CurrencyServlet.war" debug="0" privileged="true"/>
Can anyone provide a simple example for Jetty 9?
Have a look at the provided $jetty_home/webapps/test.xml file. In jetty9 you can configure your webapps, etc. by placing a ContextProvider config file in $jetty_home/webapps.
Have a look at the docs: http://www.eclipse.org/jetty/documentation/current/configuring-contexts.html
This is how you configure the path to your webapp:
<Set name="war"><SystemProperty name="jetty.home" default="."/>/webapps/test</Set>

jboss-web.xml context path name is different from war file's name

The context-path name in jboss-web.xml is different from the application which we deploy in jboss-5.0 GA.
My application creates some files with in the applications sub-folders. but when it goes to create files it searches the application with the name which is mentioned is jboss-web.xml file.
I use exploded-war file as my application, which is like file. Inside this many folders are there.
<context-root>/Test</context-root>
but my application name is Test-0.0.1
Hi Actually /Test is my context-path name in jboss-web.xml
context-root is used to tell application server as which webapp should a request be delegated to based on the URL. Now from my understanding you ant to access the resources inside your application as like http(s):/:/Test/YouResourceName.
To do something like that I will suggest to keep the context-root as Test(not starting with '/'). You need to specify web-uri as the child element of tag where you have specified context-root. So it should look something like
Test-0.0.1.war
Test