How to change default start page of Glassfish? - redirect

Currently when I type in the URL of my webapp, say "http://abc.edu/mywebapp/", I am taken to the login page of my webapp. When I type "http://abc.edu/", I am taken to the GlassFish info page. How can I do it such that when I key in "http://abc.edu/", I will be taken to my login page and not the GlassFish info page?

Option 1: You can set one of your webapps as default. This can be done with the admin console:
Configuration --> Virtual Servers --> server
Then select your default web application from the drop-down menu. If your webserver port is 8080, you can start your application now by:
http://hostname:8080
instead of http://hostname:8080/webapp
Notice that "server" is the name of Glassfish's default virtual server. If you configured a different virtual server for your webapp you need to change it accordingly.
Furthermore regarding this source, there might be some problems with JDBCRealms.
Option 2: You could also deploy your default webapp to "/" instead of "/webapp" but I think the first option is more flexible.

You need to change your context root to "/" Edit the application.xml that is where the context root for the app is set. You might have to undeploy the default context root inorder to do that (that is what I do in JBoss, I undeploy ROOT.war).

Related

Show maintenance page during Wildfly startup

I have a WildFly installation which takes some time during startup due to the count and size of the deployments. So I would like to show a maintenance page until the full application is ready.
In one of the previous WildFly versions I used default-web-module as configuration option and registered a small WAR file, which was visible right away and was replaced as soon as the big application was available.
Unfortunately this is no longer possible with WildFly 22, instead an exception is thrown as soon as the real root application is deployed:
org.jboss.msc.service.DuplicateServiceException: Service jboss.undertow.deployment.default-server.default-host./.UndertowDeploymentInfoService is already registered
I know that I could put a small web server (nginx or similar) in front of WildFly to return my maintenance webpage as long as WildFly returns a 503 error. The only thing which prevents that is the fact, that the maintenance page still contains some logic which I would need to emulate on nginx.
Is there any other option which ensures that my maintenance page is delivered immediately while the other apps are still starting?
If I do understand your question correctly, what you want is to show error page of status 503 when server is down or 404 when server is replacing deployments.
But for your environment which don't have a web server in front of application server, we just need to consider 404 situation.
503 is for web server when the application server is down, therefore, 503 service unavailable.
First: Console -> Configuration tab
Head over to management console of Wildfly. And depends on what mode(domain or standalone) you are using ,there will be a little different inside configuration tab.
Second: Configuration -> Web -> Filters
If using domain mode, choose the profile you are using it.
And head over to Subsystem -> Web(Undertow) -> filters -> click 'View'.
I used profile 'full' in my local machine with domain mode, therefore, this is what my console looks like.
Path_to_Filters
Third: Choose Error page tab inside Filters
Set code and path like this, where code is what status code you hope the static page to show. And path is the file location of your static page.
setPathAndCode
You can see Wildfly doc for error-page settings.
Fourth: Configuration tab -> Web(Undertow) -> Server -> default-server(or what you used)
HeadToServer
Fifth: Choose Hosts tab inside servers
Choose 'Hosts' tab, and click add filter button.
Select the filter we just set in step three, and set predicate to true.
I'm not sure what will be effected if didn't set as true or left empty, cause it's not required fields.
Last: Restart the server in order to let your configuration works.
Now you should able to see your static page showed when you undeploy or re-deploy your application.
Sorry for not answering in too good answer format because I didn't answer any questions before.
** You can also set your standalone.xml or domain.xml like this to get the same result.
setXmlFile

websphere application server behind ingress redirects to dns:port

I am trying to run websphere behind ingress.
I have successfully configured the ingress for it and I am able to access the console.
The ip on which I am able to access the console is
https://mydomain/ibm/console/logon.jsp
Note: I have a domain , for which I created a A record.
When I login into the console ,
I am redirected to
https://mydomain:9043/ibm/console/
This page does not exist.
If I explicitly run the URL https://dns/ibm/console/login.do?action=secure. My application works fine.
Can someone tell me where is the configuration needed so that it is not redirected to dns:port?
I have created all the config following the URL:
Problem configuring websphere application server behind ingress
The request is http://hostname/ibm/console/logon.jsp and it returns http://hostname:9080/ibm/console/logon.jsp
This is causing confusion and thus we are facing an issue.
The port which our was app uses is controlled by two properties:
trusthostheaderport = true
com.ibm.ws.webcontainer.extractHostHeaderPort = true
These can be created in the WAS Admin console under:
Servers > Server Types > WebSphere application servers > [server_name] > Web Container Settings > Web container > Additional Properties > Custom Properties
Setting both of these properties with a value of "true" should force WAS to use the front-end port (from the Host header) instead of the Webcontainer port.
Note: You need to restart the service after the change ( restart in case of docker containers)
Please find the documentation here.

Jazz: Context root not found

I'm pretty beginner with the whole RTC concept, so I have started a server:
Server clm is started.
The clm server was started.
I am trying to login to jazz admin page to configure the setup, the url I'm using is:
http://[fully qualified hostname]:9080/jts/setup
http://[fully qualified hostname]:9080/jts/admin
I get the "Context root not found" page, not sure where am I going wrong. Then again I found a URL for Liberty admin center page ( not sure why is it used). But I gave it a try
http://[fully qualified hostname]:9080/adminCenter
I can open the page, but i do not have the login credentials. It is pretty confusing, if anyone can guide me through it'd be helpful.
From this thread:
The context root being accessed is /jts... and jts is a default context root for JTS (refer to Installing the Rational solution for Collaborative Lifecycle Management by using IBM Installation Manager).
Unless a different context root was entered during the installation, I would expect /jts to be the context root for JTS application.
%CLM601_DIR%\server\liberty\servers\clm\conf\application.xml has information about the application being deployed.
It should also show application context roots as well.
Can you access /jts/scr or any other applications such as /ccm/scr, /qm/scr, etc?
If not, that could be that the applications are not deployed OR they did not start up successfully.
You can check logs such as console.log, jts.log, etc in %CLM601_DIR%\server\liberty\servers\clm\logs and see if any errors are there.

How can I access to my app with WildFly

I'm having a very painful time with WildFly.
I successfully deployed my war and the log said
WFLYUT0021: Registered web context: /myapp
And I can't access the app with 404.
http://192.168.56.101:8080/myapp/index.html
What did I do wrong?
Are you sure, you have an index.html at the right place in your war-file? You must probably post more information on your file structure, web.xml, etc.
Another stumbling block could be in standalone.xml (config file of wildfly): To which IP is the application server bound? 127.0.0.1? Or 0.0.0.0?
Try accessing the app with http://localhost:8080/... (on the machine you deployed it). If this works, you need to change your standalone.xml file (replace all '127.0.0.1' occurrences with '0.0.0.0' is the easiest way)
Hope this helps. Otherwise, try to be more specific.

Bluemix SAML and timeout session issue

I've created Web Application running on Java Liberty Runtime on Bluemix. Login is done by using SSO service with SAML enterprise provider. After login user redirected to my app and on every JAX-RS request I get user's credentials by following code:
Subject s = WSSubject.getCallerSubject();
Object credential = s.getPrivateCredentials().iterator().next();
String loginToken = credential.toString();
Everything works fine, but if the user has been idle for more then 10 minutes and then perform any ajax request WSSubject.getCallerSubject() returns null, and I required to refresh application.
I've tried to increase timeout by adding following attribute to web.xml:
<session-config>
<session-timeout>60</session-timeout>
</session-config>
But it didn't help. So I'm looking how can I increase timeout or possible I can retrieve user credentials in a different way?
You need to add the optional element <authCache> to the server.xml file to change the default values for the authentication cache.
As you mentioned in your question, the default value is 10 minutes. To change it to 60 minutes you need to include the following in the server.xml file:
<authCache initialSize="50" maxSize="25000" timeout="60m"/>
The documentation here provides more details and also explains initialSize and maxSize options, I left the default value for these two above and just updated timeout.
If you are deploying your application using the default method of pushing the war file, you will need to use a different approach to deploy the application with a custom server.xml file. Please check the documentation here for options on pushing Liberty profile applications (more specific check sections Server Directory and Packaged Server).
In this case, you may also want to check the server.xml file that is currently deployed and modify that version to add the <authCache> element.
You can get a copy of the file by running the following command:
$ cf files <your_app_name> app/wlp/usr/servers/defaultServer/server.xml