Java issues with Windows Server 2016

What version of Java works with Servoy 6.x and Windows Server 2016? When I attempt to start Servoy as a service I see the following in the service_log.txt:

Unable to execute Java command. The system cannot find the file specified. (0x2)
FATAL | wrapper | 2017/03/12 11:41:22 | “java” -Djava.awt.headless=true -Duser.dir=“C:\Servoy\application_server” -Djava.io.tmpdir=“C:\Servoy\application_server\server\work” -XX:MaxPermSize=128m -Xms32m -Xmx6400m -Djava.library.path=“C:\Servoy\application_server\service” -classpath “.;service\wrapper.jar;lib\activation.jar;lib\antlr.jar;lib\apache-mime4j.jar;lib\BrowserLauncher2.jar;lib\commons-codec.jar;lib\commons-collections.jar;lib\commons-dbcp.jar;lib\commons-fileupload.jar;lib\commons-io.jar;lib\commons-logging.jar;lib\commons-pool.jar;lib\dom4j.jar;lib\hibernate3.jar;lib\httpclient.jar;lib\httpclient-cache.jar;lib\httpcore.jar;lib\httpmime.jar;lib\j2db.jar;lib\j2dbdev.jar;lib\jabsorb.jar;lib\javassist.jar;lib\jcifs.jar;lib\joda-time.jar;lib\js.jar;lib\jta.jar;lib\jug.jar;lib\log4j.jar;lib\mail.jar;lib\MRJAdapter.jar;lib\networktnl.jar;lib\rmitnl.jar;lib\server-bootstrap.jar;lib\servlet-api.jar;lib\slf4j-api.jar;lib\slf4j-log4j.jar;lib\wicket.jar;lib\wicket-calendar.jar;lib\wicket-extentions.jar” -Dwrapper.key=“IwIrmNIREbo_UERO8zBudtoEDiwWRt0R” -Dwrapper.port=1777 -Dwrapper.jvm.port.min=31000 -Dwrapper.jvm.port.max=31999 -Dwrapper.pid=828 -Dwrapper.version=“3.3.5-st” -Dwrapper.native_library=“wrapper” -Dwrapper.service=“TRUE” -Dwrapper.cpu.timeout=“10” -Dwrapper.jvmid=1 org.tanukisoftware.wrapper.WrapperSimpleApp com.servoy.j2db.server.main.ApplicationServer"

I first installed Java 8. Then I uninstalled and installed jre-7u7-windows-x64. I suspect that I need to make changes to my wrapper.conf file. Any suggestions will be greatly appreciated.

Dean

It sounds more like the machine does not find java. What happens if you open a console and type “java -version”?

It returns:

