Create
cancel
Showing results for 
Search instead for 
Did you mean: 
Sign up Log in

Maven failsafe plugin UTF-8 Issues on Bamboo remote agent

Attila Edelenyi August 1, 2013

Hi,

We are experiencing a problem where our Bamboo remote agent discards the UTF-8 file encoding we set in the wrapper config and the maven pom file configuration. Strangely this does not happen on the Bamboo Server's local agent.

Our build uses maven failsafe plugin to run integration tests: launches a jboss instance, deploys the war file and imports UTF-8 encoded files onto a mysql server.

The builds were working fine locally but when we tried to run them on Bamboo (4.4.5) the integration tests failed. The test were showing the following error

java.lang.AssertionError: expected:<��2002 - 2004 College of American Pathologists> but was:<??2002 - 2004 College of American Pathologists>
	at org.testng.Assert.fail(Assert.java:89)
	at org.testng.Assert.failNotEquals(Assert.java:480)
	at org.testng.Assert.assertEquals(Assert.java:118)
	at org.testng.Assert.assertEquals(Assert.java:171)
	at org.testng.Assert.assertEquals(Assert.java:181)
	at au.gov.nehta.lingo.rest.importer.verifier.Rf2DescriptionFileImportVerifier.verifyVersion(Rf2DescriptionFileImportVerifier.java:63)
	at au.gov.nehta.lingo.rest.importer.verifier.Rf2DescriptionFileImportVerifier.verifyVersion(Rf2DescriptionFileImportVerifier.java:13)
(7 more lines...)

After hours of debugging and googling we narrowed it down to the Bamboo agent being the cause. We managed to fix the problem on the Bamboo Server's local agent with the -Dfile.encoding wrapper.conf modification but this does not seem to work for the remote agent (which is a Fedora 13 machine with UTF-8 default system character set).

We have tried everything to rectify the problem:
  • Set -Dfile.encoding=UTF-8 in the server's and the agent's wrapper.conf
  • Set -Dfile.encoding=UTF-8 in the pom for the maven-failsafe-plugin's <argLine> configuration
  • Set <file.encoding>UTF-8</file.encoding> in the pom for the maven-failsafe-plugin's <SystemPropertyVariables> configuration
  • Set project.build.sourceEncoding and project.reporting.outputEncoding properties to UTF-8 in the pom file (This got rid of the maven-failsafe-plugin's warning "File encoding has not been set, using platform encoding..."
When we check the running processes on the remote agent during a build we can see the JVMs are getting the correct command line passed onto them:

[root@buildagent3 init.d]# ps -ef | grep bamb root 27132 1 0 13:10 pts/2 00:00:01 /opt/jdk1.7.0_21/bin/java -Dfile.encoding=UTF-8 -Dbamboo.home=/bamboo-agent-lingo -jar /bamboo-agent-lingo/atlassian-bamboo-agent-installer-4.4.5.jar http://bamboo-lingo.cti/agentServer/ root 27151 27132 0 13:10 pts/2 00:00:00 /bin/sh /bamboo-agent-lingo/bin/bamboo-agent.sh console root 27193 27151 0 13:10 pts/2 00:00:00 /bamboo-agent-lingo/bin/./wrapper /bamboo-agent-lingo/bin/../conf/wrapper.conf wrapper.syslog.ident=bamboo-agent wrapper.pidfile=/bamboo-agent-lingo/bin/./bamboo-agent.pid wrapper.lockfile=/var/lock/subsys/bamboo-agent root 27195 27193 1 13:10 pts/2 00:00:20 java -Dbamboo.home=/bamboo-agent-lingo -Dbamboo.agent.ignoreServerCertName=false -Dfile.encoding=UTF-8 -Xms256m -Xmx512m -Djava.library.path=../lib -classpath ../lib/wrapper.jar:../lib/bamboo-agent-bootstrap.jar -Dwrapper.key=oiO0K17PRrqae88Z -Dwrapper.port=32000 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=27193 -Dwrapper.version=3.2.3-atlassian-1 -Dwrapper.native_library=wrapper -Dwrapper.disable_shutdown_hook=TRUE -Dwrapper.cpu.timeout=10 -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp com.atlassian.bamboo.agent.bootstrap.AgentBootstrap http://bamboo-lingo.cti/agentServer/ root 30328 30277 0 13:35 pts/2 00:00:00 /bin/sh -c cd /bamboo-agent-lingo/xml-data/build-dir/LINGO-LINBUILD-INTTEST/war && /opt/jdk1.7.0_21/jre/bin/java -Dfile.encoding=UTF-8 -jar /bamboo-agent-lingo/xml-data/build-dir/LINGO-LINBUILD-INTTEST/war/target/surefire/surefirebooter1374506468386799813.jar /bamboo-agent-lingo/xml-data/build-dir/LINGO-LINBUILD-INTTEST/war/target/surefire/surefire4236449812974687070tmp /bamboo-agent-lingo/xml-data/build-dir/LINGO-LINBUILD-INTTEST/war/target/surefire/surefire_0723920899163737948tmp root 30329 30328 31 13:35 pts/2 00:00:01 /opt/jdk1.7.0_21/jre/bin/java -Dfile.encoding=UTF-8 -jar /bamboo-agent-lingo/xml-data/build-dir/LINGO-LINBUILD-INTTEST/war/target/surefire/surefirebooter1374506468386799813.jar /bamboo-agent-lingo/xml-data/build-dir/LINGO-LINBUILD-INTTEST/war/target/surefire/surefire4236449812974687070tmp /bamboo-agent-lingo/xml-data/build-dir/LINGO-LINBUILD-INTTEST/war/target/surefire/surefire_0723920899163737948tmp root 30461 13348 0 13:36 pts/2 00:00:00 grep bamb

It would be great if you could help with this issue.

Thank you.



1 answer

1 accepted

0 votes
Answer accepted
Attila Edelenyi August 1, 2013

The problem seems to be fixed either by

export JAVA_TOOL_OPTIONS="-Dfile.encoding=UTF8" in /etc/profile after a reboot

(took the solution from http://stackoverflow.com/questions/361975/setting-the-default-java-character-encoding/623036#623036)

or the re-setting of -Dfile.encoding to UTF8 instead of UTF-8 everywhere.

I will leave my settings as they are so I'm not going to test what really fixed the issue :-)

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events