Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Stacktrace when running the Portico compostion #211

Closed
bergtwvd opened this issue Jul 4, 2019 · 13 comments
Closed

Stacktrace when running the Portico compostion #211

bergtwvd opened this issue Jul 4, 2019 · 13 comments
Labels

Comments

@bergtwvd
Copy link
Contributor

bergtwvd commented Jul 4, 2019

With the Portico composition I get the stacktrace below when I start a test case such as for hw_iosb, HLA-Declaration-2017, IR-SOM-00003.

tc-runner_1               | Exception in thread "Thread-4" java.lang.ExceptionInInitializerError
tc-runner_1               |     at nato.ivct.etc.fr.tc_hla_services.TC_001_Services_Check.logTestPurpose(TC_001_Services_Check.java:74)
tc-runner_1               |     at de.fraunhofer.iosb.tc_lib.AbstractTestCase.execute(AbstractTestCase.java:127)
tc-runner_1               |     at de.fraunhofer.iosb.testrunner.TestEngine$TestScheduleRunner.run(TestEngine.java:203)
tc-runner_1               |     at java.lang.Thread.run(Thread.java:745)
tc-runner_1               | Caused by: java.util.MissingResourceException: Can't find bundle for base name lang, locale en_US
tc-runner_1               |     at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1564)
tc-runner_1               |     at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1387)
tc-runner_1               |     at java.util.ResourceBundle.getBundle(ResourceBundle.java:845)
tc-runner_1               |     at nato.ivct.etc.fr.fctt_common.utils.TextInternationalization.<clinit>(TextInternationalization.java:13)
tc-runner_1               |     ... 4 more
@ducana
Copy link
Contributor

ducana commented Jul 8, 2019

I checked the exception and found out that the call to the method TextInternationalization.getString("etc_fra.purpose") is failing. This implies that the files lang_en_US.properties and lang_fr_FR.properties are not being found. These files have to made available to the application somehow: I don't have the answer to this problem. Does anyone have an idea?

@bergtwvd
Copy link
Contributor Author

bergtwvd commented Jul 11, 2019

After some google research I found out the following:

Dockerfile additions are:

RUN apk update
RUN apk --no-cache add ca-certificates wget
RUN wget -q -O /etc/apk/keys/sgerrand.rsa.pub https://alpine-pkgs.sgerrand.com/sgerrand.rsa.pub
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-2.29-r0.apk
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-bin-2.29-r0.apk
RUN wget https://github.com/sgerrand/alpine-pkg-glibc/releases/download/2.29-r0/glibc-i18n-2.29-r0.apk

RUN apk add glibc-2.29-r0.apk
RUN apk add glibc-bin-2.29-r0.apk
RUN apk add glibc-i18n-2.29-r0.apk

RUN /usr/glibc-compat/bin/localedef -i en_US -f UTF-8 en_US.UTF-8
RUN /usr/glibc-compat/bin/localedef -i fr_FR -f UTF-8 fr_FR.UTF-8

ENV LANG=en_US.UTF-8 \
    LANGUAGE=en_US.UTF-8

I propose to add these steps to the IVCT Runner Dockerfile.

To list the locales (from a running image) use /usr/glibc-compat/bin/locale -a:

/ # /usr/glibc-compat/bin/locale -a
C
en_US.utf8
fr_FR.utf8
POSIX

If this fails, we need to change to another (but larger footprint) LRC base image such as Ubuntu.

@bergtwvd
Copy link
Contributor Author

bergtwvd commented Jul 11, 2019

Although I believe the above is the solution, I wonder why this popped up just now. Are the (Pitch/MaK/Portico) container images ever used to run tests? Checking that these work has to be part of every release.

Also puzzled why the issue does not show up with the Pitch image (also using Alpine Linux).

@bergtwvd
Copy link
Contributor Author

bergtwvd commented Jul 11, 2019

I tested the above Dockerfile steps out and added them to the Portico base image Dockerfile for now. Also has to change to the OpenJDK as a sideline.

On the end got still the same error for the runner on test case IR-SOM-0003:

tc-runner_1               | Exception in thread "Thread-2" java.lang.ExceptionInInitializerError
tc-runner_1               |     at nato.ivct.etc.fr.tc_hla_declaration.TC_001_Publish_Subscribe_Check.logTestPurpose(TC_001_Publish_Subscribe_Check.java:74)
tc-runner_1               |     at de.fraunhofer.iosb.tc_lib.AbstractTestCase.execute(AbstractTestCase.java:127)
tc-runner_1               |     at de.fraunhofer.iosb.testrunner.TestEngine$TestScheduleRunner.run(TestEngine.java:203)
tc-runner_1               |     at java.lang.Thread.run(Thread.java:748)
tc-runner_1               | Caused by: java.util.MissingResourceException: Can't find bundle for base name lang, locale en_US
tc-runner_1               |     at java.util.ResourceBundle.throwMissingResourceException(ResourceBundle.java:1581)
tc-runner_1               |     at java.util.ResourceBundle.getBundleImpl(ResourceBundle.java:1396)
tc-runner_1               |     at java.util.ResourceBundle.getBundle(ResourceBundle.java:854)
tc-runner_1               |     at nato.ivct.etc.fr.fctt_common.utils.TextInternationalization.<clinit>(TextInternationalization.java:13)
tc-runner_1               |     ... 4 more

There is something else going on (too).

Have a look at:

@rhzg
Copy link
Contributor

rhzg commented Jul 23, 2019

I've seen this problem before, when the HLA BASE test cases are not able to find their language files. The error is cause by the module

nato.ivct.etc.fr.fctt_common.utils.TextInternationalization

which is used as common library for the basic HLA test cases. The missing files shall be in the jar file

ETC_FRA_Common-2.0.0.jar:
lang_en_US.properties
lang_fr_FR.properties

which is included on the test suites HLA-Verification, HLA-Object, HLA-Declaration and HLA-Service.

However, in my configurations they are present. Also I do not see this exception when executing the test cases with the pRTI in my environment. Which compose file are you using?

@bergtwvd
Copy link
Contributor Author

I use the docker compose files from the Composition repository.

As far as I can determine the Pitch files include the resource bundle files (where in the JARs I cannot determine). When I use a docker image without the Pitch JAR files, I get exactly the same problem as wit the other RTI versions.

So the issue is missing resource bundle files in the IVCT installation.

Just instantiate the following class to reproduce the error:

package nl.tno.locale;

import java.util.Locale;
import java.util.MissingResourceException;
import java.util.ResourceBundle;

public class TextInternationalization 
{
//	private static final String mBundleName = "nato.ivct.etc.fr.resources.lang";
	private static final String mBundleName = "lang";
	//private static final Locale locale = new Locale(System.getProperty("user.language"), System.getProperty("user.country"));
	private static final Locale locale = new Locale("en", "US");

	
	private static ResourceBundle mResourceBundle = ResourceBundle.getBundle(mBundleName,locale);
	
	/**
	 * Get the value of the key passed in parameter
	 * @param key String represents the key of the text wanted
	 * @return The text as String
	 */
	public static String getString(String key) 
	{
		try 
		{
			return mResourceBundle.getString(key);
		} 
		catch (MissingResourceException e) 
		{
			return '!' + key + '!';
		}
	}
}

@bergtwvd
Copy link
Contributor Author

bergtwvd commented Jul 25, 2019

Reran the test where I included the file lang_en_US.properties in the resources directory of the Java test application. Now the test application works since it can find the file (the CLASSPATH is searched). This means that the issue is with the IVCT configuration. With the Pitch RTI there is a lang_en.properties and lang.properties file in the root of the prticore.jar file. Java will pick up the first if it cannot find lang_en_US.properties.

@rhzg
Copy link
Contributor

rhzg commented Jul 26, 2019

What I do not understand is, why the lang properties are not found in you setup. I just checked the '/IVCT_Compositions/HelloWorld/docker-compose.yml' setup. Inside the tc-runner container I checked the content of the HLA-Declaration-2017 testsuite:

~/conf/TestSuites/TS_HLA_Declaration-2.0.0/lib # unzip -l ETC_FRA_Common-2.0.0.jar | grep lang
    17228  07-25-19 14:29   lang_en_US.properties
    18897  07-25-19 14:29   lang_fr_FR.properties

the lang propertie files are at the root level inside the ETC_FRA_Common-2.0.0.jar package, which is loaded by the classloader just before starting the testcase. The loading of the resource is done during runtime (not at startup time) based on the start test case command and should be independent from the rti version. It is even independent from the CLASSPATH which is used at startup time.

I can not think of any reason, why these resouces are not included in the portico or mak distribution. Sorry, but I'm lost at this point.

@rhzg
Copy link
Contributor

rhzg commented Jul 26, 2019

I just tested the ivct-portico/docker-compose.yml (sorry for not having this idea before ;-), and I have seen that indeed, inside the ETC_FRA_Common-2.0.0.jar there are no lang property files! That confuses me even more - I will have a closer look what going on here.

@rhzg
Copy link
Contributor

rhzg commented Jul 26, 2019

I've found the problem: the .gitignore file in the TS_HLA_BASE project tricked my into missing to 'git add' the language property files. Now they should be included in the docker images (2.0.0, master-latest and development-latest).

I was not able to test the GUI with this compose file, as windowes does not yet support network_mode:host

(please make sure, your images are reloaded from the docker repo - I had to remove my copy manually before reload was done)

@bergtwvd
Copy link
Contributor Author

The issue with Portico appears to be fixed, but now I cannot run the same test with either the Pitch or Mak RTI. I see the following error on the console when the Runner starts up:

tc-runner_1               | 2019-07-29 10:33:59,078 : IVCT_BADGE_HOME_ID folder not found

This causes the execution of test cases to fail later on.

@ducana
Copy link
Contributor

ducana commented Jul 29, 2019

The message here is not very good: the folder name should be given out as part of the error message. The problem is that the IVCT_BADGE_HOME_ID value being used is either a non existing folder or it is not a directory.

@bergtwvd
Copy link
Contributor Author

bergtwvd commented Aug 5, 2019

I do not see the error in the latest build. So close.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants