IIS & ColdFusion 2018 configuring mime types & Java Config Part 2 of 2
IIS & ColdFusion 2018 configuring mime types & Java Config Part 2 of 2
Still under construction
Mime Types
After successfully migrating from an ancient version of ColdFusion to a ‘new’ Windows Server 2019 with ColdFusion 2018 the users started having issues.
The problem turned out to be we were missing a ‘msg’ mime type on the production server.
Next day problems
Users started experiencing issues with downloading files from the ColdFusion application. The developer identified we had a missing mime type ‘msg’.
We had to make one change to the IIS server, the ColdFusion application needed the IIS server to manage ‘msg’ mime types or it failed.
The developer asked if I could check the new version of IIS against the old version for any differences in mime types.
Comparing the Mime Type list between the two versions of IIS
Microsoft IIS mime type configuration file is normally located in a file:
C:\System\Windows\System32\inetsrv\Config\applicationHost.config
Notepad++ and it’s ‘Compare’ plugin
There are various applications which will help you compare files, I used notepad++ using the ‘Compare’ plugin as this application is relatively lightweight and easy to install. On the top menu of Notpad++ click on the ‘Plugins’ menu, then select ‘Plugin Admin…’. From there you can click on the ‘Available’ tab, search for the ‘Compare’ plugin then click on the install button. After the installation you list of plugins should look like the image below:
Compare two files
Open both files in Notepad++, with one file ‘active’ on the display go to the ‘Plugins’ menu at the top, use the Compare plugin to set the file to ‘Set as First to Compare’ or press Ctrl+Alt+1. Then make the second file active and using the Compare plugin set it to ‘Compare’ or press Ctrl+Alt+C to compare the files.
Scroll down to the mime types section to compare the types. I found we also had a missing ‘log’ mime so I added to the list but not via this file which would have probably been OK but it wouldn’t be the best way to go.
I compared the c:\windows\system32\inetsrv\Config\applicationHost.config files and these were the only two differences:
<mimeMap fileExtension=”.msg” mimeType=”application/vnd.ms-
<mimeMap fileExtension=”.log” mimeType=”text/plain” />
Encapsulation
You should never, never alter the data directly in a persistence store as you don’t know if it is being cached by the application and could get overwritten unless you known it’s OK. This is the first rule of encapsulation and you need to use the Application Programmers Interface (API) to ensure the data is valid and stored correctly.
I used the IIS manager to add the additional mime type so I knew this wouldn’t cause an issue.
Adding in the mime type enabled the users to use the system without any issues. The old server also had a ‘log’ mime type which the ‘new’ server didn’t so I added that as well.
I compared the c:\windows\system32\inetsrv\…:
<mimeMap fileExtension=”.msg” mimeType=”application/vnd.ms-
<mimeMap fileExtension=”.log” mimeType=”text/plain” />
500 Server Error
We hit another problem, the ColdFusion 2018 server started throwing 500 Server Errors. Restarting the service resolve the issue for a short time. I disabled then re-enabled the anti-virus but that didn’t seem to affect the situation.
The default size of the Java application was 4096 MB so we doubled it to 8192 MB. This stabilized the situation but I wasn’t happy until we could identify why.
Going through the error log it recorded the following error about the time of the 500 server error:
java.lang.OutOfMemoryError: Metaspace
I found a great write up about the issue from Charlie Arehart called Solving metaspace errors, once and for all
I followed Charlie’s instructions and removed the limiting parameter ‘MaxMetaspaceSize’ from the jvm.config file and restarted the server and so far it’s going well. I feel reasonably confident we have solved the issue (thanks Charlie).
The system seems to be running so far…
Next Step
The database connections are to our production SQL Server. We have limited applications, about five, on the server and we are running both production and dev servers on the ColdFusion server and the databases are all on the production SQL Server.
The installer allows both production and dev (without a license) on a server. The dev server allows two external connections and one local connection to the server. I’m going to leave the prod and dev apps on the production ColdFusion server but I will move the dev databases to my dev SQL Server where it should have always been (it was like this when I arrived).
The tables for the application are ‘heaps’ as the developer thinks they are faster so I need to educate him…
ColdFusion 2018 log files
A good place to look for hints if you have a problem or you think the server is running without any issues is to read the log files.
Notepad++ can be configured to ‘tail’ log files so it can be used to tail the log files to give real-time information about what is happening on the server. The server can ‘cache’ data in buffers so the log files can be behind the situation until the buffers have been flushed to the log files so you need to be patient.