HeadlessException in webapp

Having trouble installing Oxygen? Got a bug to report? Post it all here.
aleh.haidash
Posts: 32
Joined: Tue May 26, 2015 10:28 am

HeadlessException in webapp

Post by aleh.haidash »

Hello, guys!
I tried resolve images in Oxygen Webapp 18.1 using custom StyleFilter. I do:

Code: Select all

public void processImage(final Styles styles, final AuthorNode authorNode) {
...
try {
...
final URIContent uriContent = new URIContent(requestUrl, query);
final StaticContent[] sc = new StaticContent[] { uriContent };
styles.setProperty(Styles.KEY_MIXED_CONTENT, sc);
} catch (final Exception e) {
e.printStackTrace();
}
}
Its works, but sometimes I have errors in log and I have broken image links in author mode :

Code: Select all

 ERROR ro.sync.ui.rd  - java.awt.HeadlessException
java.awt.HeadlessException
at sun.java2d.HeadlessGraphicsEnvironment.getDefaultScreenDevice(HeadlessGraphicsEnvironment.java:77)
at ro.sync.ui.pd.d(Unknown Source)
at ro.sync.ecss.images.g.r(Unknown Source)
at ro.sync.ecss.images.s.db(Unknown Source)
at ro.sync.exml.workspace.b.b.b.createImage(Unknown Source)
at ro.sync.servlet.RESTAssetLoader.loadImageHdpi(RESTAssetLoader.java:180)
at ro.sync.servlet.RESTAssetLoader.loadImage(RESTAssetLoader.java:285)
at ro.sync.servlet.RESTAssetLoader.loadImageCached(RESTAssetLoader.java:103)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.jboss.resteasy.core.MethodInjectorImpl.invoke(MethodInjectorImpl.java:137)
at org.jboss.resteasy.core.ResourceMethodInvoker.invokeOnTarget(ResourceMethodInvoker.java:296)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:250)
at org.jboss.resteasy.core.ResourceMethodInvoker.invoke(ResourceMethodInvoker.java:237)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:356)
at org.jboss.resteasy.core.SynchronousDispatcher.invoke(SynchronousDispatcher.java:179)
at org.jboss.resteasy.plugins.server.servlet.ServletContainerDispatcher.service(ServletContainerDispatcher.java:220)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:56)
at org.jboss.resteasy.plugins.server.servlet.HttpServletDispatcher.service(HttpServletDispatcher.java:51)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:292)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at ro.sync.ecss.webapp.j.h.doFilter(Unknown Source)
at ro.sync.ecss.extensions.api.webapp.license.LicenseEnforcerFilter.doFilter(Unknown Source)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at ro.sync.servlet.config.OxygenContextFilter.doFilter(OxygenContextFilter.java:61)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at ro.sync.servlet.config.UTF8CharsetEnforcer.doFilter(UTF8CharsetEnforcer.java:28)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:240)
at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:207)
at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:212)
at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:106)
at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:502)
at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:141)
at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
at org.apache.catalina.valves.AbstractAccessLogValve.invoke(AbstractAccessLogValve.java:616)
at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:88)
at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:522)
at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1095)
at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:672)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1500)
at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.run(NioEndpoint.java:1456)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
at java.lang.Thread.run(Thread.java:745)
Author mode:
Image
Text mode:
Image

First image was resolved fine, others - no.

What could be the problem?
Thanks in advance.
Best Regards,
Aleh
Gabriel Titerlea
Site Admin
Posts: 95
Joined: Thu Jun 09, 2016 2:01 pm

Re: HeadlessException in webapp

Post by Gabriel Titerlea »

Hello Aleh,

In order to solve this issue we need more information.
Can you send the file where this error occurs as well as the 3 images to support@oxygenxml.com?
Also please include the build date of your Web Author installation. You can see it on the by visiting webauthor/app/oxygen.html with your browser and looking at the About section.

Best,
Gabriel
aleh.haidash
Posts: 32
Joined: Tue May 26, 2015 10:28 am

