Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper

Viewed 7758

How to solve "Assistive Technology not found" error in Google App Engine openJdk?

I am developing one web app that uses Apache Batik, it works fine in local with jetty and oracle jdk, but when I deploy it to Google-App-Engine and I call my API I get below error.

Caused by: java.awt.AWTError: Assistive Technology not found: org.GNOME.Accessibility.AtkWrapper
at java.awt.Toolkit.loadAssistiveTechnologies(Toolkit.java:807)
at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:886)
at org.apache.batik.bridge.CursorManager.<clinit>(CursorManager.java:102)
at org.apache.batik.bridge.BridgeContext.<init>(BridgeContext.java:1162)
at org.apache.batik.bridge.BridgeContext.<init>(BridgeContext.java:292)
at org.apache.batik.transcoder.SVGAbstractTranscoder.createBridgeContext(SVGAbstractTranscoder.java:336)
at org.apache.batik.transcoder.SVGAbstractTranscoder.createBridgeContext(SVGAbstractTranscoder.java:312)

I searched in google people are saying "This can be done by editing the accessibility.properties file for OpenJDK 8"

Comment out the following line:

#assistive_technologies=org.GNOME.Accessibility.AtkWrapper

But I am using google app engine and not sure How can I do that?

Any help will be appreciated.

3 Answers

I solved this by setting System property dynamically.

Properties props = System.getProperties();
props.setProperty("javax.accessibility.assistive_technologies", "");

JDK 9 through JDK 13 suffer from JDK-8216008 -Djavax.accessibility.assistive_technologies empty list leads to exception. Due to legacy behavior, any valid class name that is visible to the system class loader can be used instead of empty string.

Therefore, one way to disable the assistive technologies on all JDK versions is to specify class that does nothing during construction:

-Djavax.accessibility.assistive_technologies=java.lang.Object

On JDK9 and later the Toolkit respects the headless property but this doesn't work on JDK8.

-Djava.awt.headless=true

I was facing the same issue.

My Solution:

Use custom docker image.

Use runtime custom in app.yaml

runtime: custom

Add new file 'Dockerfile' at src/main/docker/Dockerfile

FROM gcr.io/google-appengine/jetty
ADD you_war_fle_name_inside_target_dir $JETTY_BASE/webapps/root.war
WORKDIR $JETTY_BASE
RUN sed -i -e '/^assistive_technologies=/s/^/#/' /etc/java-*-openjdk/accessibility.properties
RUN java -jar $JETTY_HOME/start.jar --approve-all-licenses --create-startd --add-to-start=jmx,stats,hawtio && chown -R jetty:jetty $JETTY_BASE

And then run following command from cloud console.

mvn package -DskipTests appengine:deploy
Related