0

java.lang.NullPointerException in Executions

asked 2024-02-20 00:41:11 +0800

Inarius gravatar image Inarius
1

Hi!

I've a web application where I execute an external program through Javascript because is the only way to call it. When I receive the data from the external program through AJAX, my Java VM doesn't have access to Filedownload, Clients or Executions, all of this are null, but if I call them before the external program, they works, why?

delete flag offensive retag edit

3 Answers

Sort by ยป oldest newest most voted
0

answered 2024-02-20 14:34:18 +0800

MDuchemin gravatar image MDuchemin
2560 1 6
ZK Team

To clarify what's happening, which part of your application is making the request to the external application? Is it coming from the client-side (the web browser), or the server-side (the java server-side app)? I know you already mentioned Ajax and JS, but I don't know if that's what the external app is using, or what the ZK app is using to call it.

Does your client (the browser) send that Ajax request, and receives the response? Or does the server (the server-side Java class, like your VM) fetch the data from a Java ajax call?

If you are running the request from server-side, then the answer is easy. When you receive the response from the other application, you are no longer in a ZK working thread. (there is no execution, because there is no request waiting to be fulfilled)

You need server-push to be able to start a response from server-side. https://www.zkoss.org/wiki/ZKDeveloper%27sReference/Server_Push

Server-push allows the server to start a working thread, even if the user hasn't performed any action causing a request to be available.

If your request is sent by the browser, then things might be more complicated. You should check in the browser's developer tools > network panel and see if you can find a /zkau request with content "rmDesktop"

If you find such a request immediately after receiving the response from the external app, then something in the response is causing the ZK client-side engine to cleanup. (usually this happen if beforeUnload event is triggered in the browser)

link publish delete flag offensive edit
0

answered 2024-02-20 16:58:56 +0800

Inarius gravatar image Inarius
1

Thanks for your answer,

The request is called from the client side, through Javascript, i have a button in ZK that call a Java function in the VM and this Java function call a Javascript function that executes the external proccess. When the external proccess ends, I send an Ajax POST to JAVA with the data and receive it in the same VM and here's when the problems begin.

link publish delete flag offensive edit
0

answered 2024-02-21 09:51:17 +0800

MDuchemin gravatar image MDuchemin
2560 1 6
ZK Team

Could you provide a sample of the Ajax Post to Java (and the receiving code in Java)?

Since you mentioned that's where the issue start, that's where's I'd start looking.

link publish delete flag offensive edit
Your answer
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2024-02-20 00:41:11 +0800

Seen: 10 times

Last updated: Feb 21

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More