Using ServletOutputStream to write very large files in a Java servlet without memory issues

The average decent servletcontainer itself flushes the stream by default every ~2KB. You should really not have the need to explicitly call flush() on the OutputStream of the HttpServletResponse at intervals when sequentially streaming data from the one and same source. In for example Tomcat (and Websphere!) this is configureable as bufferSize attribute of the … Read more

how to set java class loader PARENT_LAST

If you are only deploying the WAR file itself you can’t control this, but if you have your WAR file in an EAR file you can use the deployment.xml solution. The deployment.xml file would look something like this: <?xml version=”1.0″ encoding=”UTF-8″?> <appdeployment:Deployment xmi:version=”2.0″ xmlns:xmi=”http://www.omg.org/XMI” xmlns:appdeployment=”http://www.ibm.com/websphere/appserver/schemas/5.0/appdeployment.xmi” xmi:id=”Deployment_1347529484613″> <deployedObject xmi:type=”appdeployment:ApplicationDeployment” xmi:id=”ApplicationDeployment_1347544766353″ startingWeight=”99″ warClassLoaderPolicy=”SINGLE”> <modules xmi:type=”appdeployment:WebModuleDeployment” xmi:id=”WebModuleDeployment_1347543866613″ startingWeight=”1″ … Read more

How do you enable JMX in Websphere?

Following information is for Websphere 6.1 on Windows. First of all, the magic URL to connect to the MBean server is: service:jmx:iiop://<host>:<port>/jndi/JMXConnector If you have a default Websphere installation, the JNDI port number will likely be 2809, 2810, … depending on how many servers there are installed on one system and the specific one you … Read more

Getting ViewExpiredException in clustered environment while state saving method is set to client and user session is valid

This will happen if the client side state is encrypted by one server and decrypted by other server and the servers don’t use the same AES key for this. Normally, you should also have seen below warning in server log: ERROR: MAC did not verify You need to ensure that you have set jsf/ClientSideSecretKey in … Read more

Websphere all logs are going to SystemOut.log

The problem might be that WebSphere 6.1 uses Jakarta Commons Logging (JCL) internally, and if any of your code or 3rd-party libraries also use JCL, WebSphere’s configuration conflicts with your application trying to use log4j. If this is happening, you’ll see exactly what you’re seeing. There are multiple references and blog posts that describe ways … Read more

JAX-RS Jersey 2.10 support in Websphere 8

You need to do the following steps: Disable built in JAX-RS via JVM property com.ibm.websphere.jaxrs.server.DisableIBMJAXRSEngine=true see description here. You can set this property via web admin console in Servers > WebSphere Application Servers > yourServerName. Then in Server Infrastructure section Java and Process Management > Process definition > Java Virtual Machine > Custom properties. Create … Read more