This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
We have a problem in constantly running a pure Java App on Linux. It seems to be with Linux because it runs as required on our Unix server.
The Application: We are trying to keep a JMS listener running to listen for incoming MQ messages. We are using a endless while loop to do this. Upon receipt of each message, we spawn a new thread to handle the request. We are using JRE 1.4.2, and we are on a server farm, sharing the server with more than 20 other applications, not owned by us. Also, the Unix servers, on which the app works more consistant is not a server farm.
The Problem: The app will receive a few messages, if any are sent, but then it seems to "lose" the MQ connection, whether messages are received or not. I can still ps the process created during startup of the app, but the messages are no longer received. Once the app is restared, any waiting messages are received & processed.
Also, I noticed that the interval in which the app dies differs in each of our environments, DEV/QA/PROD, even though it's the same code. In PROD, it is much worse. It will not remain running for more than 5 or 10 mins.
JMS is quite happy running in Linux in the JOnAS/Joram, JBoss and IBM WebSphere environments. And, of course, IBM WebSphere MQ carries IBM's own (if somewhat expensive) assurances that it will run. IBM likes Linux.
So I'll have to say that the OS isn't likely the primary issue so much as the software. Since you haven't described what you're using to handle JMS, it's anyone's guess what might be wrong.
An IDE is no substitute for an Intelligent Developer.
Joined: Jan 23, 2004
We are using the following class to receive the JMS listner and create the steady (using while loop) connection via MQQueueConnectionFactory. Please see the class below. This class is called only on startup of the app. The listner just has a standard onMessage method that creates a new thread to handle the request upon receipt. We only send/receive text messages.
Joined: Jan 23, 2004
Also, once the message is received. Our app processes the message by reading an XML file to retreive commands that instructs it to delete &/or write files on the web server docroot within the current server handling the request.