ActiveMQ Code working in Windows but Fails in CentOS - java

I'm working with a a framework that has a Core application, and secondary applications that all communicate using JMS via ActiveMQ (through Camel). It all seems to work fine on Windows, but the moment I moved it to our CentOS environment it failed. Let me note that our guy who programmed it and who was our ActiveMQ guy has left so I don't know quite how to diagnose the problem. It seems to be establishing a connection but then does nothing else. It is supposed to begin an exchange of messages but it doesn't. When I set logging to DEBUG I get messages saying "urlList connectionList:[]" and "waiting x ms before attempting connection" as though it's not connecting. I've made sure there's no firewall, there's no security policy to block it, ActiveMQ is shown to be running. I've tried everything I can think of but I have no idea what the problem could be. Any recommendations?

try testing ActiveMQ via the web console to make sure it's functioning properly. next, try connecting remotely via JMX and verify that works as well. It's likely an environment issue that will be difficult to diagnose via the info given...
see these pages for more information...
http://activemq.apache.org/web-console.html
http://activemq.apache.org/jmx.html

Related

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.

Timeout with apache QPID

I have a problem with an application in Java.
This application uses Apache QPid broker (6.0.1) to send messages.
I run it on 2 computers : the computer I use to work, and the 1 we use to test application before we give it to the client.
On my computer, there is no problem, the application send or receive messages.
The problem is we the other computer. I installed qpid the same way i did on mine : I extracted the .tar.gz, set $QPID_WORK to the working directory, and set ports i use with web management interface.
I tried it yesterday morning, and no problems, all works fine.
But after that, I stopped qpid (my boss asked me to show her how to start every components of the application) and since i can't send messages anymore.
I tried 2 applications :
The first one is the application I work on. The first thing it does is connect to qpid with JMX/RMI (with the apache API). But i have a timeout exception at this moment.
The second application is an app I did to test QPID and see how i can send a message. I also have a timeout exception when i try to send the message.
With the second application, QPID detect the connexion (and display it in web interface) but it doesn't create the queue or put message if it already exists.
I think this is a configuration problem (maybe access rights on a file?) but i'm not sure, and if i'm right, i can't find where is the problem.
I wanted to try to send the message from my computer on the qpid on test computer, but there are not on the same network, and i can't test that :(
Does anyone have an idea of what is wrong?
ps : i apologize for english mistakes, i'm french
ps 2 : i can't show you code exept the one i created to try qpid, but there is nothing really interesting (I took a big part of it from apache documentation with just a few modifications that work on my computer)
The connection with RMI makes a timeout like the message producer.
I found a solution :
the overflow on the exchange was set to 0 (unlimited) but if I change (like 10MO) it works without timeout.
But I still don't know if it's a qpid bug, or a problem with the computer, I'll try to find out with the system administrator and i'll post here if we find an answer if someone else have the same problem.

RabbitMQ connections dropping and not recovering despite heartbeat setting

I am trying to run down a problem with consumer connections to RabbitMQ being dropped in our production environment. This problem seems to occur after running for a few days and by restarting our application it seems to connect and work fine for a few more days. My guess is that there is a period of inactivity that is causing the issue. It seems the AMQP heartbeat was designed just for this problem. We are using spring-amqp 1.3.2.RELEASE and setting the requestedHeartbeat on the ConnectionFactory to 10 however we are still seeing connections drop.
The spring-amqp client will reconnect if I completely disconnect from the internet and reconnect, or block the connection with a firewall, however it does not even seem to throw an Exception in the log when this happens in production. Of course that may be because we are using slf4j and logback for our logging mechanism and spring is using commons logging, so it is appearing in System.out and not going to the log. I have added the jcf-over-slf4j bridge to fix that but have not rolled it out yet so I do not have a stack trace to contribute.
One more piece of info about our architecture: we have HA proxy in front of RabbitMQ.
I would like to somehow put the app in debug and run within eclipse to see if the heartbeats are actually going out. I tried to verify with Wireshark but our traffic has two way SSL encryption and I haven't been able to decrypt the traffic yet.
Does anyone have any suggestions? I have been trying to run this down for weeks and I'm running out of ideas. I would greatly appreciate your input.
Thanks!
on 11-Feb-2015 days ago rabbit released 3.4.4 which has support for automatic reconnections. You could roll your own solution like we did a while back but it seems easier to just upgrade to the newest version of rabbit.
https://github.com/rabbitmq/rabbitmq-dotnet-client/blob/rabbitmq_v3_4_4/projects/client/RabbitMQ.Client/src/client/impl/AutorecoveringConnection.cs
If you have rabbitmq's autorecovery enabled, Spring AMQP prior to 1.4 is not compatible with it; the problem being that rabbit restores the connections/channels, but Spring AMQP doesn't know about them. Generally, though, this just causes extra connections/channels - Spring AMQP just establishes new channels. I have not heard of it causing the problems you describe.
If you can't figure it out by fixing your logging configuration, another thing to try is to jstack your process to see what the threads are doing. But you should be able to figure it out from the logs.