java version “1.7.0_07”
Java™ SE Runtime Environment (build 1.7.0_07-b10)
Java HotSpot(TM 64-Bit Server VM (build 23.3-b01, mixed mode)

Dean

Strange. Do you have any Java variable in your environment variables (JAVA_HOME) that points to the uninstalled Java 8? Or did you switch from Java 32 (your old Java 8) to 64 bit (your Java 7)?

Our situation is that we are trying to switch our Servoy 6.x solution from a Windows Server 2008 instance to a Windows Server 2016 instance, because Softlayer has announced end-of-life for Windows Server 2008.

The current message on the Windows Server 2016 staging server indicates a clash between 32 bit and 64 bit Java (as Patrick suggested). I went back and double-checked the Java version running on our Windows Server 2008 production server instance. It is:
java version “1.7.0_67”
Java™ SE Runtime Environment (build 1.7.0_67-b01)
Java HotSpot™ 64 bit Server VM (build 24.65-b04, mixed mode)

Should I uninstall the 64 bit version of Java on the Windows Server 2016 instance and attempt to install the 32 bit version?

Dean

Just for info: I recently installed on a Windows Server 2016 Java 8u121, Servoy 7.4.9 and Postgres 9.4.11.
Worked fine. In general it should be the best to have just one Java installed.
I personally would try to deinstall Servoy and all Javas, then install latest Java 64 bit, then install Servoy again.

maybe if it still doesn’t work really specify completely the full path of the java command in the wrapper.conf
So it doesn’t have to find it on the path

Actually, Servoy doesn’t mind if java is 32 or 64 bit, but parts of developer (eclipse) and the server’s service wrapper do. So when you are running Java 64 bit and install Servoy, you’ll get some 64 bit dependent components and cannot safely switch to 32 bit later.

I’d rather have a 64 bit Java, so if that is your problem (it actually sounds more like Java is not found, so some path variable pointing nowhere), I’d go back to Java 8, 64 bit, and reinstall Servoy instead.

Bernd said: “I personally would try to deinstall Servoy and all Javas, then install latest Java 64 bit, then install Servoy again.”

That worked. Thanks to all.

Dean

It turns out that we need to stay with Java version 1.7.0_67 (32 bit) and Servoy 6.x on Window Server 2016. This is because we need wrapper.java.maxmemory=6400. Java is installed and our solution appears to be working properly, however, the .service_log.txt file shows the following:

Launching a JVM…
INFO | jvm 1 | 2017/03/25 22:17:28 | WrapperManager: Initializing…
INFO | jvm 1 | 2017/03/25 22:17:28 | WrapperManager:
INFO | jvm 1 | 2017/03/25 22:17:28 | WrapperManager: WARNING - Unable to load the Wrapper’s native library ‘wrapper.dll’.
INFO | jvm 1 | 2017/03/25 22:17:28 | WrapperManager: The file is located on the path at the following location but
WrapperManager: could not be loaded:
WrapperManager: C:\Servoy\application_server\service\wrapper.dll
WrapperManager: Please verify that the file is readable by the current user
WrapperManager: and that the file has not been corrupted in any way.
WrapperManager: One common cause of this problem is running a 32-bit version
WrapperManager: of the Wrapper with a 64-bit version of Java, or vica versa.
WrapperManager: This is a 64-bit JVM.
WrapperManager: Reported cause:
WrapperManager: C:\Servoy\application_server\service\wrapper.dll: Can’t load IA 32-bit .dll on a AMD 64-bit platform
WrapperManager: System signals will not be handled correctly."

Is the wrapper.dll necessary? If so, what can we do to make the wrapper.dll load? Also, it seems strange that above it says “This is 64-bit JVM”. Doing java -version shows it to be 32-bit.

Dean

Westy:
It turns out that we need to stay with Java version 1.7.0_67 (32 bit) and Servoy 6.x on Window Server 2016.

Sounds like another software system depends on that required settings.
If that is the case, is it impossible to replace that other software system?
Because running such an old Java version also has huge security issues.

Didn’t you say it worked? The last error you posted suggests that you installed Servoy while a 32 bit Java version was active and now you try to start it while a 64 bit Java version is active. See this

Can’t load IA 32-bit .dll on a AMD 64-bit platform
This is a 64-bit JVM

The library we use to start Servoy as a service uses a dll which is available for 32 bit and 64 bit environments. At the time of installation the installer uses the one that matches the Java environment that is currently active. So if you run Java 32 bit for example while installing Servoy and then later switch to Java 64 bit, you have a problem.

So again: removing Servoy and all Java installs, then install Java 8 64 bit, then install servoy should work. It’s all about the dll in the “service” directory of application_server…

“At the time of installation the installer uses the one that matches the Java environment that is currently active.”

Is that true for the Servoy 6.x installer?

Dean

That is true for every installer we ever had. The installer can just ask: hey, what Java is running and then decide what dll to install. You could have 10 different Java versions on your machine…

Per instructions, I have removed Servoy and all Java installs, then installed Java 8 64 bit, then re-installed servoy. I ALSO changed wrapper.java.maxmemory=1280 in the wrapper.conf file to wrapper.java.maxmemory=6400 (server has 12GB of RAM), because we have up to 300 simultaneous webclient users. After re-starting the Servoy Application Server service, the .service_log.txt file now reads:

Wrapper Started as Service
Java Service Wrapper Standard Edition 64-bit 3.3.5
Copyright (C) 1999-2009 Tanuki Software, Ltd. All Rights Reserved.
http://wrapper.tanukisoftware.org
Licensed to Servoy for ServoyApplicationServer

Launching a JVM…
IWrapperManager: Initializing…
Java HotSpot™ 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
on_exit trigger matched. Restarting the JVM. (Exit code: 1)
Launching a JVM…
WrapperManager: Initializing…
Java HotSpot™ 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
on_exit trigger matched. Restarting the JVM. (Exit code: 1)
Launching a JVM…
WrapperManager: Initializing…
Java HotSpot™ 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
on_exit trigger matched. Restarting the JVM. (Exit code: 1)
Launching a JVM…
WrapperManager: Initializing…
Java HotSpot™ 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
on_exit trigger matched. Restarting the JVM. (Exit code: 1)
Launching a JVM…
WrapperManager: Initializing…
Java HotSpot™ 64-Bit Server VM warning: ignoring option MaxPermSize=128m; support was removed in 8.0
on_exit trigger matched. Restarting the JVM. (Exit code: 1)
There were 5 failed launches in a row, each lasting less than 300 seconds. Giving up.
There may be a configuration problem: please check the logs.
S<-- Wrapper Stopped

If I uninstall the service, delete the .service_log.txt file, reset the wrapper.conf file’s wrapper.java.maxmemory back to 1280, re-install service, and then restart the service, the resulting new .service_log.txt file shows the same failures. What to do?

Dean

yes, for further settings see https://wiki.servoy.com/display/DOCS/Memory+Management

I re-installed Servoy 6.x yet again and now the service starts with no errors. Thank you for the information and the link. Now I will read about managing memory.

Dean

I have read the memory instructions at the above link. Our solution is webclient only. In the wrapper.conf file (from this latest Servoy 6.x install) the default references to memory are:
'# Java Additional Parameters
wrapper.java.additional.1=-Djava.awt.headless=true
wrapper.java.additional.2=-Duser.dir=“C:\Servoy\application_server”
wrapper.java.additional.3=-Djava.io.tmpdir=“C:\Servoy\application_server\server\work”
wrapper.java.additional.4=-XX:MaxPermSize=128m

Working dir (for JNI calls)

wrapper.working.dir=C:\Servoy\application_server

Initial Java Heap Size (in MB)

wrapper.java.initmemory=32

Maximum Java Heap Size (in MB)

wrapper.java.maxmemory=1280"

The memory instructions from the link say to specify memory for Java 8 using the syntax:
-server -Xms4G -Xmx4G -XX:+UseG1GC -XX:MetaspaceSize=200M -XX:MaxMetaspaceSize=200M -XX:MinMetaspaceFreeRatio=0 -XX:MaxMetaspaceFreeRatio=100

How exactly do I change the existing wrapper.conf syntax above to the new syntax required for Java 8, for my solution which has in the past required wrapper.java.maxmemory=6400?

Dean

Continue reading :-). A bit further down in the article is a section on wrapper.conf

