Using "/" as default project root on Jboss Wildfly - jboss

I have a wildfly-14.0.1.Final server and a project (foodHosting) with a deployable ear module named foodHosting-ear and a web war module named fooHosting-web. After the deploy to reach my index.xhtml I have to write localhost:8080/foodHosting-web/ to my browser. Is there any solution to write only localhost:8080 and show my application? Like localhost:8080/index.xhtml?

You have to rename the fooHosting-web.war to ROOT.war
Edit: It's not needed to rename the .war inside your .ear, you have to change the context-root as the answer #wirnse said in the comment, but instead of /WEB-INF/jboss-web.xml check your /META-INF/application.xml and empty the context-root tag: <context-root></context-root>

Related

Jetty deploy war file (Automatic Deployment is not working)

this is my first time deploying a war File to a Jetty Server via SCP+SSH and I'm not able to get it to work.
I made a proper .war file with Eclipse (but I also tested the same things I'm going to mention with a example .war file) and copied the file to the folder /jetty/webapps/ROOT. Now when I restart Jetty and try to get on the server (I tried Serveradress/WarFilename/ aswell) I get to a Directory Path and I'm able to download the war file but nothing else.
I also tried to copy the war file to the webapps folder itself instead of webapps/ROOT. What am I doing wrong?
The directory ${jetty.base}/webapps/ROOT/ is for exploded webapps, or static resource deployments.
If you want to serve your war file, say myapp.war on the root context "/", then copy it to the file ${jetty.base}/webapps/ROOT.war
Note: if you are copying the file into the jetty-distribution/webapps/ you are doing it wrong, go read up on how ${jetty.base} and ${jetty.home} work.

tomcat do not unpack war file

i stopped tomcat
paste myapp.war into webapps folder.
start tomcat
call in browser
http://localhost:8080/myapp/index.jsf
see 404
also tomcat does not generate log files under logs directory.
I am using eclipse to start and stop tomcat, and my tomcat 7 is an unzipped version.
to be sure that my war file runs on server, i remove same project from tomcat in eclipse servers view.
repeating question, but i think my situation is a little different, tomcat does not generate logs.
a note: i generate war file by right click in eclipse-> export war file.
thanks for any idea.
If you are launching tomcat from within Eclipse (using the webtools tomcat server adapter) you will have to make sure you have changed the settings to use the installation directory to launch instead of the default which uses a separate location for loading and deploying webapps. So if you add a war directly into the webapps folder, the server launched from Eclipse server adapter wont have that directly setup in the server.xml configuration.
So you should use the startup.bat/startup.sh in the tomcat/bin folder. If you do, you need to make sure that you don't just copy the .war file into the webapps, but rather unzip the war file into a directory folder called "myapp"

deploy.last in JBoss 5.1 in web configuration?

We have ear that depends on war file.
We use web configuration.
I put war file to <jboss_home>/server/web/deploy directory.
And I put ear file to <jboss_home>/server/web/deploy/deploy.last directory.
But ear starts prior to war.
Why?
I use a similar configuration to what you describe, though I put all the apps I want to deploy first in deploy/myapps and all the ones to deploy afterwards in deploy/myapps.last. This works correctly for me on JBoss 5.1.2.
Although I can't explain why it isn't working for you, I can offer an alternative solution. You can make the EAR declare a dependency on the WAR and JBoss will then ensure the WAR is deployed first.
First, add a file called aliases.txt into the META-INF directory of your WAR. This file should just contain a single line with an arbitrary name / identifier for your WAR. For example, if you have mywebapp.war, your META-INF/aliases.txt file could contain 'mywebapp'. It just needs to be something that won't clash with any other aliases declared by other apps deployed on the same server.
Next, add a jboss-dependency.xml file to the META-INF directory of your EAR, containing the following (subsituting 'mywebapp' for the alias you created above):
<dependency xmlns="urn:jboss:dependency:1.0">
<item whenRequired="Real" dependentState="Create">mywebapp</item>
</dependency>
This should ensure the WAR is deployed before the EAR.
Also, if you try to deploy the EAR without the WAR being present, JBoss will log a clear deployment error message telling you about the missing dependency.

In eclipse, is there a way to specify a location other than the WEB-INF, for web.xml

I want to place development web.xml in another folder in eclipse.
This can be done using the Deployment Assembly properties. Right click on the web project, choose Properties, and then navigate to the Deployment Assembly panel. Remove the /WebContent entry (pointing to /) and then add another entry, of type Folder. It should be rooted where you want to keep the web.xml, and mapped to /.
This technique can be extended to make Eclipse work with arbitrary build tool source layouts.
You might want to use Apache Ant
for that purpose. You may define a "conf" directory and place all you config files there, or a resource directory for the same reason.
If haven't use ant for that purpose, I strongly recommend you to do so.
Here is a sample ant build.xml for a web app Sample Build.XML
I'll use Maven myself, but since you're just beginning, Ant would be just fine.
I am using the eclipse builder and not ant.
Actually what i did was that i defined web.xml in another folder. So now I have two web.xml, one for welogic with a lot weblogic specific stuff like filters. And i have another for development which i placed in another folder, in the web project and added this folder to the deployment descriptor for tomcat in eclipse. So now when i deploy the application, the web.xml for tomcat which is in my specified folder owerwrites the web.xml present in web-INF folder(in the deployment directory).
Looks to me a nice workaround.

JBoss 4.2.3 EAR and Apache 2.2 virtual hosts with jk_mod serving blank white page

I have an EAR file I am trying to deploy alongside various WAR deployments on JBoss 4.2.3
The individual standalone WAR deployments are all working fine and are just a copy of the same application that is contained inside the EAR but the EAR deployment and it's included WAR(s) does not work correctly.
I am receiving a blank white page in the browser when I visit the virtual host that the jboss-web.xml is configured to associate with this EAR. The other virtual hosts associated with the standalone WAR deployments all work fine and are configured the same way.
I get no errors on startup and JBoss reports that the site was started. I have a jboss-web.xml file in the WAR's WEB-INF that ties it into a definition from server.xml. This works on every other type of configuration except the EAR. I keep getting just a white page, as if JBoss can't connect the WAR in the EAR to the host or maybe the WAR isn't starting right or I have some config wrong here.
When I fire up JBoss it creates the flex and railo directories in webwar1.war/WEB-INF as well as a railo-server directory as railo.ear/lib/railo-server but still just serves me a blank white page.
Here is where I stand...
I have a set of shared Railo JAR files are located in /JBoss/server/default/deploy/jboss-web.deployer/railojars/lib (I have told jboss-service.xml to include this as a classpath)
My site1.WAR and site2.WAR files are in the deploy folder and each contain an index.cfm and a WEB-INF with web.xml and jboss-web.xml mapped to a virtual host. They each use this shared Railo JAR instance and run perfectly. The sites I've configured in server.xml with a docPath and appPath to an outside folder use this shared JAR installation and run perfectly. Everything is good with this.
If I place a railo1.war, railo2.war, etc in the /JBoss/server/default/deploy folder (the full WAR with Railo lib folder) those sites use the Railo instance contained within the WAR. This is also great.
So, my only problem left is this:
under /JBoss/server/default/deploy I have created railo.ear
Inside railo.ear is:
META-INF which contains application.xml with:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE application PUBLIC "-//Sun Microsystems, Inc.//DTD J2EE Application 1.2//EN" "http://java.sun.com/j2ee/dtds/application_1_2.dtd">
<application id="RailoInstance1">
<display-name>Railo3</display-name>
<description>Railo3</description>
<module id="Module1">
<web>
<web-uri>webwar1.war</web-uri>
<context-root>/webwar1</context-root>
</web>
</module>
</application>
It also contains webwar1.war which contains: index.cfm and WEB-INF
WEB-INF has has web.xml, lib and jboss-web.xml
jboss-web.xml looks like this:
<jboss-web>
<context-root>/</context-root>
<virtual-host>foo3.com</virtual-host>
</jboss-web>
From server.xml:
<Host name="foo3.com">
<Alias>www.foo3.com</Alias>
</Host>
foo3.com is using jk_mod to send to JBoss via a virtual host from Apache. The other two sites (foo1.com, foo2.com) which are mapped to WAR deployments are configured the exact same way and work fine.
The WEB-INF includes the lib folder so I would expect this webwar1.WAR instance to use the Railo JAR files contained in that lib folder. The problem is that when I start JBoss, all of my other sites configured their various ways work, but the site in webwar1.war is not coming up. I simply see a white page in the browser.
So, either the jboss-web.xml in WEB-INF in the webwar1.war file is not being connected to the defined in server.xml or something else is going wrong here. My other standalone WAR installations and the shared JARs sites all see their respective descriptors as marked in their jboss-web.xml and have the same content as this deployment.
So, I'm just trying to figure out what I need to do to get this last EAR configuration to work.
The way I am trying now seems like each WAR would try to use the JAR files it contains, but I want to have one set of shared JAR files for the whole EAR and then each WAR file in the ear use those JARS.
I want to be able to have webwar1.war, webwar2.war, etc under this one EAR configuration so I have moved the lib folder out of webwar1.war/WEB-INF/lib and into railo.ear/lib
I would love to set it up this way, but I can't even get one WAR with its own JAR files to load up right when inside the EAR. I have tried this new configuration and get the same blank white page in the browser.
Any ideas?
JBoss gives me no errors. Another odd thing is that I don't get an error from Apache like I do when I try to visit a site that is improperly configured and did not start up. And if I visit a site that is not set up as a host in JBoss and I am redirected via jk_mod to JBoss, I see the JBoss default page. I am not seeing this default page when I visit the virtual host associated with this webwar1.war in the railo.ear, so JBoss must know that it's supposed to do something with the domain / virtual host or else it would show me that default JBoss page. Instead I see a blank white one.
I should also mention that this works on JBoss 5.1. The railo.ear configured the exact same way latches onto the virtual host and works properly.
Help? Thanks!!!!
Sounds like a complicated job; the folks on the railo-users mailing list might be able to help : http://groups.google.com/group/railo
Railo also has a professional services team who are ace : http://www.getrailo.com/index.cfm/contact-us/