Always Crowd ('s tomcat) is not starting caused by a 'not a valid Win32 application' error
Asked by Kevin Kirchhof:

Recently I have set up the Crowd instacen on my Windows Server 2012 machine. I have set it up as described in its documentation and configured it to use a separeate mySQL DB. Running Crowd from start_crowd.bat works fine so far. But I need to run Crows as Windows' service. I installed the service as described in the ducmentation again an altered the jvm settings as recommended. Starting the server from bat-file still works proerly.

But if I try to run the Tomcat/Crowd service, it stops soon after startup. Attachted there are the logs, presented until the services crashs in debug log level. For configuration I have upgraded my Java installation to version 9 and ensured, that JAVA_HOME is pointing to the directory of the jdk.

Server-Log:

```
[2018-03-06 23:23:07] [debug] ( prunsrv.c:1679) [ 6940] Commons Daemon procrun log initialized
[2018-03-06 23:23:07] [info] ( prunsrv.c:1683) [ 6940] Commons Daemon procrun (1.0.15.0 32-bit) started
[2018-03-06 23:23:07] [info] ( prunsrv.c:1596) [ 6940] Running 'AtlassianCrowd' Service...
[2018-03-06 23:23:07] [debug] ( prunsrv.c:1374) [15024] Inside ServiceMain...
[2018-03-06 23:23:07] [debug] ( prunsrv.c:844 ) [15024] reportServiceStatusE: 2, 0, 3000, 0
[2018-03-06 23:23:07] [info] ( prunsrv.c:1127) [15024] Starting service...
[2018-03-06 23:23:07] [debug] ( javajni.c:233 ) [15024] loading jvm 'C:\Progra~1\Java\jre-9.0.4\bin\server\jvm.dll'
[2018-03-06 23:23:07] [debug] ( javajni.c:278 ) [15024] Setting DLL search path to 'C:\Progra~1\Java\jre-9.0.4\bin\server'
[2018-03-06 23:23:07] [debug] ( javajni.c:278 ) [15024] Setting DLL search path to 'C:\Progra~1\Java\jre-9.0.4\bin'
[2018-03-06 23:23:07] [error] ( javajni.c:291 ) [15024] %1 is not a valid Win32 application.
[2018-03-06 23:23:07] [error] ( prunsrv.c:1162) [15024] Failed creating java C:\Progra~1\Java\jre-9.0.4\bin\server\jvm.dll
[2018-03-06 23:23:07] [error] ( prunsrv.c:1162) [15024] %1 is not a valid Win32 application.
[2018-03-06 23:23:07] [error] ( prunsrv.c:1536) [15024] ServiceStart returned 1
[2018-03-06 23:23:07] [error] ( prunsrv.c:1536) [15024] %1 is not a valid Win32 application.
[2018-03-06 23:23:07] [debug] ( prunsrv.c:844 ) [15024] reportServiceStatusE: 1, 1066, 0, 1
[2018-03-06 23:23:07] [info] ( prunsrv.c:1598) [ 6940] Run service finished.
[2018-03-06 23:23:07] [info] ( prunsrv.c:1764) [ 6940] Commons Daemon procrun finished
```

Result of JAVA_HOME system variable output:

```
echo %JAVA_HOME%
C:\Program Files\Java\jdk-9.0.4?
```

Results of Java's version:

```
C:\>java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
```

I have no idea anymore, why the service is not coming up? Is there maybe a issue because of Java's 32/64 bit installation / expectation?

Thanks in advance,

Kevin


Answers:
author: AnnWorley
body: Hi Kevin,

You guessed it! It's Tomcat that is expecting the wrong Java. Please follow[Crowd 2.8 service 64-bit fails to start - not a valid Win32 application](https://confluence.atlassian.com/crowdkb/crowd-2-8-service-64-bit-fails-to-start-not-a-valid-win32-application-693900442.html)

On a side note, Java 9 is not a supported platform for Crowd, so unexpected behavior could result. Please change to a supported Java version listed on [Supported Platforms](https://confluence.atlassian.com/crowd/supported-platforms-191851.html).

Best of luck,

Ann

comments: author: Kevin Kirchhof
body: Hi Ann,

thanks for your reply and the workaround. I fixed the problem with exact this solution. The tomcats runtime was for 32bit system; Replacing them with the ones for 64bit system solved my issue. Crowd now comes up via service and runs without a problem.

Thanks again and best regards,

Kevin