Hi everybody,
One year ago I have developed a bean for Servoy (my first one), and today I would like to develop a second one. I have tried to use my first one as a model but for some reason it is not recognized by Servoy (doesn’t appear in the Beans list).
So I have checked the tutorial of Patrick Talbot. I thought it was the one I used to create my 1st bean but I have discovered that the design used in the tutorial is very different than the one of my 1st bean. The problem is that I cannot find the tutorial I used to make this 1st bean ![Confused :?]()
So my question is: has the way of designing a bean changed since last year? Or is the tutorial of Patrick Talbot doing something very different than what I did and want to do?
In my 1st bean I had 3 classes:
Bean.java » contains the bean process/main methods.
BeanFactory.java » implements IServoyBeanFactory
BeanFactoryInfo.java » extends SimpleBeanInfo
Now on Patrick Talbot tutorial (in tutorial part 2) there is only 1 class:
ServoySlider.java » implements IServoyAwareBean
I’m quite confused. Which design should I use for my new bean?!
I think there was never a bean tutorial other that the one from Patrick. Maybe you took the design from one of the open source beans, dunno.
As for the reason your bean might not be recognized: most likely the manifest is missing the declaration telling that it’s a bean.
It cannot be that your beans stop working, because basically beans created for Servoy 1.0 would still work.
Paul
My MANIFEST looks ok:
Manifest-Version: 1.0
Name: com/assetguardian/BusyBeanFactory.class
Java-Bean: True
BusyBeanFactory.java :
package com.assetguardian;
import com.servoy.j2db.IApplication;
import com.servoy.j2db.IServoyBeanFactory;
import com.servoy.j2db.plugins.IClientPluginAccess;
import com.servoy.j2db.ui.IComponent;
public class BusyBeanFactory implements IServoyBeanFactory {
...
But I have noticed a difference between my new bean jar and my first bean jar.
In the first I have 3 files in the META-INF folder:
- MANIFEST.MF
- MYPLUGIN.SF
- MYPLUGIN.DSA
But in my new plugin I just have MANIFEST.MF
Did I generated the jar the wrong way?!
Also I have found in Servoy API that IServoyAwareBean is used if you need to be aware of the current foundset. I didn’t need it for my 1st bean and neither for this one so I should stick to IServoyBeanFactory I assume.
The different manifest files have to do with signing, as far as I know, that shouldn’t matter when running in Developer.
Why the old bean doesn’t show up then, I do not know. No errors in the log whatsoever related to this?
Paul
My first bean is fine. And it’s actually because it’s signed!
I had a look to the logs as you advised and discovered this error:
2010-08-31 11:13:30,505 ERROR [main] com.servoy.j2db.util.Debug - Error occured retrieving bean. Bean have been loaded, error: java.lang.SecurityException: class “com.assetguardian.BusyBeanFactory”'s signer information does not match signer information of other classes in the same package
So I’ll sign this bean and test again.
I’ve just signed my beans/plugins using Johan Signtester.jar and a self-signed keystore using this command:
java -jar signtester.jar mykeystore.ks yourpassword MyPlugins
Now everything is signed but I still get this error:
2010-08-31 11:48:09,013 ERROR [main] com.servoy.j2db.util.Debug - Error occured retrieving bean. Bean have been loaded, error: java.lang.SecurityException: class “com.assetguardian.BusyBeanFactory”'s signer information does not match signer information of other classes in the same package
But the class I’m using are either Servoy ones or Java ones. Here is the list of all the imports I use in all my java files:
import java.awt.Color;
import java.awt.Cursor;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import com.servoy.j2db.plugins.IClientPluginAccess;
import com.servoy.j2db.ui.IComponent;
import com.servoy.j2db.IApplication;
import com.servoy.j2db.IServoyBeanFactory;
import com.servoy.j2db.plugins.IClientPluginAccess;
import com.servoy.j2db.ui.IComponent;
import java.beans.PropertyDescriptor;
import java.beans.SimpleBeanInfo;
How can I know which classes don’t have the same signer?
somehow you have the same kind of stuff signed by 2 different things.
Remove first all signing and resign then everything again.
Maybe you have another bean or plugin in the com.assetguardian. package?
Ok, I think there is conflict with my 1st bean which also has the package com.assetguardian and is signed with another keystore.
But I see the usage for signtester is: java -jar signtester.jar keystore password alias [overwrite]
If I use overwrite it will overwrite all my plugins and beans, even Servoy, IT2BE etc…?!
How can I just overwrite one jar?!
I guess that sooner or later I will probably have to make a more sophisticated version of the signtester tool ![Wink ;)]()
In the meantime, what you could do is open the jar file with a zip utility (jar files are really zipped files with a .jar extension), get rid of the the files located in /META-INF/ that ends with .SF and .RSA or .DSA (but keep the MANIFEST.MF!), then zip back again…
Then launch the signtester tool again providing your keytool, alias and password, but without the overwrite, this should resign the jar with the certificate you provided.
Foobrother:
So I have checked the tutorial of Patrick Talbot. I thought it was the one I used to create my 1st bean but I have discovered that the design used in the tutorial is very different than the one of my 1st bean. The problem is that I cannot find the tutorial I used to make this 1st bean ![Confused :?]()
…
Now on Patrick Talbot tutorial (in tutorial part 2) there is only 1 class:
ServoySlider.java » implements IServoyAwareBean
There are 8 parts to this tutorial, and each part brings some refactoring and new classes/methods to get to the next stage…
Maybe you should read along ![Wink ;)]()
In fact I was thinking there was only one way to develop a Servoy Bean (the way I learnt the first time with my 3 classes) and when I read in your tutorial that you were using IServoyAwareBean in order to work with foundsets, I thought it was a totally different type of bean which didn’t correspond to my 1st bean and the one I wanted to build. And when I looked at the code of the part 2 of your tutorial (full Eclipse project) I didn’t see any code similar to what I did in the past. And I thought that it was the core/base of the bean and in the next part it will be customisations for more complex implementations. That’s why I wrote that thread.
But, yes, after I looked closer at your code of the last part and found that you where using also IServoyBeanFactory. Then I spent more time on the next part of the tutorial to find what I was looking for in the section “M. Adding JavaScript to our bean” (page 8 ).
But I was still quite confused because your code is more complex than mine. So I don’t know exactly where to put what etc…
That’s why I ended up creating this thread: viewtopic.php?f=15&t=14788
For the jars signing, thanks for your tip, I’ll try it. Until now I just removed my other bean (causing the conflict) from the folder to test my second one.