oxygen plugin that has dependency of other jar
Post here questions and problems related to oXygen frameworks/document types.
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
oxygen plugin that has dependency of other jar
Post by vishwavaranasi »
Hello Team , we have a oxygen plugin that has dependency of other jar , lets say library.jar , this library jar is custom file system provider implementation , this jar has under resources META-INF/services/java.nio.file.spi.FileSystemProvider(it has the entry of com.xxx.xxx.xx.xxx.CustomFileSystemProvider.
issue here the plugin not able to call the any methods inside CustomFileSystemProvider. any help would be appreciated , is there anything we need provide to our plugin.jar?
we have copied library.jar and plugin.ajr under plugins folder.
Thanks,
vishwa
issue here the plugin not able to call the any methods inside CustomFileSystemProvider. any help would be appreciated , is there anything we need provide to our plugin.jar?
we have copied library.jar and plugin.ajr under plugins folder.
Thanks,
vishwa
Thanks,
vishwa
vishwa
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: oxygen plugin that has dependency of other jar
Hi,
Each Oxygen plugin has a "plugin.xml" descriptor file which references JAR libraries. Oxygen loads all those JAR libraries for each plugin when it starts. So if a plugin uses a JAR library it needs to refer to it in the plugin.xml, otherwise it would need to create its own class loader and dynamically load it.
https://www.oxygenxml.com/doc/ug-editor ... lugin.html
Regards,
Radu
Each Oxygen plugin has a "plugin.xml" descriptor file which references JAR libraries. Oxygen loads all those JAR libraries for each plugin when it starts. So if a plugin uses a JAR library it needs to refer to it in the plugin.xml, otherwise it would need to create its own class loader and dynamically load it.
https://www.oxygenxml.com/doc/ug-editor ... lugin.html
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
Re: oxygen plugin that has dependency of other jar
Post by vishwavaranasi »
Thanks Radu ,
we have already copied manually the dependent jars to lib as below
and plugin.xml as below
we have already copied manually the dependent jars to lib as below
Code: Select all
C:\<path>\oxygen\plugins\oxygen-plugin-workspace-access-1.0\lib\oxygen-plugin-workspace-access-1.0.jar
C:\<path>\oxygen\plugins\oxygen-plugin-workspace-access-1.0\lib\library.jar
C:\<path>\oxygen\plugins\oxygen-plugin-workspace-access-1.0\plugin.xml
Code: Select all
<?xml version="1.0" encoding="UTF-8"?>
<!-- The plugin.dtd file is located in the OXYGEN_INSATALL_DIR/plugins directory -->
<!DOCTYPE plugin SYSTEM "../plugin.dtd">
<plugin
id="com.xxx.xx.xx.xx.WorkspaceAccess"
name="xxxWorkspaceAccess"
description="Test"
version="${project.version}"
vendor="oXygen XML"
class="com.xx.xx.xx.workspace.WorkspaceAccessPlugin"
classLoaderType="preferReferencedResources">
<runtime>
<librariesFolder name="lib" />
<library name="target/classes" />
<librariesFolder name="target/lib" />
</runtime>
<extension type="WorkspaceAccess"
class="com.xx.xx.xx.workspace.xxxWorkspaceAccessPluginExtension"/>
<!--
<extension type="WorkspaceAccess"
class="com.xxx.xx.xx.workspace.CustomWorkspaceAccessPluginExtension"/>-->
<!--The sample view which will present messages from the sample plugin.-->
<view id="xxxxWorkspaceAccessID" initialSide="WEST" initialRow="0" description="xxOxygen Workspace" />
<!--The sample toolbar which will present messages from the sample plugin.-->
<toolbar id="xxxxWorkspaceAccessID" initialSide="NORTH" initialRow="1"/>
</plugin>
Thanks,
vishwa
vishwa
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
Re: oxygen plugin that has dependency of other jar
Post by vishwavaranasi »
Hello Radu , the library.jar has has a custom java.nio.file.FileSystemProvider implemented named "test123" , the library.jar has META-INF/services/java.nio.file.spi.FileSystemProvider (this is a text file has the entry like ->com.xxx.xxx.xxx.xxx.CustomFileSystemProvider)
from the plugin we tried invoking as
FileSystem fs = FileSystems.newFileSystem(new URI("test123://default"), env);
plugin registered ..and opened oxygen , when we invoke from one of the plugin functions we got the following error.
Exception in thread "AWT-EventQueue-0" java.nio.file.FileSystemNotFoundException: Provider "test123" not installed
thanks for your help on this.
Thanks,
vishwa
from the plugin we tried invoking as
FileSystem fs = FileSystems.newFileSystem(new URI("test123://default"), env);
plugin registered ..and opened oxygen , when we invoke from one of the plugin functions we got the following error.
Exception in thread "AWT-EventQueue-0" java.nio.file.FileSystemNotFoundException: Provider "test123" not installed
thanks for your help on this.
Thanks,
vishwa
Thanks,
vishwa
vishwa
-
- Posts: 9434
- Joined: Fri Jul 09, 2004 5:18 pm
Re: oxygen plugin that has dependency of other jar
Hi Vishwa,
By default the plugin has its own Java class loader, maybe you can add all your libraries with higher priority:
Does that work for you?
If not maybe use this method instead:
and for the ClassLoader parameter pass something like "YourPluginClass.class.getClassLoader()" so that you use the plugin's own class loader to search for the implementation.
Regards,
Radu
By default the plugin has its own Java class loader, maybe you can add all your libraries with higher priority:
Code: Select all
<runtime>
<librariesFolder name="lib" scope="global"/>
<library name="target/classes" scope="global"/>
<librariesFolder name="target/lib" scope="global"/>
</runtime>
If not maybe use this method instead:
Code: Select all
java.nio.file.FileSystems.newFileSystem(URI, Map<String, ?>, ClassLoader)
Regards,
Radu
Radu Coravu
<oXygen/> XML Editor
http://www.oxygenxml.com
<oXygen/> XML Editor
http://www.oxygenxml.com
-
- Posts: 168
- Joined: Fri Feb 28, 2020 4:02 pm
Re: oxygen plugin that has dependency of other jar
Post by vishwavaranasi »
Thanks a lot Radu..
passing class loader xxxx.class.getClassLoader() to FileSystems.newFileSystem - worked for us.
Thanks,
vishwa
passing class loader xxxx.class.getClassLoader() to FileSystems.newFileSystem - worked for us.
Thanks,
vishwa
Thanks,
vishwa
vishwa
Return to “SDK-API, Frameworks - Document Types”
Jump to
- Oxygen XML Editor/Author/Developer
- ↳ Feature Request
- ↳ Common Problems
- ↳ DITA (Editing and Publishing DITA Content)
- ↳ SDK-API, Frameworks - Document Types
- ↳ DocBook
- ↳ TEI
- ↳ XHTML
- ↳ Other Issues
- Oxygen XML Web Author
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Content Fusion
- ↳ Feature Request
- ↳ Common Problems
- Oxygen JSON Editor
- ↳ Feature Request
- ↳ Common Problems
- Oxygen PDF Chemistry
- ↳ Feature Request
- ↳ Common Problems
- Oxygen Feedback
- ↳ Feature Request
- ↳ Common Problems
- Oxygen XML WebHelp
- ↳ Feature Request
- ↳ Common Problems
- XML
- ↳ General XML Questions
- ↳ XSLT and FOP
- ↳ XML Schemas
- ↳ XQuery
- NVDL
- ↳ General NVDL Issues
- ↳ oNVDL Related Issues
- XML Services Market
- ↳ Offer a Service