java webserver is not receiving requests from internet, Not Found error

I have restarted a project that i closed after it became too comfusing, the original project was a webserver run entirely from java code. I have started this back up in the hopes of making the code 100% my own using java. I have gotten to the testing stage of hosting website however whenever i try to connect from the outside world i am shutdown with an error page. I have note coded this error page and after extensive research it is viewable that the error page is originating from apache. The only problem with this is that there is no apache in the code or in the virtualbox server. I have also tested this on two different virtual servers: opensuse 13.1 and fedora 20.
The URL of the server is blends.hopto.org/beta. There should be a black background there with some arrows and a blue dot, but instead there is an error that states:
"Not Found
The requested URL /beta was not found on this server.
Additionally, a 404 Not Found error was encounted while trying to use an ErrorDocument to handle the request."
I do not get this error if i request the page from inside my local network. But i do from outside, it is not a port forwarding problem because my minecraft server works and the server is assigned to the public ip of my home router!
Thanks, any help is appreciated!
Extra info:
After positing this question i stumbled across some other problems and it seems that the error is originating from SELinux, however i have disabled SELinux and the error is still coming through!
This is not an answer. I cannot comment on StackOverflow yet but would like to help.
You said that you get an Apache error page, which means that Apache must be running on your system. You can check this by typing this in the terminal:
apachectl status
You don’t mention what port you want to serve on. Apache usually uses port 80. You could configure your homemade Java server to work on a different port, say 8080. Also, if you are using Fedora 20, then you will have to configure FirewallD to allow this.
Okay well i finally found out what the problem was after just looking over the assigned ips to devices and found it strange that our networked hard drive was assigned the very first ip always. So i logged into the hard drive and found out it had been capturing all the port 80 requests from the router in an attempt to do remote login!!! I am very excited that this problem is resolved! I will be hoping to release my WebServer API for everyone to use as it is incredibly small and gives the programmer full controll

javax.mail.MessagingException: Could not connect to SMTP host locally via netbeans

I know that there are many questions on this topic, and I have been searching for an answer for the past 4 months. Everyone says check host address, port, and firewall. Well I have done these items, but am still not having any success.
We are running our web application locally using Apache Tomcat 7.0.27 through Netbeans 7.2.1 and are no longer able to connect to the SMTP server to send emails. When running the application on a virtual machine located on the server, there is no issue connecting. We have no problem connecting and sending mail using telnet locally with the same parameters.
We have tried looking at the SMTP logs on the server, and were able to access some logs, but can't find any related to the refused connection. Which SMTP logs would provide more information on this issue? I tend to think that since the connection is refused it may not even trigger any logging, is this a correct assumption? We migrated to IIS7 several months ago and were having trouble accessing IIS 6.0 Manager, so I am not sure that they are even set up correctly.
Does anyone have any ideas of how to further troubleshoot the connection?
Thank you in advance, and please let me know if I can provide any further information.
Almost certainly this is a problem with a firewall or anti-virus program on your local machine. If you can connect from that machine using telnet but can't connect from that same machine using a Java application, there's something on that machine preventing Java applications from connecting.
I recently faced the same problem while running the Mail sending code and what I found is that the code which I had written recently is using the Java version Jre7. But the older codes run in Jre 6 environment, which works perfectly even now also.
So what I had done is I just change the Jre version of my recent code to Jre 6. After that the code works perfectly without any exception.
So try to change your runtime environment to lower Jre and run the code.

Categories