Concerns and issues relating to all versions of WebSphere Application Server
This week I ran into a situation where an internal customer wanted to do the following-
1. Cache a JSP/Servlet ONLY when a particular request attribute or parameter was absent and some other parameters were present. This is tricky because there is no explicit support in the cachespec.xml rules to do this. The best way to cache a page on the absence of a parameter is like so ....
<cache-id>
<component id="vehicles" type="parameter">
<value>-1</value>
<required>false</required>
</component>
<component id="category" type="parameter">
<required>true</required>
</component>
<timeout>0</timeout>
</cache-id>
In this case we will only cache the servlet IF the value of the vehicles parameter is -1. If at runtime the value of the vehicles parameter is never -1 then this has the desired effect of never caching when the vehicles parameter is present on the request. To understand this read the infocenter on the required and value component sub-elements
-
required Use the required element to specify whether or not this component must return a non-null value for this cache ID to represent a valid cache. If set to true, this component must return a non-null value for this cache ID to represent a valid cache ID. If set to false, the default, a non-null value is used in the formation of the cache ID and a null value means that this component is not used at all in the ID formation.
-
value Use the value element to specify values that must match to use this component in cache ID formation.
2. Cache a JSP based on the value of a session attribute's method or field Let me provide a few examples of how we managed to do this
<!-- This will cause will cause reqattrtest servlet to get cached with the following cache id
/com.ibm.ws.cache.servlet.reqattrtest.class:customer=14:requestType=GET cacheid is evaluated as request.getSession().getAttribute("customer").getUserName().length() -->
<cache-entry>
<class>servlet</class>
<name>com.ibm.ws.cache.servlet.reqattrtest.class</name>
<cache-id>
<component id="customer" type="session">
<method>getUserName<method>length</method></method>
<required>true</required>
</component>
<timeout>0</timeout>
<priority>1</priority>
</cache-id>
</cache-entry>
<!-- This will cause /purchase.jsp to get cached if the "itemInfo" attribute is present on the request and has a non null value for the field min i..e use ( (ItemInfo)request.getAttribute("itemInfo")).min to create the cache-id.
<cache-entry>
<class>servlet</class>
<name>/purchase.jsp</name>
<property name="consume-subfragments">false</property>
<property name="do-not-consume">true</property>
<cache-id>
<component id="category" type="parameter">
<required>true</required>
</component>
<component id="itemInfo" type="attribute">
<field>min</field>
<required>true</required>
</component>
<timeout>0</timeout>
</cache-id>
</cache-entry>
The examples below demonstrate HOW to cache servlets based on arbitrary methods & fields of objects in session or request attributes or parameters. These can be useful for applying caching in complex usescases by dropping the cachespec,xml in a pre-existing application where there isn't much room for change to make the application cachespec.xml friendly. Labels: cachespec.xml
WebSphere Application Server provides the
com.ibm.websphere.asynchbeans and commonJ APIs (CommonJ work manager contains a subset
of the asynchronous beans work manager methods) that provide for the full support of application controlled threading, asynchronous callbacks and scoped alarms and subsystem monitors. If you prefer standard APIs then you can use commonJ APIs instead of websphere.asynchbeans. I want to highlight a couple of settings that should be tuned when configuring both types of WorkManagers (Thread pools that administrators create for Java EE applications).
|
WorkManager Admin Console Panel |
WebSphere Application Server provides the ability to set an absolute timeout on the Work items submitted to WorkManager via the administrative web console. The Work timeout specifies the number of milliseconds to wait before a scheduled work object is released. If not specified or set to 0, the timeout is disabled. Customers should set this Work Timeout to some finite (non-zero) value so that the stuck threads get a chance to release their respective Work items. The implementor of the Work (Applications implement work objects to run code blocks asynchronously) then should take corrective action in asynchbeans.Work.release() or commonj.work.Work.release() such as exiting out of the synchronous read operations or calling Thread.currentThread().interrupt(). This works for both WorkManager and commonj APIs. Doing this will allow your application threads to react to non responsive endpoints like remote web services or other calls where the code is waiting indefinitely synchronously on another resource.
*credit to Nathan Rauh for helping clarify this cool feature
Labels: resiliency
There are two ways to get the IHS repository.
From the IBM Passport Advantage, IHS is included with the Supplements images;
http://www-01.ibm.com/support/docview.wss?uid=swg27021159
Use IBM Packaging Utility to download the IHS repository.
Packaging Utility download information:
http://www-01.ibm.com/support/docview.wss?uid=swg24031299
Article link:
http://www.ibm.com/developerworks/websphere/library/techarticles/1201_seelemann/1201_seelemann.html
With Packaging Utility command line, you can create a repository with just the platform coverage you need.
Example:
pucl copy com.ibm.websphere.IHS.v80 -repositories http://www.ibm.com/software/repositorymanager/com.ibm.websphere.IHS.v80 -target -platform os=linux,arch=ppc -acceptLicense -prompt
This will create a repository for install to the latest Fix Pack level of IHS (8.0.0.2) on linux ppc systems. Even though the repository is for linux, you can create this on any Packaging Utility supported platform, including Windows.
The supported architecture values for linux are ppc and x86 and you will get 32-bit + 64-bit content.
credit to lene Seelemann WAS Install ArchitectLabels: install
http://publib.boulder.ibm.com/infocenter/wasinfo/v7r0/topic/com.ibm.websphere.express.doc/info/exp/ae/rweb_custom_props.html
There is a WebContainer custom property you can set that will try to detect and report misuse of the request object:
com.ibm.ws.webcontainer.checkrequestobjectuse
To specify Web container custom properties:
- In the administrative console click Servers > Application
Servers > server_name > Web Container settings > Web
Container
- Under Additional Properties select Custom Properties.
- On the Custom Properties page, click New.
- On the settings page, enter the name of the custom property that
you want to configure in the Name field and the value that
you want to set it to in the Value field.
- Click Apply or OK.
- Click Save on the console task bar to save your configuration
changes.
- Restart the server.
Labels: webcontainer
Often times you are in situations where you need a unique key for the application and module name from the Thread context classloader. At this point developers resort to hacks like using the Classloader.toString method.
A more suitable approach would be to use the unified portable JNDI name feature in EE6.
Starting WebSphere Application Server 8 developers can do this in their app code
private String getApplicationName() {
String uniqueAppName;
try {
String moduleName = (String) new InitialContext().lookup("java:module/ModuleName");
String applicationName = (String) new InitialContext().lookup("java:app/AppName");
uniqueAppName = applicationName+":" + moduleName;
} catch (NamingException e) {
throw new RuntimeException(e);
}
return uniqueAppName;
}
see
http://javahowto.blogspot.com/2009/12/how-to-get-module-name-and-app-name.html
Please note this approach will work on ALL Java EE containers
Labels: tricks
Please find below a detailed yet most concise information on the
IBM Java Health Center
The IBM Java Health Center is a very low overhead tool that runs in the IBM JVM and provides information on method profiling, garbage collection, I/O, lock analysis,threads, native memory, and more.
It is fully supported by the IBM Java Tools team through PMRs.–
Documentation
It is similar to HotSpot/Oracle's VisualVM and JRockit Mission Control
It runs with the IBM JVM (32- or 64-bit) on: AIX, Linux, Windows, and z/OS.
Labels: health center