I developed a Servoy plugin that works great while testing it in the developer.
When I try to run in the smart client it reports an error when I try to set one of plugin’s variable.
I work on a lucene indexing plugin and I try to set the path to the file I want to index like:
plugins.LuceneIndexer.pathToFile = “database”;
This line of code works in the developer but in the smart client it causes a popup error message that says:
“The undefined value has no properties”
I suspect there is something wrong in the way I programmed the plugin but I cannot figure out what I am doing wrong.
Any hints would be highly appreciated.
Have you created a jnlp file to declare the proper dependencies to the lucene jars?
If not, then the smart client will not have downloaded them and they won’t be in its classpath, even if they are located in the /plugins folder.
did you check your servoy_log.txt file to see if there was more information about the error.
There should be an Exception with a complete stack trace.
You could also activate the Java console to see if there is more information / a stack trace to give you more pointers about the real problem (it might be that the plugin was not properly initialized for any other reason and that you have an Exception long before you actually try to use the plugin).
From the message “The undefined value has no properties”, all you can deduce is that the LuceneIndexer was not properly initialized and is null or not what it should be. So you will need more precise information to debug that.
On windows, open the Java control panel (located with all the regular control panels), go to the advanced tab, deploy the Java console node and check “Display console”, then start your smart client again.
On Mac, I don’t have one near me, but there is also a “Java Preferences” panel, and you should have the same properties to display the console.
I think I found the problem.
Java Web Start would NOT load a .jar unless it has a certificate attached to it.
My plugin obviously does not.
I will return with an answer after I try this option.
It still does not load.
The java console reports a lot of jars and jnlp(s) files being loaded but not my plugin:
Reading certificates from 11 http://localhost:1010/plugins/xml.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\20\315b0fd4-78263587-2.0.0-.idx
Reading certificates from 11 http://localhost:1010/plugins/usermanager.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\27\4d6e005b-3eb88859-1.1.0-.idx
Reading certificates from 11 http://localhost:1010/plugins/stbtools.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\9\64402389-4b5b3440-1222076050000-.idx
Reading certificates from 11 http://localhost:1010/plugins/log.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\24\7fd01fd8-69345188-1.6.0-.idx
Reading certificates from 11 http://localhost:1010/plugins/xmlreader.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\35\6acad823-7c6e8366-1241439372738-.idx
Reading certificates from 11 http://localhost:1010/plugins/tabxport.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\22\46006716-2e211e4c-1241439372738-.idx
Reading certificates from 11 http://localhost:1010/plugins/excelxport.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\23\488ccf97-2bed992c-1241439372723-.idx
Reading certificates from 11 http://localhost:1010/plugins/filewatcher.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\45\36cae6ed-2f42e7c1-1.0.1-.idx
Reading certificates from 11 http://localhost:1010/plugins/spellcheck.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\24\5443c98-5927f4aa-1241439372738-.idx
Reading certificates from 11 http://localhost:1010/plugins/spellcheck/RapidSpell.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\10\f28108a-696cde01-1.5.1-.idx
Reading certificates from 11 http://localhost:1010/plugins/dialog.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\12\414562cc-143e0ae5-1241439372723-.idx
Reading certificates from 11 http://localhost:1010/plugins/converters.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\54\40185cf6-40d3de44-1241439372723-.idx
Reading certificates from 11 http://localhost:1010/plugins/dialogPro.jar | C:\Documents and Settings\francisc\Application Data\Sun\Java\Deployment\cache\6.0\50\34dbe3b2-6e0b470d-1.6.0-.idx
I’m certainly missing something. Any hints will be highly appreciated.
it is not true that JWS would not load a jar unless it is signed (has a certificate).
You only need a certificate if you ask for extended permissions (being allowed to access the user’s hard drive for example), - by adding this in your jnlp file:
<security>
<all-permissions/>
</security>
In your case that might be necessary because you are probably creating a lucene index somewhere on the user’s disk.
Anyway, the fact that a jar is signed or not as nothing to do with the fact that JWS will download it.
So… There must be something wrong in your jnlp definition.
Maybe if you post your jnlp file we will be able to find out more?
I finally did make it to run the plug in on my computer, by updating to the filnal version of JRE.
But there is still a problem.
When I try to run it in a multi developer environment (which is on another system) I get the same errors.
I noticed that on my computer the folder:
…\Servoy\server\work\Catalina\localhost\plugins
has my plugin with a hash suffix; something like:
LuceneIndexer.jar1245065367312.pack.gz
On the multi-developer environment that runs windows server 2003 this folder does not have my plugin in it.
What can I do to tell servoy to “compile” the files in this folder as well, because I guess this is the problem.
I mention that I am not allowed to modify the configuration on the server in any way, so I cannot update the JRE.
diana.bodnarescu:
I noticed that on my computer the folder:
…\Servoy\server\work\Catalina\localhost\plugins
has my plugin with a hash suffix; something like:
LuceneIndexer.jar1245065367312.pack.gz
This is the result of the pack200 compression, the server/work/Catalina/localhost folder contains the cache generated by Tomcat. It should be available with Java 1.5+
Have you tried restarting the server, clean up the cache of you client and call your solution again?
This should create the pack.gz cache file.
thank you for all your answers.
A server restart made it.
So the problem was that the plug in did not get “compiled” to the cache folder of Servoy,
that is why it was working in the developer but not in the client.
my plugin uses the latest version Jakarta POI library, which is a Java API To Access Microsoft Format Files.
The problem is that Servoy comes already bundled with a older version of Jakarta POI, and at runtime
I get an error saying:
You almost certainly have an older version of POI earlier on your classpath. Quite a few runtimes and other packages will ship an older version of POI, so this is an easy problem to hit without realising.
The best way to identify the offending earlier jar file is with a few lines of java. These will load one of the core POI classes, and report where it came from.
ClassLoader classloader = org.apache.poi.poifs.filesystem.POIFSFileSystem.class.getClassLoader();
URL res = classloader.getResource(“org/apache/poi/poifs/filesystem/POIFSFileSystem.class”>
String path = res.getPath();
System.out.println("Core POI came from " + path);
So, my question is: is there any other way beside deleting the “offending earlier jar” ?
Basically (according to Andrei) the POI jar will be updated with (at least) the version that ships with iReport, to allow compatibility between the Servoy’s built-in Excel Export function and the use of Excel format with Jasper Reports.
This update should be for included in the next maintenance release (3.5.10 and 4.1.4) as revealed in the same thread.
In the meantime, you can update your POI lib to the one compatible with your lucene plugin: rename it “jakarta-poi.jar” and replace the one that ships with Servoy in the /plugins/jakarta-poi/ folder - but be warned that once you do that your Servoy’s built-in Export to Excel will not work anymore!
Hopefully, this will be fixed in next maintenance release.
So, my question is: is there any other way beside deleting the “offending earlier jar” ?
Yes but it is not easy.
Stop Servoy;
In the lib folder, remove the POI jar that Servoy uses and add the POI jar you want to use;
Start Servoy;
Check if anything is broken on the Servoy side (import/export of excel);
Stop Servoy;
When it is broken
6. Download the source code for the new and ‘Servoy’ version of POI (that is 2 versions);
7. Add the methods that Servoy uses (those that generate an error in point 4) from the old POI source to the new POI source;
8. Build a POI jar from your own (new) source;
9. Proceed with #10
When it works fine
10. Change back the jars;
11. Add the new POI jar to your project and include it in the jnlp;
12. Start Servoy;
13. Check that it all works.
IT2Be: When it is broken
6. Download the source code for the new and ‘Servoy’ version of POI (that is 2 versions);
7. Add the methods that Servoy uses (those that generate an error in point 4) from the old POI source to the new POI source;
8. Build a POI jar from your own (new) source;
9. Proceed with #10
Hi Marcel!
Now that’s the hard way indeed!
The problem with it is that you will end up with your own set of sources of an Open Source project that is still evolving, so for each new releases of that project (and new versions of Servoy integrating it) you have to reintegrate your modifications into the sources again!
Hard for hard, I would go with implementing my own Classloader, then at least it would be done once for good!
The problem with it is that you will end up with your own set of sources of an Open Source project that is still evolving, so for each new releases of that project (and new versions of Servoy integrating it) you have to reintegrate your modifications into the sources again!
Depends on how fast Servoy changes the libraries. I did not have to change anything with these libs for appr. 4 years.
The incentive is that the installation of the plugin is the same as any other plugin.