Re: HeadlessException in webapp

Post by aleh.haidash »

Gabriel Titerlea wrote:Hello Aleh,

In order to solve this issue we need more information.
Can you send the file where this error occurs as well as the 3 images to support@oxygenxml.com?
Also please include the build date of your Web Author installation. You can see it on the by visiting webauthor/app/oxygen.html with your browser and looking at the About section.

Best,
Gabriel
I sent an email. Please, keep me in touch.
Best Regards,
Aleh
Gabriel Titerlea
Site Admin
Posts: 95
Joined: Thu Jun 09, 2016 2:01 pm

Re: HeadlessException in webapp

Post by Gabriel Titerlea »

Hello,

There's a bug at the moment which causes this issue. It appears to be happening because the URL of the image does not end with an image extension.
As a workaround you can change your StyleFilter and have the URIContent href end with an image extension like this:

Code: Select all

final URIContent uriContent = new URIContent(requestUrl, query + "&extension=.png");
Note: the extension written does not matter, no matter the type of image you load, as long as it's one of the following: "jpg", "jpeg", "png", "gif", "svg".

Let me know if this fixes your issue.

Best,
Gabriel
aleh.haidash
Posts: 32
Joined: Tue May 26, 2015 10:28 am

Re: HeadlessException in webapp

Post by aleh.haidash »

Gabriel Titerlea wrote:Hello,

There's a bug at the moment which causes this issue. It appears to be happening because the URL of the image does not end with an image extension.
As a workaround you can change your StyleFilter and have the URIContent href end with an image extension like this:

Code: Select all

final URIContent uriContent = new URIContent(requestUrl, query + "&extension=.png");
Note: the extension written does not matter, no matter the type of image you load, as long as it's one of the following: "jpg", "jpeg", "png", "gif", "svg".

Let me know if this fixes your issue.

Best,
Gabriel
Thanks for the help, it helped me
Best Regards,
Aleh
aleh.haidash
Posts: 32
Joined: Tue May 26, 2015 10:28 am

Re: HeadlessException in webapp

Post by aleh.haidash »

Hello.

I have problem with rendering svg images in Webapp 18.1.
Image

In text mode:

Code: Select all

<p><image href="thanksgiving-ribbon-blue.svg" id="image_awc_4sn_1z"/></p>
I don't have similiar problems with jpg,png images.

In Style filter I have this code:

Code: Select all


//requestUrl = http://localhost:8888/
//request = webapp_editor?sourceDocPath={path}&destDocPath={file}.svg&clientId=1487849830091_127.0.0.1_8888&extension=.svg

final URIContent uriContent = new URIContent(requestUrl, request);
final StaticContent[] sc = new StaticContent[] { uriContent };
styles.setProperty(Styles.KEY_MIXED_CONTENT, sc);
Using this path requestUrl+request I can see svg image in browser.

How can I resolve this problem?
If it need I can provide more information about problem.

Thanks.
Best Regards,
Aleh
Gabriel Titerlea
Site Admin
Posts: 95
Joined: Thu Jun 09, 2016 2:01 pm

Re: HeadlessException in webapp

Post by Gabriel Titerlea »

Hello,

The only way to solve this problem would be for your request url path to have a .svg extension.
I registered an issue for this bug and will update this forum post when the fix is available.

Best,
Gabriel
cristi_talau
Posts: 494
Joined: Thu Sep 04, 2014 4:22 pm

Re: HeadlessException in webapp

Post by cristi_talau »

Hello,

I wanted to let you know that in Web Author 19.0 we improved handling of SVG resources. Now there are two approaches to make Web Author serve them with the corrent content-type:
1. Use a .svg extension in the file name
2. Use a query param "?oxycontenttype=svg" in the file URL

Best,
Cristian
aleh.haidash
Posts: 32
Joined: Tue May 26, 2015 10:28 am

Re: HeadlessException in webapp

Post by aleh.haidash »

Hello.
Thanks for the help.
Best Regards,
Aleh
Post Reply