2 Replies Latest reply on Dec 11, 2015 4:15 PM by Arnab Ghosh Branched to a new discussion.

    Problem with default timezone on WildFly - standalone

    pmarek Newbie

      We need to store dates in UTC in our webapp, so I changed standalone XML and added default java system parameter user.timezone with value UTC.

      But there is a problem, because when I deploy webapp to WildFly in standalone mode, TimeZone.getDefault() always return CET. But when I deploy same webapp to the same WildFly in domain mode, everything works perfect and TimeZone.getDefault() return UTC.

      How is it possible? I wrote simple webapp as example of this behavior:



      <%@page import="java.util.TimeZone"%>



      <h2>Default TimeZone</h2><%= TimeZone.getDefault().getDisplayName() %>

      <h2>user.timezone</h2><%= System.getProperty("user.timezone") %>





      <!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN" "http://java.sun.com/dtd/web-app_2_3.dtd" >
        <display-name>TimeZone test</display-name>



      <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/maven-v4_0_0.xsd">
        <name>TimeZoneTest Maven Webapp</name>


      I also add this piece of configuration to standalone.xml and domain.xml in wildfly directory:

          <property name="user.timezone" value="UTC"/>


      All sources and WAR are in attachment.