Hoka HTTPServer on ESP32 WROVER multi-application BLACK VEE image

I’m trying to implement a simple HTTPServer (hoka) application on the ESP32 WROVER hardware running the BLACK multi-application image. I took an existing base project/application (com.microej.example.iot.ssl.rest.headless) cleared it down and simply included some hoka application code (from Example-Hoka-master, SimpleExample) and the necessary ivy dependencies to stop any complaints.

When using the simulator my application runs and the (local) HTTP server is connectable and pages are served. However when the application is deployed to hardware, the application crashes during execution with a stack trace (test app trace is below).

The target platform is the same in both instances (VDE-BLACK-ESP32WROVER-RQQAW) and and I am only using an EVAL license (ESP32 GCC PSRAM EVAL.) I have been able to successfully build and deploy com.microej.example.wifi.setup.web as a single-application firmware image, and see a device based HTTPServer, but I want to develop multi-application HTTPServer.

  1. Is there an obvious (but not to me!) issue with what I’m trying to do?
  2. Is there any MicroEJ advice or instruction on debugging the ESP32 over the USB (to JTAG) interface?
  3. Is there a MicroEJ support/contact account through which I could discuss licensing costs?

Cheers,
Dave

Stack trace:

https example INFO: =========== server.start ===========
Exception in thread “ej.wadapps.app.default” java.lang.IllegalAccessError: KF:E=S1
at javax.net.ServerSocketFactory.@M:0x3f49f780:0x3f49f7ae@
at ej.hoka.tcp.TCPServer.@F:ae8ae60573010000d37548f1e20224d0b875cb968936fb41:0x3fa4d2b0@@M:0x3fa50bd0:0x3fa50be6@
at ej.hoka.http.HTTPServer.@F:ae8ae60573010000d37548f1e20224d0b875cb968936fb41:0x3fa4d2b0@@M:0x3fa51148:0x3fa51162@
at ej.hoka.http.HTTPServer.@F:ae8ae60573010000d37548f1e20224d0b875cb968936fb41:0x3fa4d2b0@@M:0x3fa51c3c:0x3fa51c66@
at com.microej.test.Test.@F:ae8ae60573010000d37548f1e20224d0b875cb968936fb41:0x3fa4d2b0@@M:0x3fa52a1c:0x3fa52a7c@
at com.microej.test.TestBG.@F:ae8ae60573010000d37548f1e20224d0b875cb968936fb41:0x3fa4d2b0@@M:0x3fa540b0:0x3fa540c2@
at Exception in thread “ej.wadapps.app.default” java/lang/IllegalAccessError: KF:E=S1
[snip]

Hi Dave,

I suppose you are using the latest Hoka version (7.1.1), there is currently, indeed, a limitation on our published multi-app firmware with the usage of Hoka : the default ServerSocketFactory instance is not opened to applications.

If you want more details about KF errors, see https://docs.microej.com/en/latest/PlatformDeveloperGuide/appendix/javalibs/kf.html.

A temporary solution is to provide a custom ServerSocketFactory so the Hoka server will not access ServerSocketFactory.getDefault() :

new HTTPServer(new TCPServer(port, maxOpenedConnections, new ServerSocketFactory() {
	@Override
	public ServerSocket createServerSocket(int port, int backlog, InetAddress ifAddress)
			throws IOException {
		return new ServerSocket(port, backlog, ifAddress);
	}

	@Override
	public ServerSocket createServerSocket(int port, int backlog) throws IOException {
		return new ServerSocket(port, backlog);
	}

	@Override
	public ServerSocket createServerSocket(int port) throws IOException {
		return new ServerSocket(port);
	}
}), jobCount);

A new version of the BLACK firmware should be published in the next weeks with this issue fixed at the firmware level. If you need a solution before this time, please contact our support : mailto:support@microej.com.

For application “debugging”, I suggest you to take a look at https://docs.microej.com/en/latest/ApplicationDeveloperGuide/stackTraceReader.html. This tool allows you to decode the stack traces.

For firmware debugging on the ESP32 using JTAG, please see Espressif documentation https://docs.espressif.com/projects/esp-idf/en/latest/esp32/api-guides/jtag-debugging/index.html.

For licensing, please contact our sales team at mailto:sales@microej.com.

Best regards,