Plugin works in Servoy Developer, but not using the Client

Hello,

I’m relatively new to Servoy - this is my company’s first project using Servoy. To give a litte background, we are using Servoy to provide a more user-friendly front end to the enterprise resource planning system, SAP.

As a simple guide to what we are attempting to do, we retrieve data directly from SAP’s tables and store them in a Sybase database that our application uses. After the user makes any changes, we need to use SAP defined functions (called BAPIs) to send the relevant data back to SAP.

In reality, this project is to port an existing Coldfusion application over to Servoy. In the old Coldfusion app, we previously created custom tags (written in Java) to interface with the SAP BAPIs.

Thus, the logic stands that to make use of that code in Servoy, we needed to convert those custom tags to a Servoy plugin.

After some difficulty, we were able to write that plugin to replace the functionality of the old Coldfusion custom tags. And, the plugin worked… partially, at least.

When using the Servoy Developer (on the physical server or on any of our developer machines that connect to that server), the plugin worked fine. However, when using the Servoy Client, the plugin does NOT work.

Now, since the plugin works via the Developer, I am guessing there is some configuration issue that we do not understand. However, I have no idea what that configuration issue is.

Here is my question:
From my understanding of the Servoy plugin architecture, we simply need to place the plugin jar file that we created, along with any other jar’s that it depends on (3, actually) into the Servoy/plugins directory. Is that all that we need to do, or is there some further configuration that must be done to let the clients see and use the plugin?

A plug-in that works in developer should work in a client unless…

  1. you need the server to perform tasks or whatever. In that case you need to set up a client-server plug-in using rmi or http
  2. you need resources that you should download as well.

But I guess you know the above since you seem to be familiar with Java. Anything else is probably a step you forgot to take…

Hope this helps

Thanks for the speedy reply,

However, I’m still not clear on how to move forward. As you have guessed, I am very comfortable in desktop Java and even some J2EE. However, I am totally in the dark when it comes to how Java Web Start works.

So, how would I determine if the ‘server must perform tasks?’

I can ouline what the plugin is doing if that would help you answer the question above.

In a nutshell, the plugin:
*Connects to the SAP repository
*Creates a Function object that represents the BAPI (i.e. SAP function) that we need to call to carry out the data uploading
*Retrieves relevant data from our database using JDBC
*Populates the ‘Parameter’ attribute of the Function object with the value retrieved from our Sybase database
*Calls the Function.execute() to run the SAP function
*If successful, it updates our database, again via jdbc

The SAP stuff is in one jar file, and there’s another jar file that probably contains the JDBC driver for SAP to connect to its backend database. Those two jars are in Servoy’s plugins directory.

Because I am totally in the dark as to how Java Web Start works, I don’t know if the functionality described above requires a ‘client-server’ plugin or not. Could you possibly clarify?

(of course, feel free to request further information if necessary. Unfortunately, sending the solution is not really an option since it requires a connection to SAP)

I think you need a client-server plug-in, use RMI (easiest to get you started I guess) looking at what you describe…

Should not be too difficult for you since you already have a working plugin.

Moving forward means that you need to read info :)

Marcel,

Okay, thanks for the guidance. Is it possible you can point me as to where I can find information to adapt our plugin to use RMI?

(although i know conceptually what it is, the very few times I’ve tried to make use of it was mostly a disaster.)

Simply search for it and see the Servoy API, it really isn’t that difficult when you understand the concept.

Hi Kions,

Apologies if you have already seen this, but have you looked here:```
http://servoy.com/generic.jsp?mt=396&taxonomy_id=571


Cheers
Harry

Hello again,

Okay, I am officially stuck.

I’ve looked at the guide about how to build a simple “Hello World” plugin and I used that as the basis of building the plugin to interface with SAP. It took a while to wrap my mind around it, but I was able to figure it out to the point where I could understand enough to build the plugin.

However, I can’t seem to wrap my mind around exactly what is required to make this a client-server plugin so that it can work via the client as well.

First off, WHY?

My initial understanding is that once a plug-in is placed on the server, that the clients will be able to use it. So, in creating a ‘client-server’ plugin, what exactly has to change? Which part needs to go on the ‘client’ and which part needs to go in the ‘server’? And how do they interact? After all, the plugin’s purpose is simply to call the SAP ‘function’ to put data into SAP. What part of that needs a ‘client-server’ architecture?

Sorry to seem so flustered, but it’s just that I don’t have any idea where to start ‘separating’ the logic … or if I actually need to add in another part… or what. I’m just confused.

BTW, as a further question, using the BAPI requires a couple of dll files to be placed in the system32 directory of the machine in question. Does this mean that the actual client machines themselves will require these files?

Well, the answer is going to be somewhat the same.
Explaning how things work with RMI is quite a lot of work, something like writing it. I can tell you, if I can do it you can do it too :)

The question about dll, that is explained when you take a look at how jnlp works.

Unfortunately, Marcel, time is one thing I don’t particularly have too much of. When I first created the plug-in, the rest of the team and I carried out tests to ensure that it worked, but these tests were done via the Developer.

Now, as we’ve begun to move into full testing by the QA team, the issue with the plugin has surfaced, and it is a show-stopper.

Thus, I am pretty desperate and pressed for time to come up with some sort of fix.

Are there any specific tutorials or online resources that you could point me to? I don’t particularly want to learn RMI or JNLP at this moment. Actually, let me qualify that. I will learn it if it is necessary, but right now, the time constraint is working against me. Thus, I am far more concerned with trying learn/understand just enough to figure out what I need to do to convert our plugin to a client-server one. I can even send you the jar file for you to look at, if that would help.

Thanks,
Kion

Send me an email marcelatit2bedotcom and discuss it. Time is not on my side either but maybe we can work something out…

Marcel,

This is just to say thanks a million… I got it to work!!

You were most helpful, and i really, truly appreciate it.

Sincerely,
Kion

Hello to everyone,

I’m here to reopen this thread because I have the very same problem and there’s no solution posted.

I recently start to develop plugins in Servoy, actually I have just two, the problem is they work fine in Developer but in Smart Client they don’t even load, because when I try to use them I get the error “Cannot call method X from undefined”.

One of the plugins is a simple calculator which doesn’t use any external libraries, so I don’t understand why it’s not working on Client, the log says nothing about it.
How can I determinate what’s wrong?

The other plugin is an image to pdf converter, it works with some external libraries, but if I cannot get the simple one get to work, it looks like this can be more difficult. This pdf converter plugin is the most important to me because I’m planning to convert it into an “almost anything to pdf converter”.

I’m really stuck on get plugins work on Client and I appreciate any guideline. I already follow the plugin tutorial on servoy-stuff.net, compile them for java 1.4 and 6.0 and nothing.

Thanks


Servoy 4.1.4 build 681

DannyC:
I recently start to develop plugins in Servoy, actually I have just two, the problem is they work fine in Developer but in Smart Client they don’t even load, because when I try to use them I get the error “Cannot call method X from undefined”.

One of the plugins is a simple calculator which doesn’t use any external libraries, so I don’t understand why it’s not working on Client, the log says nothing about it.
How can I determinate what’s wrong?

Where (in which of you classes) is located the method that cannot be called?
Is your plugin loaded at all? Maybe you have an error before that prevents from loading? Maybe you have an error before that and it prevents your classes to be loaded?
The thing to do would be to add trace statements (Debug.log ou Debug.error) in your Java methods to see if/when they are used, then show the console in Java Web Start to get more information in the client as to what is broken.

Hi Patrick, thanks for the response, this what I get

Where (in which of you classes) is located the method that cannot be called?

The method is in the plugin provider class, the thing is why it works in developer, because in developer I see the plugin loaded and I can use it.

Is your plugin loaded at all? Maybe you have an error before that prevents from loading? Maybe you have an error before that and it prevents your classes to be loaded?

I get the error when calling plugins.my_plugin.show_method(), the error says “Cannot call method ‘show_method’ from undefined”, indeed I think ‘my_plugin’ is undefined because it’s not loaded. I saw, as part of error when calling “my_plugin”, another line in console that says “application cannot be startetd”, note the word “started” is written wrong that’s not from me, maybe Servoy guys know where it is.

The thing to do would be to add trace statements (Debug.log ou Debug.error) in your Java methods…

I’ve tried with Debug.log, Debug.error and Debug.trace in plugin and provider constructor classes, also in the initialize method of plugin and “js_show_method” of provider… The thing is I got nothing in console, I don’t know where else to put them

Can be a problem with signing the plugins?
My java version is 1.6 update 17, and I read that signing is for update 19, so I don’t know what to do, I will try to update my Servoy version to 4.1.6 and sign the plugins to see what happen

Any other advice, idea, anything?

Thanks

DannyC wrote:
I saw, as part of error when calling “my_plugin”, another line in console that says “application cannot be startetd”, note the word “started” is written wrong that’s not from me, maybe Servoy guys know where it is.

Sorry, I realized that line of code is somewhere else that has nothing to do with the plugin

you could look at the generated servoy.jnlp file (the one that you load when you want to startup the client)
If you look at the content do you see a reference to your plugin/jar?

Hi Danny,

for some reason, it seems your jar is not loaded at all. Can you have a look in the java preferences panel, check the ‘Temporary Internet Files’ and go to the ‘Resources’ tab (you can sort by name here) to see if the jar has been downloaded by the client.

Do you have a jnlp file for your jar, because maybe there’s something wrong in it (a bad path for your jar for example) ?

Anyway, if you are using Servoy 4.1.x < 4.1.6 and Java 6u17 you shouldn’t need to sign your plugin, so there must be something else…

Well problem solved, thanks a lot guys…

I had to do a few things:

  • Delete the temporary internet files from java control panel as Patrick said, I delete all of them even those not related to Servoy (just in case)
  • Recompile the plugins to java 5 which is the version used on server (and I wasn’t aware of that). It seems there’s no java backward compatibility
  • Remove all “@override” tags in source code, they don’t disturb in java 6 but in java 5 I got a lot of compile errors
  • Remove the “throws PluginException” declaration of all methods, I don’t know why with “throws” declaration I didn’t get a misspelling error I had on the console when trying to load one of the plugin

Certainly I didn’t need to sign the plugins.

Thank you very much…
When I get them ready maybe I do a contribution uploading the plugins…

@Override is valid in Java 5 for class methods that you override, not for interface methods that you implement.

And the current target for Servoy 5 is still Java 5, so in any case, you better set your compile target to Java 5.

As to the throws, I guess the classloader didn’t even load the plugin in the firt place knowing that the class was marked as Java 6, so it didn’t use your methods.

When in doubt about the version of a class, you can always use the method here: