Page 1 of 1

Error when opening via custom protocol.

Posted: Sat Jun 10, 2017 9:41 am
by bogusz
Hello,

Whenever I open a file via my custom protocol I get this error:

Severity: error
Description: Couldn't load custom Extensions Bundle from class: ro.sync.ecss.extensions.dita.DITAExtensionsBundle because: The specified class is not an implementation of ro.sync.ecss.extensions.api.Extension: ro.sync.ecss.extensions.dita.DITAExtensionsBundle


The file still opens just fine, and nothing else seems to be wrong. I haven't done anything with DITAExtensionsBundle. Any ideas why I might be seeing this?

Thanks,

Jack

Re: Error when opening via custom protocol.

Posted: Mon Jun 12, 2017 9:27 am
by Radu
Hi Jack,

This looks like a class loading error.
Do you obtain this problem when running from the command line or from the workbench you are using to write the plugin Java code (I will assume Eclipse)?
Your plugin.xml references various JAR libraries, right? Could you list them here?

Regards,
Radu

Re: Error when opening via custom protocol.

Posted: Tue Jun 13, 2017 2:21 pm
by Radu
Hi,

By the way, sometimes we get unhandled errors reported from Oxygen by users from Amazon, errors related to bugs in your plugin.
If you contact us via email (support@oxygenxml.com) and provide an email I could try in the future to forward these messages to you.

Regards,
Radu

Re: Error when opening via custom protocol.

Posted: Thu Jun 15, 2017 10:32 am
by bogusz
Hey Radu,

I haven't encountered it running from the command line or workbench (I am using Intellij).

My plugin xml includes a folder called lib in my plugin root:

<runtime>
<librariesFolder name="lib"/>
</runtime>

Inside that folder are:

MyPlugin.jar
jxbrowser-6.14.jar
jxbrowser-linux32-6.14.jar
jxbrowser-linux64-6.14.jar
jxbrowser-mac-6.14.jar
jxbrowserwin32-6.14.jar
licence.jar

Besides JxBrowser I am not using any 3rd part libraries.

I'll follow up on the error reports via email.

Thanks!

Jack

Re: Error when opening via custom protocol.

Posted: Thu Jun 15, 2017 11:12 am
by Radu
Hi Jack,

About this remark:
I haven't encountered it running from the command line or workbench (I am using Intellij).
Then how exactly are you running Oxygen when you obtain that problem?
If you look in the Oxygen startup script "oxygen.bat", you will see that the Java classpath used to start Oxygen contains only the main "oxygen.jar".
After this Oxygen uses its own class loader to load additional libraries from the "lib" folder, from plugins and frameworks.
So whenever you start our main class you need to only pass as a Java classpath the main Oxygen library, otherwise the main class loader will contain extra libraries that Oxygen will also load, leading to class loader problems similar to what you encounter.

By the way, why instead of the JavaFX browser are you using the JXBrowser? We are considering using the JavaFX browser in various places in our application so I'm just curious if you encountered any limitations with the JavaFX browser.

Regards,
Radu

Re: Error when opening via custom protocol.

Posted: Thu Jun 15, 2017 11:55 am
by bogusz
Hey Radu,

I'm running the Oxygen application normally, and I have my plugin installed via an update site. I'm seeing that error in the Error box at the bottom of Oxygen. Usually it pops up there when I open a document. The xml snippet I provided is in my plugin.xml, which as I understand is the normal way to tell Oxygen which libraries should be loaded for your plugin. I don't think I'm doing anything with the classpath.

JavaFX was slow and not compatible with our javascript. JxBrowser hasn't had any such issues.

Thanks,

Jack

Re: Error when opening via custom protocol.

Posted: Thu Jun 15, 2017 12:08 pm
by Radu
Hi Jack,

Strange. If you right click on the received error and you choose Show message, does the dialog which shows up have a "More details..." link? If so, please click that and provide me with the exception stack trace.

Regards,
Radu

Re: Error when opening via custom protocol.

Posted: Thu Jun 15, 2017 12:18 pm
by bogusz
It does not, only a description:

Couldn't load custom Extensions Bundle from class: ro.sync.ecss.extensions.dita.map.DITAMapExtensionsBundle because: The specified class is not an implementation of ro.sync.ecss.extensions.api.Extension: ro.sync.ecss.extensions.dita.map.DITAMapExtensionsBundle

Re: Error when opening via custom protocol.

Posted: Thu Jun 15, 2017 2:02 pm
by Radu
Hi Jack,

We will need to enable full logging in Oxygen to retrieve the exception stack trace.
In the Oxygen installation folder (the folder where the "lib" folder is located) you should create a new file called "log4j.properties" with the following content:

Code: Select all

log4j.rootCategory= debug, R2


log4j.appender.R2=org.apache.log4j.RollingFileAppender
log4j.appender.R2.File=${user.home}/Desktop/oxygenLog/oxygen.log
log4j.appender.R2.MaxFileSize=12000KB
log4j.appender.R2.MaxBackupIndex=20
log4j.appender.R2.layout=org.apache.log4j.PatternLayout
log4j.appender.R2.layout.ConversionPattern=%r %p [ %t ] %c - %m%n

# CLIENT FOR V3
log4j.category.org.apache.commons.httpclient=error
log4j.category.httpclient.wire=debug
log4j.category.ro.sync.net.protocol=debug
# CLIENT FOR V4
log4j.category.org.apache.http.impl.conn=debug
log4j.category.org.apache.http.impl.client=debug
log4j.category.org.apache.http.client=debug
log4j.category.org.apache.http.wire=debug
log4j.category.org.apache.http=debug
after this, start Oxygen, reproduce the problem and then close it.
Then on your Desktop there should be an oxygenLog folder which you can zip and send to us (support@oxygenxml.com).
You should remove the "log4j.properties" afterwards as it hinders the application's overall performance.


Regards,
Radu

Re: Error when opening via custom protocol.

Posted: Sat Jun 17, 2017 11:46 am
by bogusz
I think I sorted it out. I was calling workspace.open(url) on JxBrowser's thread, after it invoked my callback over the javascript -> java bridge. This seems be to causing some kind of classloader related issue, as you mentioned. Putting Thread.currentThread().setContextClassLoader(PluginWorkspace.class.getClassLoader()); ahead of the open call seems to have fixed it. At least the error has gone away.

Seem plausible?

Re: Error when opening via custom protocol.

Posted: Mon Jun 19, 2017 8:56 am
by Radu
Hi,

Yes, very plausible. And good workaround.

Regards,
Radu