I have created a servoy plugin where I have used third party libraries one of them is “tika-app-0.9.jar " which is provided by apache foundation.
when I am trying to use one of the method of that plugin in my servoy solution it is showing some error like :–”“Error during evaluation:org/apache/tika/Tika”".
I think error appears because java class of plugin is unable to access the method of the third party library.
But I am not sure where is the actual problem .
Is it allowed to use third party library in servoy plugin ?
Yes you can use third party libs in Servoy plugins and beans. Servoy and others do that all the time.
Did you take a look at the excellent tutorials from Patrick Talbot ?
Also, since you want to use Tika, why not have a look at the SmartDoc plugin which already leverages Tika/Solr/Lucene for you?
It’s Open Source on ServoyForge: Overview - SmartDoc Plugin - ServoyForge
I am creating a plugin in which I need a functionality to detect the mime type of file, for that I am using an third party jar “mime-util-2.1.3.jar”.
From servoy form I am calling one of the method of my servoy plugin by passing the complete path of the file(ex. c:/ppt/samplePPT.ppt ), the plugin should call the method " MimeUtil.getMimeTypes( “c:/ppt/samplePPT.ppt” ) " to get the mime type of the file, but I am not getting the result.
When I debug my code I get error :- "Error during evaluation:eu/medsea/mimeutil/MimeUtil"
Actually I do not need a separate plugin because, I need to detect mime type of a file in my plugin so that I can use that mime type to implement another functionality in my plugin.
Another thing, In my plugin I am using no of third party jars to implement different functionality.
But from very first I am getting error when I am calling “MimeUtil.getMimeTypes( “c:/ppt/samplePPT.ppt” )” to get mime type of a file.
Since I am getting error by calling method of one third party jar, I do not think methods of other third party jars that I have used in my plugin will work.
Check for dependencies of this jar, if they are not present as well, this might be the cause of your problem.
Try to catch (Exception ex) in your plugin around the call to the MimeUtil method and put a Debug.error(ex) statement in there, so that you will have a full stackTrace of it in servoy_log.txt.
HI,
I have tried to catch exception but I did not get any message in servoy_log.txt
Jar provied by servoy in “installation/application_server/lib” folder( j2db.jar, j2dbdev.jar etc.) is working fine when creating plugin
but I do not know why I am unable to call methods of thrid-party jar included by me .
I have made a small experiment and again failed. If you have some time then please go through it and please please help me to find out any solution
1)
I have created a java project which contain only one class named “Access” having one method “returnString” using java perspective.
Method “returnString” returns only a string.
Then I created jar of the above project.
2)
Then I created a plugin(demoPlugin) and included the above jar in it.
From the plugin I tried to call the above method “returnString” .
//----------
public String js_getString(){
return new Access().returnString();
}
//----------
3)
Then I included that plugin in servoy and tried to call getString() on button event which suppose to return a string, but it does not return anything.
//----------
function get(event) {
// TODO Auto-generated method stub
var str = plugins.demoPlugin.getString();
application.output(str);
}
//----------
When I debug my code I got the same message “Error during evaluation:com/java/access/Access”.
I do not why it is happening, is their any process to create a jar for servoy plugin.
ptalbot:
Also, since you want to use Tika, why not have a look at the SmartDoc plugin which already leverages Tika/Solr/Lucene for you?
It’s Open Source on ServoyForge: Overview - SmartDoc Plugin - ServoyForge
tysonj:
I have stored my jar inside “application_server/lib” folder and plugin inside “application_server/plugins” folder.
You should put your jar in application_server/plugins/ in a subfolder with the same name as your plugin (this is only a convention though, but you need it to be in /plugins as well)
It works automatically in Developer because Servoy is adding everything that is under /plugins to the classpath, but take care that if you want your jar to be used on the client side in Smart client, you will need to add a jnlp to tell the client to download it, and you will also need to sign your jars…
<?xml version="1.0" encoding="utf-8"?>
Servoy Client Plugins
Servoy and Others
3)Then I included MyPlugin.jar and MyPlugin.jar.jnlp in Plugins folder.
4)Then I import my solution in a separate application server.
5)When I tried to access that solution from web client it is working fine.
6)But when I tried to lunch servoy client I got some error like this :-
com.sun.deploy.net.JARSigningException: Found unsigned entry in resource: (http://localhost:8080/plugins/MyPlugin.jar, 1315900062000)
at com.sun.javaws.security.SigningInfo.getCommonCodeSignersForJar(Unknown Source)
at com.sun.javaws.security.SigningInfo.check(Unknown Source)
at com.sun.javaws.LaunchDownload.checkSignedResourcesHelper(Unknown Source)
at com.sun.javaws.LaunchDownload.checkSignedResources(Unknown Source)
at com.sun.javaws.Launcher.prepareResources(Unknown Source)
at com.sun.javaws.Launcher.prepareAllResources(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.prepareToLaunch(Unknown Source)
at com.sun.javaws.Launcher.launch(Unknown Source)
at com.sun.javaws.Main.launchApp(Unknown Source)
at com.sun.javaws.Main.continueInSecureThread(Unknown Source)
at com.sun.javaws.Main$1.run(Unknown Source)
at java.lang.Thread.run(Unknown Source)
It seems the error is due to unsigned jar, but I have signed my jar( “MyPlugin.jar” ) using above steps .
So, I am confused …
You can use the signtester tool this way:
java -jar signtester.jar mykeystore.ks yourpassword MyPlugins log
It will create a sign_log.txt wih the result of each sign attempt on all the jars.
2/ If you only have one jar, you don’t need a jnlp. Servoy generates one automatically for you.
If you have dependencies, then you need a jnlp and declare these dependencies in there.
And you shouldn’t put a full URL path in the hrefs, you have already set a codebase which is the serverURL.
Have a look at how other JNLPs are done in /plugins.