Kohei Nozaki's blog 

Disabling Roller cache for development


Posted on Friday Feb 27, 2015 at 09:43PM in Roller


When I playing with Roller source code, Roller’s caching mechanism is not comfortable because my changes are not affected until I redeploy entire application. it destroys benefit of using JRebel. so I disabled Roller’s caching mechanism with following definition in roller.properties. it would work with roller-custom.properties too.

cache.sitewide.enabled=false
cache.weblogpage.enabled=false
cache.weblogfeed.enabled=false
cache.planet.enabled=false
cache.salt.enabled=false

Also you need to disable 2nd level cache of EclipseLink. put following definition to persistence.xml.

<property name="eclipselink.cache.shared.default" value="false"/>

<shared-cache-mode>NONE</shared-cache-mode>

Velocity cache too. configuration is available at /app/src/main/webapp/WEB-INF/velocity.properties:

theme.resource.loader.cache=false
roller.resource.loader.cache=false
class.resource.loader.cache=false
webapp.resource.loader.cache=false

Container’s JSP cache too. for WildFly see /roller/kyle/entry/exploded-deployment-for-wildfly-on


Setting longer startup / shutdown timeout to wildfly-init-redhat.sh


Posted on Friday Feb 27, 2015 at 03:27PM in WildFly


I’m using bin/init.d/wildfly-init-redhat.sh to operate WildFly instance via service command on CentOS. it has some timeout defaults as follows:

if [ -z "$STARTUP_WAIT" ]; then
        STARTUP_WAIT=30
fi

if [ -z "$SHUTDOWN_WAIT" ]; then
        SHUTDOWN_WAIT=30
fi

If startup or shutdown takes longer than 30 seconds, the service commands will stop waiting and finished. this brings trouble to some automation mechanism such as shell scripts for deployment on cheaper environment. these variables can be set more longer in /etc/default/wildfly.conf as follows.

## The amount of time to wait for startup
STARTUP_WAIT=1800

## The amount of time to wait for shutdown
SHUTDOWN_WAIT=1800

There’s a template for this file at bin/init.d/wildfly.conf in WildFly distribution.


Getting dependencies with Maven dependency plugin


Posted on Friday Feb 27, 2015 at 11:30AM in Maven


I want to get all of dependencies of:

<dependency>
    <groupId>org.jboss.as</groupId>
    <artifactId>jboss-as-controller-client</artifactId>
    <version>7.2.0.Final</version>
</dependency>

So, create pom.xml as follows:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>org.nailedtothex</groupId>
    <artifactId>get-dependencies</artifactId>
    <version>1.0-SNAPSHOT</version>

    <dependencies>
        <dependency>
            <groupId>org.jboss.as</groupId>
            <artifactId>jboss-as-controller-client</artifactId>
            <version>7.2.0.Final</version>
        </dependency>
    </dependencies>

</project>

Then issue:

$ mvn dependency:copy-dependencies

Then you will get:

$ ls -l target/dependency/
total 2824
-rw-r--r--+ 1 kyle  staff    3933 Feb 27 11:25 jboss-as-build-config-7.2.0.Final.jar
-rw-r--r--+ 1 kyle  staff  177511 Feb 27 11:25 jboss-as-controller-client-7.2.0.Final.jar
-rw-r--r--+ 1 kyle  staff   96612 Feb 27 11:25 jboss-as-protocol-7.2.0.Final.jar
-rw-r--r--+ 1 kyle  staff   92053 Feb 27 11:25 jboss-dmr-1.1.6.Final.jar
-rw-r--r--+ 1 kyle  staff   55248 Feb 27 11:25 jboss-logging-3.1.2.GA.jar
-rw-r--r--+ 1 kyle  staff  229373 Feb 27 11:25 jboss-marshalling-1.3.16.GA.jar
-rw-r--r--+ 1 kyle  staff  238355 Feb 27 11:25 jboss-remoting-3.2.14.GA.jar
-rw-r--r--+ 1 kyle  staff   89315 Feb 27 11:25 jboss-sasl-1.0.3.Final.jar
-rw-r--r--+ 1 kyle  staff  119912 Feb 27 11:25 jboss-threads-2.1.0.Final.jar
-rw-r--r--+ 1 kyle  staff  241808 Feb 27 11:25 xnio-api-3.0.7.GA.jar
-rw-r--r--+ 1 kyle  staff   80070 Feb 27 11:25 xnio-nio-3.0.7.GA.jar
$


Building latest WildFly against latest Undertow


Posted on Wednesday Feb 25, 2015 at 09:34PM in WildFly


Today I had to make some modification to WildFly and Undertow. I’ve got stucked at build most, and had to make many try and error so I leave about it as note. I’m bad at using Maven so I spent most of time at making WildFly to reference latest Undertow package. I tried something like mvn clean install -Dversion.io.undertow=1.2.0.Beta9-SNAPSHOT in wildfly package but it didn’t work. eventually, I installed following packages into my Maven repository.

wildfly-core

Obtain same version as specified in version.org.wildfly.core property in pom.xml of wildfly package (it can be obtained using git tag).

The pom.xml file in this package keeps version.io.undertow property. wildfly package references this property so you need to modify it to desired version of Undertow. I modified it to 1.2.0.Beta9-SNAPSHOT before install it to local Maven repository. note that -Dmaven.test.skip=true makes build fail but -DskipTests=true might work.

undertow

This package doesn’t have annoying dependencies so you just need to make modification you desired and install to your local repository. keep version element in pom.xml and ensure that it is same to version.io.undertow property in wildfly-core.

wildfly

This package has dependency to wildfly-core. ensure that version.io.undertow in wildfly-core is desired one. the build will be made in wildfly/build/target/wildfly-9.0.0.Alpha2-SNAPSHOT.zip.

My final recipe is following:

  1. Run mvn clean install for undertow (1.2.0.Beta9-SNAPSHOT). changes to java code here but no changes to pom here.

  2. Run mvn clean install for wildfly-core (1.0.0.Alpha19). before install, I updated <version.io.undertow> to 1.2.0.Beta9-SNAPSHOT.

  3. Run mvn clean install for wildfly (9.0.0.Alpha2-SNAPSHOT). changes to java code here but no changes to pom here.


How to configure WildFly to use secure session cookie and httpOnly


Posted on Wednesday Feb 25, 2015 at 09:00AM in WildFly


Issue following command via jboss-cli:

/subsystem=undertow/servlet-container=default/setting=session-cookie:add(http-only=true,secure=true)