Cannot run application server - JAVA errors

I installed CUBA Studio 6.7.6. The initial Server window shows fine.

I start the server and go to the http://localhost:8111/studio URL.

I try to configure settings. I see the following error, although the JDK folder exists as you can see in the screenshot:
1

I have also set the JAVA_HOME environment variable to point to the above path.

Both Java 8 and Java 9 are installed on my PC. In the console when I type
java -version
I get
java version “9.0.1”

Please advise.

Thanks.

Hey!

You have different JVMs: for Studio 8 and Java_Home 9. Change the Java_home environment variable value to 1.8.0_152

Thanks, as I mentioned, it is already set to 1.8.0_152:

2

But issue remains.

Seeing no solution, I removed all JREs and JDKs from my computer (both 8 and 9), and re-installed only JRE 8.
In the console, java -version shows 1.8.0_152.
The first time I launched CUBA Studio, the above error did not occur. However when trying to launch the application server, I got:
1

The 2nd time I launched CUBA Studio, I again see the initial error with Java Home.

Is there anything else I can try ?

Hi,

CUBA Studio requires JDK 8. Try to setup JDK 8 and define JAVA_HOME pointing on it.

Regards,
Gleb

1 Like

Apologies, I mentioned JRE in the previous post, I meant JDK. This is what I have done. Installed only JDK 8, and JAVA_HOME is pointing to it (see screenshot in 2nd post).

Still I am getting the same problems.

How much RAM do you have?
Did you restart your computer after re-installations?

I have 8GB RAM.

I had restarted several times, I tried once more, but still, the problem remains.

I HAVE seen CUBA Studio working a few days before on my laptop (with Tomcat launching, accessing sample projects etc.). But something occurred, and now it doesn’t work. I tried uninstalling and re-installing CUBA Studio, but still, no solution.

The message “The supplied Java Home seems to be invalid…” is shown when Studio simply cannot find java.exe in the bin subdirectory of the supplied Java home path. Could you check it? Maybe there are some problems with user permissions or with the file system?

Thank you Konstantin,

Your hint about the java.exe file led me to discover a very peculiar issue.
I checked the c:\Program Files\Java\jdk1.8.0_152\bin\ directory, and the java.exe file was MISSING !

So here is what I did:

  • I re-installed JAVA SDK 8.
  • I confirmed that the java.exe file exists inside the c:\Program Files\Java\jdk1.8.0_152\bin\ folder.
  • I ran CUBA Studio and launched the browser session.
  • At this point, the application preferences window with the Java paths works fine, I do not see the Java Home error.
  • From the browser, I try to start the Application Server.
  • I get the “Task deploy, start failed” Gradle daemon error shown above (4th post).
  • And the strange part is: checking now in the c:\Program Files\Java\jdk1.8.0_152\bin\ folder, the java.exe file HAS BEEN DELETED !
  • So that’s why on a second running, I get the Java Home error.

But why would it fail, and even so, why would it delete the java.exe file ?

This is really an outstanding issue…

Do you have an antivirus?
Is it only java.exe missing or the set of files in the bin folder is completely replaced?

When Studio starts the app server, it actually runs Gradle with setupTomcat deploy start tasks. You can do it manually and separately, watching results. Open terminal in the project folder and run:

gradlew setupTomcat
gradlew deploy

Also, --info or --debug switches will output more information to the console.

Only the java.exe file is removed, the other files in the JDK /bin folder remain.
I have Kaspersky Endpoint Security 10 installed.
I tried to disable Kaspersky, and ran the process again. Now, on launching the server, I see a message related to ‘call_and_exit.bat’:
image
In this case, with Kaspersky disabled, the java.exe file was NOT deleted.

I tried to run gradlew manually.
‘gradlew setupTomcat’ worked fine.
‘gradlew deploy’ produced a long output, the suspicious lines were:

:app-core:compileJava NO-SOURCE
:app-gui:compileJava NO-SOURCE
The message received from the daemon indicates that the daemon has disappeared.
FAILURE: Build failed with an exception.
* What went wrong:
Could not dispatch a message to the daemon.

I then ran it with --info, this produced a very long listing, the suspicious lines were:

file or directory 'D:\Development\Cuba.Platform\Projects\sample-sales\modules\core\src\main\java', not found
Skipping task ':app-core:compileJava' as it has no source files and no previous output files.

file or directory 'D:\Development\Cuba.Platform\Projects\sample-sales\modules\core\src\main\resources', not found

And these folders actually do not exist.

Thinking something might have gone wrong in the initial setup of the ‘sample-sales’ app, I deleted it, and re-installed it (with Kaspersky disabled).
And now it seems to run OK, even after multiple stops and restarts of the server (always with Kaspersky disabled).

So everything points to Kaspersky detecting, blocking and deleting java.exe.
This is an up to date Kaspersky install, using latest virus definitions. I cannot imagine why something as generic as Java is being detected wrongly ?

Hi guys,

Sorry for butting into your conversation, but I just want to thank @Nikos_K! Some time ago I had a problem with one PC, which was 100% similar with what is explained here. I gave up that time and just changed the desktop :). But you have discovered the reason why that issue happened! I disabled Kaspersky and reinstalled everything on that PC and it works fine now!

P.S. This seems to be a common problem for Kaspersky, see this thread for example.

Regards,
Aleksey

Thank you Aleksey,

Thank you also Konstantin for providing the tip to check the antivirus software.

This is a strange issue because the Kaspersky AV software does not consider the java.exe file itself as suspect. Doing a normal AV scan in the Java folder does not delete anything, and submitting the java.exe file to:
https://virusdesk.kaspersky.com

shows a safe file.

So the false detection must be being triggered by the launching of java.exe from ANOTHER process (most likely something CUBA.Platform related).

I feel you should submit this as a case to Kaspersky for resolution. There must be a large number of people who tried to use the CUBA.Platform and gave up because of it.

Thanks,

Nikos

A post was split to a new topic: Java setup is confusing