After re-reading the article, I have changed the above section of the wrapper.conf file to:
"# Java Additional Parameters
wrapper.java.additional.1=-Djava.awt.headless=true
wrapper.java.additional.2=-Duser.dir=“C:\Servoy\application_server”
wrapper.java.additional.3=-Djava.io.tmpdir=“C:\Servoy\application_server\server\work”
wrapper.java.additional.4=-XX:MaxPermSize=128m
wrapper.java.additional.5=-XX:MetaspaceSize=640M
wrapper.java.additional.6=-XX:MaxMetaspaceSize=640M
wrapper.java.additional.7=-XX:MinMetaspaceFreeRatio=0
wrapper.java.additional.8=-XX:MaxMetaspaceFreeRatio=100
wrapper.java.additional.9=-XX:MaxPermSize=128m
wrapper.java.additional.10=-XX:+UseG1GC

Working dir (for JNI calls)

wrapper.working.dir=C:\Servoy\application_server

Initial Java Heap Size (in MB), when G1GC is used just set the init memory to the max memory

wrapper.java.initmemory=6400

Maximum Java Heap Size (in MB)

wrapper.java.maxmemory=6400"

At the top of the servoy-admin home page it now says
on the production server (Windows Server 2008):
Heap Space Memory: allocated=516608K, used=377391K, max=5825536K
Non-Heap Space Memory: allocated=109824K, used=81228K, max=180224K
on this new staging server (Windows Server 2016):
Heap Space Memory: allocated=6553600K, used=149504K, max=6553600K
Non-Heap Space Memory: allocated=69632K, used=66632K, max=1949696K

Both servers have 12GB of RAM. My objective is to replace the production server with the staging server? If anyone sees anything above that might cause a problem, please let me know.

Dean