How to log Websphere connection pool information like active connections in spring boot application - spring

We are using Websphere liberty 20.0.0.12 and spring boot (parent) version 2.0.5.
I can find the connection pool information in the JConsole.
How can I print Websphere connection pool information in application logs?
(Read comments of approved answer if using liberty server instead of traditional websphere application server)

IBM support doc at https://www.ibm.com/support/pages/how-enable-connection-pool-trace-websphere-application-server describes how to enable printing of various connection pool stats in the trace log for traditional WAS, for Liberty, you'll use the same trace specification WAS.j2c=all:RRA=all(you don't need Transaction) and put a logging element in your server config file (typically server.xml). See Liberty doc at https://openliberty.io/docs/latest/log-trace-configuration.html for more info.

Related

Generic JMS client library for Weblogic, Webshere and JBoss servers

We have a requirement for one standalone Java application that can push JMS message to a JMS queue configured on Weblogic, Websphere and JBoss application server.
Is there any generic JMS client library available, that we can use in our application for pushing the messages to any or all of these servers?
As we understand, there is a specific JMS client for each server (for e.g. wljmsclient.jar required for Weblogic target server, as we would need weblogic.jndi.WLInitialContextFactory to be available as Initial Context factory class, similarly for Websphere and JBoss). And we would like to avoid having 3 different JMS client libraries (1 each for server) in the same application.
However, the catch here is, destination server is not known during compilation time. Only during runtime, it will be known whether the given message is to be pushed to Weblogic, Websphere or JBoss server or all of them. Hence, there is a need for a deployed application to support all 3 servers during runtime.
Is there any alternative generic JMS client library?
You can develop your own client that supports the 3 servers.
Basically you need to have for your standalone application :
The different JMS provider jar on the classpath
For example a jms_config.properties file which stores the configuration for each server (initial context factory, etc.)
Then from a generic code you can build the InitialContext, JMS Queues, etc. depending on the target server.

how to get the server display name and process name in Websphere Liberty Profile

In the WebSphere (node) application server, there are the following classes that provide the display name and the process name,
what is the equivalent in WebSphere Liberty Profile
Classes from the WebSphere (traditional) are
com.ibm.websphere.management.AdminServiceFactory
com.ibm.websphere.runtime.ServerName
I am using Liberty Profile v 8.5.5.8
You can retrieve server info from the ServerInfoMBean in Liberty as described in this IBM KnowledgeCenter topic. For more info on how to use management mbeans on Liberty, see this topic.

Oracle Service Bus - Application Server & JMS Support

Is Oracle Service Bus supported by any application server in the backend - for eg: weblogic application server? Or does it have its own implementation of application server?
Tibco has something called EMS which is its implementation of JMS spec. Does OSB have its own implementation of JMS? Or does it utilize the capabilities of any application server which it is integrated with?
OSB runs on Weblogic and it is the only suppoorted application server. Some other fussion Middleware products can run on WebShpere. Details can be found in http://www.oracle.com/technetwork/middleware/downloads/fmw-11gr1certmatrix.xls
OSB don't have its own JMS implementation. It can use any standard JMS (e.g. one shipped with Weblogic). It has also adapters for IBM WebSphere MQ.

How to pool the JMS connection in a standalone Java application?

We are working on an IBM WebSphere MQ application, and we use JMS API to operate the message. But we have a problem that the connection takes too much time, and we want to pool the JMS connection, for it's a standalone application, we have no application container to provide JNDI or pooling service. So is there a solution to resolve this? For JDBC we can use DBCP or c3p0 to archive pooling datasource, in JMS, is there any similar project that can pool JMS connections?
It used to be that the JMS MQConnectionFactory had pooling built in, but it seems that in version 7, it has been removed.
Set the use of ConnectionPooling in earlier versions of the WebSphere
MQ classes for JMS. This method is retained for compatibility with
older MQJMS applications, but, because this Connection Pooling
functionality has been removed from version 7, setting this property
will have no effect.
In the absence of anything else, you can use Apache Commons Pool. Same idea as DBCP (which uses Pool) but for non JDBC objects.
Spring's CachingConnectionFactory works well for this use case.
This answer in https://stackoverflow.com/a/31119435/1765341 explains how to do this in Tomcat, but the code there can easily be adapted for Java standalone applications. This should be much easier (and less error prone) than writing an Apache Commons Pool implementation.

What is Foreign JMS provider? What is the typical role of Weblogic in a JMS application?

Currently I am working on a JMS application. But I use plain JMS API and Property file for configurations. My application is running in Weblogic and connects to MQ series server of my client.
Recently I got to know I can use Weblogic for JMS configurations.
Please explain.
What is "Foreign JMS provider"?
Is Weblogic also a JMS server or Foreign JMS provider or Both?
Weblogic provides the JMS Server features fully compliant with all JMS spec elements such as ConnectionFactory and Destinations. On this JMS Server you can connect and send messages to the client's Messaging Server via a configured Destination.
In addition using Weblogic as the JMS Server gives you lot many features such as Message Retry in case of failure, setting message quotas as well as enhanced monitoring of the JMS Server to track errors. The idea is to have more configuration driven settings for performance, deadlocks, tuning, filestore or database store etc.
A full list of such features is given at http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms/fund.html#wp1071787
A Foreign JMS Provider in Weblogic is the term used to define JMS implementations other than Weblogic JMS. An example is IBM MQ in your case.
Once the Foreign Provider is configured within Weblogic, for all practical purposes within the code - it can be called as if it was on local JNDI lookup. Weblogic will make the remote calls transparent to your code. This allows you to change your destination via configuration on the Weblogic console.
You will need a Messaging Bridge within Weblogic JMS Server to connect a source destination from which messages are received, and a target destination to which messages are sent.
Some essential reading on this is at: http://download.oracle.com/docs/cd/E12840_01/wls/docs103/jms_admin/advance_config.html#wp1075917
and an example of configuring IBM MQ as a Foreign Provider is at http://www.ibm.com/developerworks/websphere/library/techarticles/0604_kesavan/0604_kesavan.html#N1011D

Resources