How to configure Wildfly 9 to failover HTTP sessions - java

I'm really struggling to configure Wildfly 9 to cluster/failover its sessions...
I keep reading that wildfly in standalone-ha mode will automatically discover peers and automatically share sessions, but it's clearly not working for me.
I have setup 3 AWS EC2 servers which all have the same configuration. They all run the same versions of everything and have the same webapp .war file deployed to each of them. This webapp works fine, I can log in to the app which maintains a simple session variable to verify that I am logged in. I've launched each server with standalone-ha.xml configuration files but logging into one doesn't allow be to access the session in any of the others.
I've tried all the things I can think of, but don't know how to diagnose the issue as I don't know how the servers identify each other.
I've manually deployed the war file on each server but placing the file into .../standalone/deployments/
Each has a fully open firewall...
Oh - I set the muticast address on the command line to 230.0.0.4 (That number came from a guide, and I have literally no understanding of it) and each is bound (-b) to the internal IP of the server...
Any help appreciated...

First you must consider that in AWS EC2 multicast traffic is not allowed and thus MPING will not work.
See http://developer.jboss.org/wiki/JGroupsS3PING
An example how to implement S3Ping http://aws.typepad.com/awsaktuell/2013/10/elastic-jboss-as-7-clustering-in-aws-using-ec2-s3-elb-and-chef.html

Related

Set Up New Tomcat Server

I am kind of a newbie on server, environment stuff, so I need help on setting up a new Tomcat server.
Actually I have installed one instance and it is running already on my dedicated server, but I can't access it's main page, so it is made possible to deploy my apps.
These are the internet proccess in the server. Tomcat is running on port 8080. I tried to access it by IP:8080 and it doesn't work
So is there some extra configuration on a dedicated server to be made? Some security stuff?

Tomcat restarts with errors (exit 143), runs and then fails after time

This is my first time asking a question on Stack Overflow. I recently configured an Ubuntu 16.04 virtual private server to host a web application. I run ngnix on a Tomcat server that reads and writes to a MySQL database. The application runs fine except for the fact that Tomcat restarts itself once in a while which results in a 500 error that stems from a "broken-pipe" when anyone tries to login (i.e. make a connection to the database).
I will post an image of the 500 next time it happens. I went into my vps and looked at my Tomcat restart message. This is what I see: Tomcat status message.
I also did a little diving into the Tomcat logs and this is a log file that corresponds with that restart time: Tomcat log file
I did some research to try and solve this myself, but with no success. I believe that the exit=143 is the process being terminated by another program or the system itself. I also have done some moving of the mysql-connector-java.jar. I read that it should be located in the Tomcat/lib directory and not in the WEB-INF of the web application. Perhaps I need to configure other settings.
Any help or any direction would be much appreciated. I've fought this issue for a week with having learned much, but accomplished little.
Thanks
Look at the timeline. It starts at 19:49:23.766 in the Tomcat log with this message:
A valid shutdown command was received via the shutdown port. Stopping the Server instance.
Exit code 143 is a result of that shutdown and doesn't indicate anything.
The question you need answered is: Who send that shutdown command, and why?
On a side note: The earlier messages indicates that Tomcat lost connection to the database, and that you didn't configure a validation query. You should always configure that, since database connections in the connection pool will go stale, and that needs to be detected.
Theory: Do you have some monitoring service running that tests your application being up? Does that monitoring detect a timed-out database connection, classify that as a hung webapp and auto-restart Tomcat?
While I don't think I am able to see to the core of the problem you have with your overall setup given the small excerpt of your log files, one thing strikes the eye. In the Tomcat log, there is the line
A valid shutdown command was received via the shutdown port. Stopping the server instance.
This explains why the server was restarted. Someone (some external process, a malicious attacker, script, or whatever. Could be anything depending on the setup of your server) sent a shutdown command to Tomcat's shutdown port (8005 by default) which made the Tomcat shut down.
Refer to OWASP's recommendations for securing a Tomcat server instance for fixing this possible security whole.
Regarding the ostensible Hibernate problems you have, I don't get enough information from your logs to make a useful statement. But you can leave the MySQL jar in Tomcat/lib, since this is not the root cause of your problem.

Websphere 7 - How to know EARs ports deployed in the same Server Instance

I'm currently deploying 2 EARs in the same Server Instance. The first one can be accessed in the port 9081, but the second one can't. Is there any way to know in which port I can get access to the second one? I've been trying to look it up in the Administrative Console but got nothing so far.
If both applications deployed to same Server the port should be same. Confirm from console if application is started and mapped to correct virtualhost. if started fine then please check SystemOut.log for any error when trying to access the application.

How to configure Apache to redirect subdomains to Tomcat applications

I have a few applications hosted on Tomcat running a machine called test-websites throuhg port 8080. So they are accessible like this:
http://test-websites:8080/app1/
http://test-websites:8080/app2/
...
http://test-websites:8080/appN/
What I need to do is make these applications accessible on my local network by:
http://app1.test-websites/
http://app2.test-websites/
...
http://appN.test-websites/
As I add new applications to Tomcat's webapps folder, I want them to be automatically available using the same subdomain pattern.
So I thought using Apache in front of Tomcat to make the URL rewriting would be a good idea, but so far I have not been able to configure the virtual host on Apache to make this redirect. I installed apache2 on port 80 and I see the default "It Works!" apache page when I access http://test-websites/, but I couldn't find how to make the redirects to the apps in the Tomcat following the format above.
I have searched for over 4 hours and didn't get an answer for this use case.. any help us much appreciated!
Thank you!
Eduardo
First you need to add a DNS entry for app1.test-websites, app2.test-websites,.. such that it points to test-websites. Generally CNAME entry works best in this case. If you only need the URLs to resolve on your local machine (for testing purpose), you can just update your /etc/hosts or C:\windows\system32\drivers\etc\hosts file. Otherwise you need to figure out how your company's network is setup and change the DNS entry (if it's a Windows domain network, normally there's a DNS service on the domain controller. On some smaller network you have to configure it on the router).
Next, the quickest way to achieve this is to not use apache2 to front it, bust simply have tomcat listening on port 80. You can setup virtual host on tomcat such that it serves different web-app depending on the URL requested.

Tomcat create always new session

I created some web application, on Tomcat 6. When I am accessing via localhost to these machine everything work good - server create one session. But when I connect to this application via Internet, Tomcat creates each time 3 new sessions. Do anyone knows why? The clue could be, that Tomcat server is in DMZ zone, so when i connect via proxy, or from localhost everything is good, but when I access via Internet, the problem occure.
I fixed the problem, the session time out was caused by the network settings. There were 2 problems: 1) mess up with ports connection between tomcat, apache and DNS server (different ports were set up for one application on each machines)
2) When I was connecting via LAN to app, tomcat was creating 1 session and everything was ok. But when I was connecting via Internet tomcat created as I said 3 different session - the first one was exactly like in LAN connection case (session was containing SESIONID for application), but 2,3 was created in the same time and their were empty sessions. My internet adress for application was like: www.example.com/application. In tomcat documentation I read that in this case I should set up emptySessionPath in server access configuration.
When I done everything that I wrote before, my application started to work properly. :)

Categories