Trusted Application Authentication IPv6 Exception

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Symptoms

While trying to set up an Application Link between JIRA and Bitbucket Server using Trusted Applications, the following exception is logged in atlassian-bitbucket.log:

1 2 3 4 5 6 7 8 9 10 SEVERE: Servlet.service() for servlet [default] in context with path [] threw exception java.lang.IllegalArgumentException: '0:0:0:0:0:0:0:1%0' is not an IP string literal. at com.atlassian.ip.InetAddresses.forString(InetAddresses.java:64) at com.atlassian.ip.IPMatcher.matches(IPMatcher.java:46) at com.atlassian.security.auth.trustedapps.AtlassianIPMatcher.match(AtlassianIPMatcher.java:51) at com.atlassian.security.auth.trustedapps.DefaultRequestValidator.validateRemoteRequestIP(DefaultRequestValidator.java:34) at com.atlassian.security.auth.trustedapps.DefaultRequestValidator.validate(DefaultRequestValidator.java:26) at com.atlassian.security.auth.trustedapps.DefaultTrustedApplication.checkRequest(DefaultTrustedApplication.java:117) at com.atlassian.security.auth.trustedapps.DefaultTrustedApplication.decode(DefaultTrustedApplication.java:88) at com.atlassian.security.auth.trustedapps.filter.TrustedApplicationFilterAuthenticator.authenticate(TrustedApplicationFilterAuthenticator.java:102)

This happens when trying to view the Source tab on a JIRA issue which displays a HTTP 500 error.

Cause

Currently, application links can exhibit some incorrect behavior when IPv6 is enabled due to the way Java deals with IPv6:

Resolution

  • Users can force Java to use IPv4 by adding by appending -Djava.net.preferIPv4Stack=true to JVM_REQUIRED_ARGS or JVM_SUPPORT_RECOMMENDED_ARGS in <Bitbucket Server installation directory>/bin/setenv.sh

setenv and environment variable changes in Bitbucket Server 5.0+

Starting with Bitbucket Server 5.0, setenv.sh and setenv.bat have been removed. The options that were set in this file can now be set via environment variables. Where to set the environment variable depends on which Operating System you're running on.

Linux

When using the atlbitbucket service on Linux, the environment variables are ignored. You must set the parameters in _start-webapp.sh (or start-bitbucket.sh). These values will be read when the service starts.

As an example, to set JVM_SUPPORT_RECOMMENDED_ARGS, you would add this line to the file:

JVM_SUPPORT_RECOMMENDED_ARGS=-XX:+HeapDumpOnOutOfMemoryError

Windows

Set the parameter as an environment variable for the user running Bitbucket Server. For example, if you want to set JVM_SUPPORT_RECOMMENDED_ARGS, create it as an environment variable and assign the appropriate value to it. When Bitbucket Server starts using the startup scripts or service, it will pick up and apply this value.

Updated on April 15, 2025

Still need help?

The Atlassian Community is here for you.