JNLP’s are just for usage i.c.w. Smart Clients.
With the jar included in the beans folder it should work just fine, in Developer and on a Application Server, for both Smart and Web Client.
Besides the screenshots of the error dialogs: any errors in the log?, also at startup of the Server?
Paul
pbakker:
With the jar included in the beans folder it should work just fine, in Developer and on a Application Server, for both Smart and Web Client.
Ok!
On the other hand, I removed my OnError function (that function only showed the error in the message), and I got the log errors at attachment…
I’m doing research on the firs error.
Best regards,
Gerardo.
ServoyServerAdministration_log.pdf (103 KB)
Are you very sure that the code you posted before works?
Because if I look at the Javadocs of the jbarcode bean, I cannot see that this could work.
http://jbarcodebean.sourceforge.net/apidocs/index.html: anything in the package jbarcodebean is deprecated, so should not be used anyway.
The proper package to use seems to me to be net.sourceforge.jbarcodebean.model.
The proper code to instantiate a new instance of the Code11 class seems to be the following to me:
var pkg = Packages.net.sourceforge.jbarcodebean.model
var clazz = new pkg['Code11']()
Paul
pbakker:
Are you very sure that the code you posted before works?
Yes, it works but I’m using version 1.1.5 (1.2.0 is not marked as bean, and is not recognized by Servoy Developer. I post a bug in JbarCode developer’s site)
pbakker:
The proper package to use seems to me to be net.sourceforge.jbarcodebean.model.
That is for the v.1.2.0. In 1.1.5, the package is jbarcodebean.
gerardo.gomez:
var pkg = Packages.net.sourceforge.jbarcodebean.model
var clazz = new pkg’Code11’
Using this strategy (with the right package), I get other error in log:
org.mozilla.javascript.EcmaError: TypeError: org.mozilla.javascript.Undefined@dc135d is not a function, it is org.mozilla.javascript.Undefined. (_setBarcodeType#2684)
We tested calling another .class from a bean (we tested with datagrid bean with com.servoy.extensions.beans.datagrid.InMemDataGrid() ), and the error is the same: works in Smart Client, but not in Web Client.
It seems calling a .jar from Application Server in web client is not working…
Best regards,
Gerardo.
problem is classloading, that it works in the developer is because we set something
I will also fix this so what we set the bean classloader as the application class loader in rhino
For now if you want to do that your self that is possible:
Packages.org.mozilla.javascript.Context.getCurrentContext().setApplicationClassLoader(elements.bean_462.getClass().getClassLoader());
You have to place a bean on your form, so that you can get the beans classloader and set that in the current context as the classloader.
This has to be done before your Packages calls to other stuff.
Thanks for you answer Johan!
gerardo.gomez:
For now if you want to do that your self that is possible:
Packages.org.mozilla.javascript.Context.getCurrentContext().setApplicationClassLoader(elements.bean_462.getClass().getClassLoader());
It tried it, but I don’t get it works… (I tried calling it in onLoad event of form and no errors are showed, but same error is generated in admin Log)
Whatever, if the issue is being solved in next Servoy release, I can wait to it… (to be honest, I don’t know if changing that classLoader it would break other things than be running properly now…)
Best regards,
Gerardo.
that should work, because thats why it works in developer. I do the exact same thing
So in the next release i just set that classloader always.
It shouldn’t hurt to much because the classloader that is set always fallsback to the system one anyway
It only can find a bit more classes in developer or webclient.
Good resources for you outside of the forum regarding this topic:
http://www.mozilla.org/rhino/scriptjava.html
http://java-servoy.blogspot.com
http://servoy-stuff.net
I am trying to read up on java for Servoy at Jeff’s blog here: http://java-servoy.blogspot.com
but I am having trouble bringing up the blog posts. I created a blogspot account, became a follower of the java-servoy blog, but when I click on one of his blog postings I get this:
De pagina is niet gevonden
Sorry, de pagina die je zoekt in de blog x bestaat niet.
Anyone know what I’m doing wrong?
I’m attempting to access the methods of external jar files from Servoy. I’ve read all the posts here, and I believe I see how this is done for the most part. However, whenever I attempt to do this, I get the following message:
TypeError: [JavaPackage com.demo.Hello1] is not a function, it is org.mozilla.javascript.NativeJavaPackage.
My code looks something like this:
var myString = Packages.com.demo.Hello1.echo2();
where echo2() is a method that should output a string. I’ve also tried just instatianting a class but get the same message. For this example, I had created the class through Ser-clipse. I also added the class file as an external source folder through the Project → Properties → JavaScript → Build Path → Libraries → Add External Source Folder menu.
The name is resolved, so I know Servoy is seeing it, I just can’t get it to work properly.
I’m able to successfully call java packages with a call such as:
var myString = new java.lang.String(“Bob”);
application.output(myString);
but whenever I try and call an external method or instantiate an exteral object, I get the previous error message.
Any suggestions for what I might be doing wrong?
amcgilly:
I am trying to read up on java for Servoy at Jeff’s blog here: http://java-servoy.blogspot.com
Jeff brought down his blog a long time ago, but most of the information you need about plugins and beans should be easy to find on ServoyForge.
https://www.servoyforge.net/projects/tutorials-stuff
And of course in the Servoy public API:
http://www.servoy.com/docs/public-api
dpriddle:
var myString = Packages.com.demo.Hello1.echo2();
Is you method com.demo.Hello1 echo2() a static method? If not you need to instantiate an object first to access it, so
var myString = new Packages.com.demo.Hello1().echo2();
Also of course you need you class in a jar that is part of the Servoy classloader classpath, putting it in /plugins or /beans will do that (and you will probably need a jnlp file for jars in /plugins to be loaded by a Smart client)