how to change Jboss default page to the home page

2020-07-27 05:53发布

I have an application deployed in JBOSS and it is accessed as: localhost/appname When i enter only the IP address i get redirected to the JBOSS default page. Is there a way to go to the application's homepage with no need to give /appname ?

I hope the question is clear. Thanks in advance.

标签: jboss
3条回答
叼着烟拽天下
2楼-- · 2020-07-27 06:40

I am using eap6. This is my first time to use jboss. I don't see that I have $JBOSS_HOME/server. I see $JBOSS_HOME/domain/server. I have searched all the files under $JBOSS_HOME. I cannot find any WEB-INF and jboss-web.xml

查看更多
ゆ 、 Hurt°
3楼-- · 2020-07-27 06:58

A part of the solution given by Nightsorrow, you can also define the context root of your web application using the context-root tag of the WEB-INF/jboss-web.xml file. So defining it as '/', you can keep your original file name. This way you override the default behaviour of JBoss, which is defining the context root of web apps as the file name of the application (unless the app name is ROOT.war, which its default context is '/').

So the jboss-web.xml file would look like something similar to:

<jboss-web>
   ... other tags ...
   <context-root>/</context-root>
   ... other tags ...
</jboss-web>

Notice that there can't be two applications with the same context root, so first you will have to remove ROOT.war, or change its context root following the same procedure:

  • adding the context-root tag to jboss-web.xml (for example: <context-root>/oldRoot</context-root>, which would make the old ROOT.war application available through localhost/oldRoot),or
  • just changing its file name.

In case you want to deploy an EAR file with a web module (war) inside (instead of just a plain war file), you've to use the META-INF/application.xml of the EAR. Defining the web module this way:

<application>
        ... other tags and other modules (ejb, web ...) ...
    <module>
        <web>
            <web-uri>nameOfYourWarFile.war</web-uri>
            <context-root>/</context-root>
        </web>
    </module>
        ... other tags and other modules (ejb, web ...) ... 
</application>
查看更多
甜甜的少女心
4楼-- · 2020-07-27 06:59

You have to deploy your application in file named "ROOT.war". Also you have to delete existing ROOT.war in deploy directory.

查看更多
登录 后发表回答