Call java and scala form xbl in orbeon 4.0

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Call java and scala form xbl in orbeon 4.0

Zeder127
Hello,

I have a xbl component.

I'm trying to call java from xbl to do something when I click on a button, e.g. get some strings back and fill in a field.

After reading this http://discuss.orbeon.com/uopdate-field-value-by-calling-java-class-td4498994.html,  I wrote a class with some static methods and test it. Unlucky, it did not work. And I saw a error in orbeon.log like this:
XPath syntax error at char 25 in {string((obj:getFullName())[}:  Cannot find a matching 0-argument function named {java:com.test.MyClass}getFullName()

But when I wrote the same methods in Scala, it worked!

Could anyone tell me why it doesn't work when using Java?

Thanks!



   
Reply | Threaded
Open this post in threaded view
|

Re: Call java and scala form xbl in orbeon 4.0

Alessandro  Vernet
Administrator
Hi,

Your obj:getFullName() is executed by Saxon, which doesn't know about Java or Scala, but uses Java's reflection API to call that code on the compiled bytecode. So I am not sure why it works for you when you implement that method with Scala instead of Java. Both should work. Maybe we could have a clue if you paste here the Scala and Java code. But since it's working with Scala, I assume you're all set ;).

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Call java and scala form xbl in orbeon 4.0

Zeder127
Hello Alex,

thanks for your reply.

Exactly as you said, I just had another try, they (Java and Scala) both worked. :-D

I guess, earlier I made some mistake on pointing to that java class, so the method was not found in runtime.

Reply | Threaded
Open this post in threaded view
|

Re: Call java and scala form xbl in orbeon 4.0

Alessandro  Vernet
Administrator
OK, good then, and thanks for the update.

Alex
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet