I am using richfaces a4j:push in my Spring-JSF integrated application. I am able to push messages to the browser using websocket in my non cluster environment on wildfly 8.0.0.
When I deploy the application on wildfly8.0.0 on redhat enterprise 7.0 with httpd clustering the push messages are not working.
I get the following error on cluster environment:
17:15:22,862 ERROR [io.undertow.request] (default task-3) UT005023: Exception handling request to /star/__richfaces_push: java.lang.IllegalStateException: UT000077: The underlying transport does not support HTTP upgrade.
My cluster is configured with mod_cluster, referring the document
When I look for details on error UT000077, it says ‘Apache httpd doesn't support HTTP upgrade out of box’ I understand HTTP upgrade is required for websocket communication. It is suggested to use mod_proxy_wstunnel. However the details are not available for this configuration.
Any pointers/suggestions are much appreciated.
At the time of this answer AJP [which is the default one] does not support HTTP upgrade and hence not websocket.
If you switch to HTTP websocket will work.
Following changes you need to do to switch to AJP
Change
LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
#LoadModule proxy_http_module modules/mod_proxy_http.so
To
#LoadModule proxy_ajp_module modules/mod_proxy_ajp.so
LoadModule proxy_http_module modules/mod_proxy_http.so
[comment out proxy_ajp_module and added proxy_http_module]
In modcluster sub-system
Change
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="ajp">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
To
<subsystem xmlns="urn:jboss:domain:modcluster:1.2">
<mod-cluster-config advertise-socket="modcluster" connector="default">
<dynamic-load-provider>
<load-metric type="cpu"/>
</dynamic-load-provider>
</mod-cluster-config>
</subsystem>
[“default” is the name of the http listener]
Also you need to load mod_proxy_wstunnel in your httpd
MODCLUSTER-438 WebSocket support for mod_cluster
Let me give my two cents in this question to people there are using Apache 2.2.x If are you using Apache 2.2.x you need to compile the mod_proxy_wstunnel from Apache 2.4 for Apache 2.2.x This link have a how to do it. Following, to achieve WebSockets with mod_cluster you need also compile mod_cluster 1.3.3+ as described in this link and add EnableWsTunnel in your mod_cluster.conf outside your virtual host
I hope helps.
Related
I am using Apache Tomcat 9 server as a Maven dependency in my project. It is working fine and now I need to add a health endpoint so that it will return 200 OK if everything is running fine.
I came to know about HealthCheckValve (https://tomcat.apache.org/tomcat-9.0-doc/config/valve.html#Health_Check_Valve) option in Tomcat 9 which is helpful. But I am not been able to figure out where to add this and the process of configuring this valve. As I know if server is standalone we can configure in Server.xml but as the Tomcat Server is a maven dependency I don't know how and where I should configure this.
Can somebody please help me in configuring health endpoint in Apache Tomcat 9 (as a maven dependency) ?
See the documentation, then add the HealthCheckerValve to server.xml. Valves go into either the Engine, Host or Context element. In the server.xml packaged with Tomcat you can find comments that should direct you to the right location.
When embedding a version of Tomcat, you won't have this file available, and so you need to assemble instances of these containers programmatically.
Check the launcher application in this example: https://www.oracle.com/webfolder/technetwork/tutorials/obe/java/basic_app_embedded_tomcat/basic_app-tomcat-embedded.html
While I could not find methods like addValve() I found an init() method that you could use to provide a server.xml which will be read by Tomcat.
I saw the documentation of all valves available in Tomcat 9.0.x.
In order to find the solution of this specific task, I tried looking for configuration of other valves such as Remote Address Valve in embedded tomcat.
I found a solution by user967710 after searching a lot.
I did the following to add a Health Check Valve to my Tomcat 9.0.64 :
Tomcat tomcat = new Tomcat();
tomcat.getEngine().setName(UUID.randomUUID().toString());
tomcat.setPort(context.port);
tomcat.setHostname(context.hostname);
tomcat.getHost().setAppBase(".");
Valve valve = new HealthCheckValve();
tomcat.getHost().getPipeline().addValve(valve);
It doesn't matter how you configure the Tomcat for your project i.e from line 1 ~ 5 but actually last 2 lines i.e 6 and 7 are important where you are adding the valve.
The health endpoint can be accessible on host:port/health.
For e.g if it is hosted at http://localhost:4000 then the health endpoint would be http://localhost:4000/health
This endpoint will return 200 OK with a simple JSON response stating the Tomcat server status i.e "UP" if everything is up and running.
I want to migrate from http to https in wildfly 19.1
after setup all configuration from this tutorials https://medium.com/#hasnat.saeed/setup-ssl-https-on-jboss-wildfly-application-server-fde6288a0f40 i have trouble :
when my application server startsup try to load all of pages.
note: my project is a huge project with heavy queries and this action take a lot of time
I found the solution. In the Standalone.xml we should disable the enable-http2="true" of this line:
<https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="false"\>
Is possible to keep HTTP session between redeploys on WildFly?
You might try configuring session persistence. Here is a blog on how to do it.
<servlet-container name="default">
<persistent-sessions path="session" relative-to="jboss.server.temp.dir"/>
<jsp-config/>
</servlet-container>
However, it seems that this feature is available startinng from v8.2. I'll quote a note from this blog
You can also achieve session passivation, when you are using a non-ha profile, by adding <distributable/> to your web.xml (for those using WildFly 8.1.0 or less).
<distributable/> in web.xml deployed to standalone may lead you to WFLY-3715 (logs polluted with undertow exceptions).
Alternative option can be to configure persistent sessions in standalone.xml or with jboss-cli.sh. JBoss CLI command worth to mention, as it can be used within maven plugin for WildFly.
/subsystem=undertow/servlet-container=default/setting=persistent-sessions:add(path="session", relative-to="jboss.server.temp.dir")
Log pollution example:
2016-12-29 09:39:48,464 ERROR [io.undertow.request] (default task-26) UT005023: Exception handling request to /resources/js/holder.js: org.infinispan.util.concurrent.TimeoutException: ISPN000299: Unable to acquire lock after 15 seconds for key SessionCreationMetaDataKey(EkmgBEYcvqFxNF_T2dDwEfyXkh7Nzcv2nTKBYy9G) and requestor GlobalTransaction::13:local. Lock is held by GlobalTransaction::12:local
at org.infinispan.util.concurrent.locks.impl.DefaultLockManager$KeyAwareExtendedLockPromise.lock(DefaultLockManager.java:238)
at org.infinispan.interceptors.locking.AbstractLockingInterceptor.lockAndRecord(AbstractLockingInterceptor.java:193)
at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.checkPendingAndLockKey(AbstractTxLockingInterceptor.java:193)
at org.infinispan.interceptors.locking.AbstractTxLockingInterceptor.lockOrRegisterBackupLock(AbstractTxLockingInterceptor.java:116)
at org.infinispan.interceptors.locking.PessimisticLockingInterceptor.visitDataReadCommand(PessimisticLockingInterceptor.java:71)
at org.infinispan.interceptors.locking.AbstractLockingInterceptor.visitGetKeyValueCommand(AbstractLockingInterceptor.java:80)
at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:43)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99)
at org.infinispan.interceptors.TxInterceptor.enlistReadAndInvokeNext(TxInterceptor.java:346)
at org.infinispan.interceptors.TxInterceptor.visitGetKeyValueCommand(TxInterceptor.java:331)
at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:43)
at org.infinispan.interceptors.base.CommandInterceptor.invokeNextInterceptor(CommandInterceptor.java:99)
at org.infinispan.interceptors.InvocationContextInterceptor.handleAll(InvocationContextInterceptor.java:114)
at org.infinispan.interceptors.InvocationContextInterceptor.handleDefault(InvocationContextInterceptor.java:83)
at org.infinispan.commands.AbstractVisitor.visitGetKeyValueCommand(AbstractVisitor.java:85)
at org.infinispan.commands.read.GetKeyValueCommand.acceptVisitor(GetKeyValueCommand.java:43)
........
I have a Java application deployed on Oracle Weblogic server which can be accessed via http://www.example.com/myapp
This works fine but now I want to get rid of "myapp" in the URL so the application can be accessed only via http://www.example.com
Is this possible? If yes, how?
I don't know about Weblogic but in JBoss and Tomcat you'd name your application ROOT.war.
IMHO this is not desirable so I'd employ some URL rewriting, e.g. by using an intermediate apache webserver, which then forwards /myapp(/.*) to $1.
Of course you'd have to remove the context root from any internally generated links, but how that is done would depend on your application and environment.
I deploy a Reverse Proxy, you can use Oracle HTTP Server or Apache for this, I use mod_wl_ohs in the OHS and it's pretty simple:
<VirtualHost *:80>
ServerName myexample.com
<IfModule weblogic_module>
DynamicServerList On
WebLogicHost <IP of the weblogic>
WebLogicPort <PORT>
<Location />
RedirectMatch ^/$ /store
SetHandler weblogic-handler
WebLogicHost <IP of the weblogic>
WebLogicPort <PORT>
</Location>
</IfModule>
</VirtualHost>
Plus, it'll give you another security layer if you setup and URL-Firewall using REWRITE mod.
<context-root> in application.xml needs to be set to / like this:
<web>
<web-uri>web.war</web-uri>
<context-root>/</context-root>
</web>
Further reading:
Weblogic Docs on context-root
Similar question on SO
I have a strange behavior of Glassfish 3.1.2.2 (build 5) running on OpenIndiana 151.a3
Using oracle jdk 1.7.0_5.
When i deploy my web application which has a spring web dispatcher and stripes servlet
I get them initialized twice in a row e.g.
PWC1412: WebModule[null] ServletContext.log():Initializing Spring root WebApplicationContext|#]
INFO StripesFilter - Stripes Initialization Complete. Version: 1.5.6, Build: 1.5.6
PWC1412: WebModule[null] ServletContext.log():Initializing Spring root WebApplicationContext|#]
INFO StripesFilter - Stripes Initialization Complete. Version: 1.5.6,
Build: 1.5.6
WEB0671: Loading application [my-web] at [/my-web]|#]
That wouldn't be a much problem if not for an blazeds servlet that i initialize from spring which fails completely on second initialization. I tried disabling blazeds servlet but that doesn't solve double initialization problem because i still get messages of initialization twice in a log. And my application wouldn't work without blazeds so i'm in a pinch here.
UPDATE: I've confirmed it only happens on OpenIndiana host, same configuration on linux works without issues
We had a similar problem. We also tried to deploy to a particular virtual server, which did not work. To fix the issue I ended up having to manually delete the extra virtual-server from the domain.xml:
<virtual-server id="admin-server" network-listeners="http-listener-2"></virtual-server>
If you have more than one virtual server:
"If you deploy a web application and don't specify any assigned virtual servers, the web application is assigned to all currently defined virtual servers"
http://docs.oracle.com/cd/E18930_01/html/821-2416/ggncs.html
But this did not solve our problem.
We had to delete the extra virtual server for it to work. This also happens on 3.1.2 and it is not just a windows problem. We replicated the issue on Linux too.