Shared Interfaces: Call failing when passing String as argument

Hello all,

I am creating two applications which share an interface, using the current GREEN platform (VDE-GREEN-STM32F7508-DK-CMW1N (0.1.0-RC202111231722)).

If I create a simple ‘ping’ call in my interface, and implement it at the provider side and call it via Proxy, it works perfectly:

/**
 * Interface definition of the service.
 */
public interface MyOutput {

	/**
	 * Print a ping.
	 *
	 * @throws IOException
	 *             Throws an IOException when the service is not available.
	 */
	void printPing() throws IOException;

But, if I try to use a method passing a String argument, it fails:

/**
 * Interface definition of the service.
 */
public interface MyOutput {

	/**
	 * Print a ping.
	 *
	 * @throws IOException
	 *             Throws an IOException when the service is not available.
	 */
	void printPing() throws IOException;

	/**
	 * Print function.
	 *
	 * @param str
	 *            The string to print.
	 * @throws IOException
	 *             Throws an IOException when the service is not available.
	 */
	void println(String str) throws IOException;

The following error happens:

userentrypoint SEVERE: Service unavailable: null
Exception in thread "Thread39" java/lang/IllegalAccessError
    at java/lang/System.getStackTrace(Unknown Source)
    at java/lang/Throwable.fillInStackTrace(Throwable.java:82)
    at java/lang/Throwable.<init>(Throwable.java:32)
    at java/lang/Error.<init>(Error.java:14)
    at java/lang/LinkageError.<init>(LinkageError.java:14)
    at java/lang/IncompatibleClassChangeError.<init>(IncompatibleClassChangeError.java:6)
    at java/lang/IllegalAccessError.<init>(IllegalAccessError.java:6)
    at ej/kf/Kernel.convert(Kernel.java:710)
    at ej/kf/Kernel.bind(Kernel.java:471)
    at com/microej/example/sharedinterface/provider/MyOutputProxy.0xC01C4540(Unknown Source)
    at com/microej/example/sharedinterface/appentry/UserEntryPoint.0xC01C46A0(Unknown Source)
    at java/lang/Thread.run(Thread.java:311)
    at java/lang/Thread.runWrapper(Thread.java:464)
    at java/lang/Thread.callWrapper(Thread.java:449)
myoutputproxy SEVERE: Something happended in the user proxy while invoking prontln: null
userentrypoint SEVERE: Service unavailable: null

So it seems I am violating some kind of rule.

Can somebody help me with this?

Thank you,
Uri

Hi Uri,

The String type added in your Shared Interface method is a Kernel type, and you are trying to pass an object owned by a Feature to an other Feature which is not possible according the the Kernel & Features specification.

According to Shared Interfaces — MicroEJ Documentation, your are in the following case:

It is the responsibility of the Kernel to provide and register a Converter for such types.

See Communication between Features — MicroEJ Documentation

There are many ready-to-use Converter implementations for basic Kernel types, such as String or List.

Please contact your Kernel provider and ask him to register the StringConverter.

–Frédéric

1 Like

Hi Frédéric,

great, thanks for the quick answer!

Regards,
Uri