Unable to launch JWrapper under MacOS High Sierra - jwrapper

We have an application that, up until today's High Sierra update, was running fine under MacOS. Now it will update, but not run the application.
We also note that JWrapper.app also doesn't run under High Sierra.
Here is a log snippet - does anyone have a clue as to what is wrong?
...
+0 ++++++++++++++++++++++++++++++++++++++++++++++++
+0 +++ Start: Launching
+0 ++++++++++++++++++++++++++++++++++++++++++++++++
+0 [Extractor] Launching 'JWrapper-JWrapper-00049034758-complete' from master folder '/Users/user/Library/Application Support/JWrapper-APPNAME (UAT)' of class 0 using JRE 'Mac64JRE'
+1 [PickFolder] Folder JWrapper-Mac64JRE-00054617449-complete.plugin matches Mac64JRE with version 54617449
+0 [PickFolder] Set latest to 54617449 JWrapper-Mac64JRE-00054617449-complete.plugin
+0 [PickFolder] Folder JWrapper-Mac64JRE-00054617449-complete matches Mac64JRE with version 54617449
+0 [Extractor] Using private JRE JWrapper-Mac64JRE-00054617449-complete.plugin
+0 [Utils] File does NOT exist: /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin/bin/APPNAME (UAT)
+0 [Extractor] Copying FILE /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin/bin/APPNAME (UAT)
+0 [Extractor] *************************** Unable to open source file for copy /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin/bin/java
+0 *******************************************
+0 Error setting app binary executable!
+0 *******************************************
+0 [Extractor] JRE LSO file is /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWApps/JRE-LastSuccessfulOptions-JWrapper-Mac64JRE-00054617449-complete.plugin
+0 [Extractor] Building classpath
+0 [Extractor] Creating launch properties
+0 [Extractor] Checking LSO file
+0 [Extractor] Reading /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWApps/JRE-LastSuccessfulOptions-JWrapper-Mac64JRE-00054617449-complete.plugin
+0 [Utils] File does NOT exist: /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWApps/JRE-LastSuccessfulOptions-JWrapper-Mac64JRE-00054617449-complete.plugin
+0 *******************************************
+0 JRE LSO file does not exist
+0 *******************************************
+0 [Extractor] Writing launch properties file
+0 [Extractor] Writing launch properties to /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-JWrapper-00049034758-complete/JWLaunchProperties-1506477183962-19
+0 [Extractor] Launch properties length is 868
+0 [Extractor] Writing to file
+1 [Extractor] Finished writing launch properties file
+0 [Extractor] Reading 0 extra args
+0 [Extractor] Read JRE compatibility class jwrapper.updater.GenericUpdaterJreVerifierLaunch
+0 [Extractor] Appending 1 command line args
+0 [Extractor] Executable: /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin/bin/APPNAME (UAT)
+0 [Extractor] Argument 0: /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin/bin/APPNAME (UAT)
+0 [Extractor] Argument 1: -cp
+0 [Extractor] Argument 2: /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-JWrapper-00049034758-complete/jwrapperlib/jwstandalonelaunch.jar
+0 [Extractor] Argument 3: jwrapper.updater.GenericUpdaterLaunch
+0 [Extractor] Argument 4: /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-JWrapper-00049034758-complete/JWLaunchProperties-1506477183962-19
+0 [Extractor] Argument 5: -psn_0_2048500
+0 [Extractor] This is a newer extractor... launchclass is 0
+0 [Extractor] JRE folder is /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin
+0 [BundleLoader] Creating jre path URL for path /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin.plugin
+0 [BundleLoader] Created NSURL
+0 [BundleLoader] Bundle is null?+0 [Extractor] Adjusted JRE folder is /Users/user/Library/Application Support/JWrapper-APPNAME (UAT)/JWrapper-Mac64JRE-00054617449-complete.plugin.plugin/Contents/Home
+0 [Extractor] Force spawn is 0 so attempting to launch via JNI
+0 ++++++++++++++++++++++++++++++++++++++++++++++++
+0 +++ Start: JNI Launch
+0 ++++++++++++++++++++++++++++++++++++++++++++++++
+0 [JNILaunch] [pid=9416] [mainThread=0]
+0 [JNILaunch] [ERROR] Could not load dynamic library!
+0 [JNILaunch] [ERROR] Unable to load JRE library!
+0 [Extractor] Return code for JNI launch was 1
+0 ------------------------------------------------
+0 --- End: JNI Launch
+0 ------------------------------------------------
+0 [Extractor] JNI launch failed. Attempting legacy spawn instead
+0 [Extractor] Attempting spawn launch
+0 ++++++++++++++++++++++++++++++++++++++++++++++++
+0 +++ Start: Spawn launch
+0 ++++++++++++++++++++++++++++++++++++++++++++++++
+0 [Utils] Closing logging file.

The answer to this is simple - update the JRE to the latest Oracle JRE, which at time of writing was 1.8.0_144.
We note that the jwrapper version we are using (49034758) is the latest version you can run without purchasing a license. I would seriously think twice before paying for this product.

Related

DotNet 6.0 publish error MSB4018: The process cannot access the file because it is being used by another process

The Error
When attempting to publish the app in the microsoft .NET 6.0 sdk container, the build fails with the following error:
System.IO.IOException: The process cannot access the file '/app/My-App/web.config' because it is being used by another process.
The failure occurs right after or towards the end of the React-JS frontend creation.
Here is the error in full:
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: The "TransformWebConfig" task failed unexpectedly. [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: System.IO.IOException: The process cannot access the file '/app/My-App/web.config' because it is being used by another process. [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Win32.SafeHandles.SafeFileHandle.Init(String path, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Win32.SafeHandles.SafeFileHandle.Open(String fullPath, FileMode mode, FileAccess access, FileShare share, FileOptions options, Int64 preallocationSize) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at System.IO.FileSystem.CopyFile(String sourceFullPath, String destFullPath, Boolean overwrite) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at System.IO.File.Copy(String sourceFileName, String destFileName, Boolean overwrite) [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.NET.Sdk.Publish.Tasks.TransformWebConfig.Execute() [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Build.BackEnd.TaskExecutionHost.Microsoft.Build.BackEnd.ITaskExecutionHost.Execute() [/app/My-App/My-App.csproj]
#25 253.0 /usr/share/dotnet/sdk/6.0.401/Sdks/Microsoft.NET.Sdk.Publish/targets/TransformTargets/Microsoft.NET.Sdk.Publish.TransformFiles.targets(50,5): error MSB4018: at Microsoft.Build.BackEnd.TaskBuilder.ExecuteInstantiatedTask(ITaskExecutionHost taskExecutionHost, TaskLoggingContext taskLoggingContext, TaskHost taskHost, ItemBucket bucket, TaskExecutionMode howToExecuteTask) [/app/My-App/My-App.csproj]
------
executor failed running [/bin/sh -c dotnet publish "My-App/My-App.csproj" -c Release -o /app/My-App]: exit code: 1
Dockerfile
Here is the relevant part of my Dockerfile. Since it is the build container, not much effort is made to keep it small.
Note that the build worked fine in a .NET 2.2 docker build using mcr.microsoft.com/dotnet/core/sdk:2.2. The errors only appeared after the migration to mcr.microsoft.com/dotnet/sdk:6.0
# ========= Build ASP.NET Core =========
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS dotnet_backend_build
RUN apt update && apt upgrade -y
RUN apt install -y curl wget make g++
# ========== Install Node ==========
RUN curl --silent --location https://deb.nodesource.com/setup_lts.x | bash -
RUN apt install -yq --no-install-recommends build-essential nodejs
# Node needs more memory during buildtime than default (=512)
ARG NODE_OPTIONS="--max-old-space-size=4096"
# ========= Installed Node =========
WORKDIR /app
COPY . .
RUN dotnet restore "./My-App/My-App.csproj"
RUN dotnet publish "My-App.csproj" -c Release -o /My-App/My-App
# ========= Built ASP.NET Core =========
What I've tried so far
Compilation on my local windows machine using MSBuild works fine.
dotnet publish Error: The process cannot access the file because it is being used by another process -> Not applicable, since I cannot run on a local machine
Add the command RUN dotnet build-server shutdown to line before dotnet publish
On a wild guess this solution The "TransformWebConfig" task failed unexpectedly - System.Exception: The acceptable value for AspNetCoreModuleHostingModel property is either
Copied the My-App.csproj to a separate layer before restoring, as seen in the Microsoft tutorial: https://learn.microsoft.com/en-us/aspnet/core/host-and-deploy/docker/building-net-docker-images?view=aspnetcore-6.0#the-dockerfile
Another promising option was this MSBuild error MSB4018 cannot access project.assets.json in NET 5 build However, since I am using the microsoft .NET 6 docker image, are MSBuild options even possible? I did not find the option in the dotnet publish documentation: https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-publish Passing on the arguments -m -graph resulted in the same error message
In order to prevent timing issues, activate verbose logging as seen here: https://github.com/NuGet/Home/issues/11607 -> Added flag -v d to dotnet publish command. This results in presumably the same issue, but the output is clipped by docker due to a too high console log rate
I would appreciate any further pointers. Thank you in advance.
I struggled with this a bunch yesterday. Our problem was running a build in Github Actions. However, it boiled down to this:
In net 6.0, dotnet build is invoking msbuild with the -maxcpucount flag. According to MS docs, doing that means you're allowing msbuild to select a number for how many CPU cores to use to execute. However, the build issue you're having is because there are simultaneous processes trying to access the same file.
Consider adding -maxcpucount:1 to the end of your dotnet publish command. This switch will be passed to the underlying msbuild invocation, and should instruct it to be single-threaded, and hence not cause the file-access conflict you're seeing.

Why does "dotnet ef migrations add" throw a Win32Exception?

I have a dotnet core v3.1 project with an entity framework DbContext.
when I try to run:
dotnet ef migrations add someMigrationName
this Exception will be thrown:
System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.EntityFrameworkCore.Tools.Exe.Run(String executable, IReadOnlyList`1 args, String workingDirectory, Boolean interceptOutput)
at Microsoft.EntityFrameworkCore.Tools.Project.FromFile(String file, String buildExtensionsDir, String framework, String configuration, String runtime)
at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute(String[] _)
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
No such file or directory
My development environment is a Linux elementary os (Ubuntu 18.04.4 LTS) and rider IDE.
It may be irrelevant but when I try to debug my xunit tests it returns this warning and cannot start execution.
All of these commands work properly and show all options:
dotnet
dotnet ef
dotnet ef migrations
but when I use these options Exception raised:
dotnet ef migrations add
dotnet ef migrations list
Also, I run my command with verbose option and this is the output:
Using project '/media/navid/9bf0167c-d789-4e06-9e23-4023ec551745/Stuff/Work/SabaCell/venus/Venus.CustomerProfileManagement/Venus.CustomerProfileManagement.csproj'.
Using startup project '/media/navid/9bf0167c-d789-4e06-9e23-4023ec551745/Stuff/Work/SabaCell/venus/Venus.CustomerProfileManagement/Venus.CustomerProfileManagement.csproj'.
Writing '/media/navid/9bf0167c-d789-4e06-9e23-4023ec551745/Stuff/Work/SabaCell/venus/Venus.CustomerProfileManagement/obj/Venus.CustomerProfileManagement.csproj.EntityFrameworkCore.targets'...
dotnet msbuild /target:GetEFProjectMetadata /property:EFProjectMetadataFile=/tmp/tmpUud0Xf.tmp /verbosity:quiet /nologo /media/navid/9bf0167c-d789-4e06-9e23-4023ec551745/Stuff/Work/SabaCell/venus/Venus.CustomerProfileManagement/Venus.CustomerProfileManagement.csproj
System.ComponentModel.Win32Exception (2): No such file or directory
at System.Diagnostics.Process.ForkAndExecProcess(String filename, String[] argv, String[] envp, String cwd, Boolean redirectStdin, Boolean redirectStdout, Boolean redirectStderr, Boolean setCredentials, UInt32 userId, UInt32 groupId, UInt32[] groups, Int32& stdinFd, Int32& stdoutFd, Int32& stderrFd, Boolean usesTerminal, Boolean throwOnNoExec)
at System.Diagnostics.Process.StartCore(ProcessStartInfo startInfo)
at System.Diagnostics.Process.Start()
at System.Diagnostics.Process.Start(ProcessStartInfo startInfo)
at Microsoft.EntityFrameworkCore.Tools.Exe.Run(String executable, IReadOnlyList`1 args, String workingDirectory, Boolean interceptOutput)
at Microsoft.EntityFrameworkCore.Tools.Project.FromFile(String file, String buildExtensionsDir, String framework, String configuration, String runtime)
at Microsoft.EntityFrameworkCore.Tools.RootCommand.Execute(String[] _)
at Microsoft.EntityFrameworkCore.Tools.Commands.CommandBase.<>c__DisplayClass0_0.<Configure>b__0(String[] args)
at Microsoft.DotNet.Cli.CommandLine.CommandLineApplication.Execute(String[] args)
at Microsoft.EntityFrameworkCore.Tools.Program.Main(String[] args)
No such file or directory
this is the result of running dotnet --info in my environment:
.NET Core SDK (reflecting any global.json):
Version: 3.1.405
Commit: 3fae16e62e
Runtime Environment:
OS Name: elementary
OS Version: 5.1.7
OS Platform: Linux
RID: linux-x64
Base Path: /usr/share/dotnet/sdk/3.1.405/
Host (useful for support):
Version: 3.1.11
Commit: f5eceb8105
.NET Core SDKs installed:
3.1.405 [/usr/share/dotnet/sdk]
.NET Core runtimes installed:
Microsoft.AspNetCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.AspNetCore.App]
Microsoft.NETCore.App 3.1.11 [/usr/share/dotnet/shared/Microsoft.NETCore.App]
To install additional .NET Core runtimes or SDKs:
https://aka.ms/dotnet-download
This helped me,
I deleted dotnet symlink in /usr/local/bin/ (macOS)
It didn't work for me removing the symlink.
I had to reinstall the dotnet-ef tool:
dotnet new tool-manifest
dotnet tool install dotnet-ef
That fixed the issue :)
I was able to solve this issue with #bjorn answer. there was a symlink in my /usr/local/bin pointing to /snap/..., back when I tried to install .net sdk with snap, which was not successful, so I tried a different approach. Just complementing #bjorn answer, this is what I did :
Check if you have a symlink :
ls -l /usr/local/bin/
It will look something like this :
lrwxrwxrwx 1 root root 54 jul 22 09:46 dotnet -> /snap/...
Then remove it :
sudo rm /usr/local/bin/dotnet

dotnet core compile time error - System.Net.Sockets.SocketException (98): Address already in use

Occasionally, while running build on build machine, we are getting multiple errors when trying to run 'dotnet test' command. After all, build succeeds but error is unexpected and might be confusing:
/usr/bin/dotnet test /home/vsts_agent3/VSTS-Desktop-agents/_work/15/s/Name.Tests.csproj --logger trx --results-directory /home/vsts_agent3/VSTS-Desktop-agents/_work/_temp --configuration Prod
MSBUILD : error MSB1025: An internal failure occurred while running MSBuild.
System.Net.Sockets.SocketException (98): Address already in use
at System.Net.Sockets.Socket.UpdateStatusAfterSocketErrorAndThrowException(SocketError error, String callerName)
at System.Net.Sockets.Socket.DoBind(EndPoint endPointSnapshot, SocketAddress socketAddress)
at System.Net.Sockets.Socket.Bind(EndPoint localEP)
at System.IO.Pipes.NamedPipeServerStream.SharedServer..ctor(String path, Int32 maxCount)
at System.IO.Pipes.NamedPipeServerStream.SharedServer.Get(String path, Int32 maxCount)
at System.IO.Pipes.NamedPipeServerStream.Create(String pipeName, PipeDirection direction, Int32 maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, Int32 inBufferSize, Int32 outBufferSize, HandleInheritability inheritability)
at System.IO.Pipes.NamedPipeServerStream..ctor(String pipeName, PipeDirection direction, Int32 maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, Int32 inBufferSize, Int32 outBufferSize, HandleInheritability inheritability)
at System.IO.Pipes.NamedPipeServerStream..ctor(String pipeName, PipeDirection direction, Int32 maxNumberOfServerInstances, PipeTransmissionMode transmissionMode, PipeOptions options, Int32 inBufferSize, Int32 outBufferSize)
at Microsoft.Build.BackEnd.NodeEndpointOutOfProcBase.InternalConstruct(String pipeName)
at Microsoft.Build.Execution.OutOfProcNode.Run(Boolean enableReuse, Exception& shutdownException)
at Microsoft.Build.CommandLine.MSBuildApp.StartLocalNode(CommandLineSwitches commandLineSwitches)
at Microsoft.Build.CommandLine.MSBuildApp.ProcessCommandLineSwitches(CommandLineSwitches switchesFromAutoResponseFile, CommandLineSwitches switchesNotFromAutoResponseFile, String& projectFile, String[]& targets, String& toolsVersion, Dictionary`2& globalProperties, ILogger[]& loggers, LoggerVerbosity& verbosity, List`1& distributedLoggerRecords, Int32& cpuCount, Boolean& enableNodeReuse, TextWriter& preprocessWriter, Boolean& detailedSummary, ISet`1& warningsAsErrors, ISet`1& warningsAsMessages, Boolean& enableRestore, ProfilerLogger& profilerLogger, Boolean& enableProfiler, Dictionary`2& restoreProperties, Boolean recursing)
at Microsoft.Build.CommandLine.MSBuildApp.Execute(String[] commandLine)
Error can be repeated few times, but than finally build succeeds and tests are executed:
Build started, please wait...
Build completed.
Test run for /home/vsts_agent3/VSTS-Desktop-agents/_work/15/s/Project.Web.Tests/bin/Prod/netcoreapp2.1/Name.Tests.dll(.NETCoreApp,Version=v2.1)
Microsoft (R) Test Execution Command Line Tool Version 15.8.0
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait...
It looks like MSBuildApp start some server inside to compile our sources. It would be great to understand why to make sure we have a safe CI/CD pipeline.
We are running build on Ubuntu and using dotnet core 2.1.

JWrapper with JavaFX fails to launch on windows

We've got an application which we've recently added JavaFX to, and updated to the latest JRE, and now Jwrapper won't launch the application on Windows (MacOS and Linux are fine).
We've followed the instructions on this post http://www.jwrapper.com/blog/bundling-javafx-into-a-native-exe and changed our JWrapper config accordingly.
We are using JDK1.80_102 and JWrapper version: jwrapper-00044250826.jar. We are building via maven (we have a plugin that does this).
The application downloads, but will not launch. See the logs below:
+0 ----- Starting Launcher -----
+0 [Launcher] Arg[0]=C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete\bin\APPNAME (UAT).exe
+0 [Launcher] Arg[1]=-cp
+0 [Launcher] Arg[2]=C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-APPNAME (UAT)-00046316696-complete\jarname-all-3012-SNAPSHOT.jar;C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-APPNAME (UAT)-00046316696-complete\jwrapper_utils.jar
+0 [Launcher] Arg[3]=-Xms256m
+0 [Launcher] Arg[4]=-Xmx1024m
+0 [Launcher] Arg[5]=-Duser.groovyServer=groovy.server.url.com
+0 [Launcher] Arg[6]=-DcurrentEnvironment=UAT
+0 [Launcher] Arg[7]=-DreqServerVersion=2016-09-08:1.0-0
+0 [Launcher] Arg[8]=-DprojectVersion=3012-SNAPSHOT
+0 [Launcher] Arg[9]=-DstartBanner=o3gui/images/app_banner.gif
+0 [Launcher] Arg[10]=-Dswing.aatext=true
+0 [Launcher] Arg[11]=-Dapple.laf.useScreenMenuBar=true
+0 [Launcher] Arg[12]=-Dcom.apple.mrj.application.apple.menu.about.name=APPNAME
+0 [Launcher] Arg[13]=3
+0 [Launcher] Arg[14]=-Djavafx.macosx.embedded=true
+0 [Launcher] Arg[15]=jwrapper.JWrapper
+0 [Launcher] Arg[16]=C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-APPNAME (UAT)-00046316696-complete\JWLaunchProperties-1473288163056-24
+15 [Launcher] Found tail marker
+0 [Launcher] App Name = APPNAME (UAT)
+0 [Launcher] App Version =
+0 [Launcher] JRE Version =
+0 [Launcher] GU Version =
+0 [Launcher] Min Splash MS = 850
+0 [Launcher] Signature Public Key =
+0 [Launcher] Can Override Splash = 0
+0 [Launcher] Install Type = perm_user
+0 [Launcher] Silent Parameter =
+0 [Launcher] Update URL = 8
+0 [Launcher] ExePath is C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete\bin\APPNAME (UAT).exe
+0 [Launcher] Master dir from exe path is C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)
+0 [Launcher] Master folder is C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)
+0 [Launcher] Located existing bin JRE runtime = C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete
+0 [Launcher] JRE path is C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete
+0 [JNILaunch] Bin folder is C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete\bin
+0 File exists: C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete\bin\server\jvm.dll
+0 [JNILaunch] Trying to load library C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete\bin\server\jvm.dll [exists=1]
+1 [JNILaunch] Unable to load library. Will attempt fallback.
+0 [JNILaunch] Trying to load library C:\Users\username\AppData\Roaming\JWrapper-APPNAME (UAT)\JWrapper-Windows64JRE-00046316492-complete\bin\client\jvm.dll [exists=0]
+0 [JNILaunch] Unable to load second library.
+0 [JNILaunch] [ERROR] Unable to load JRE library!
NOTE: This is a workaround, not a fix for this issue.
If anyone else come across this problem, one workaround is to use the 32-bits Windows JRE.
As it can be noticed in the log, when JWrapper is starting the JNI launch, it will try the "server" JVM first (...\bin\server\jvm.dll), which is present in the 64-bits JRE.
And then, after it failed for some reason (JWrapper doesn't provide any useful information about it), JWrapper will try to load the "client" JVM (...\bin\client\jvm.dll).
The "client" JVM doesn't exist in the 64-bits JRE (and it's not there for ages, not sure why JWrapper is still trying to load it).
Now, if you use the 32-bits version, you should notice a change in the log:
++++++++++++++++++++++++++++++++++++++++++++++++
[JNILaunch] Bin folder is C:\Users\IEUser\AppData\Roaming\JWrapperApp\JWrapper-Windows64JRE-00046325420-complete\bin
[JNILaunch] Trying to load library C:\Users\IEUser\AppData\Roaming\JWrapperApp\JWrapper-Windows64JRE-00046325420-complete\bin\server\jvm.dll [exists=0]
[JNILaunch] Unable to load library. Will attempt fallback.
File exists: C:\Users\IEUser\AppData\Roaming\JWrapperApp\JWrapper-Windows64JRE-00046325420-complete\bin\client\jvm.dll
[JNILaunch] Trying to load library C:\Users\IEUser\AppData\Roaming\JWrapperApp\JWrapper-Windows64JRE-00046325420-complete\bin\client\jvm.dll [exists=1]
[JNILaunch] Unable to load second library.
[JNILaunch] [ERROR] Unable to load JRE library!
[Extractor] Return code for JNI launch was 1
------------------------------------------------
--- End: JNI Launch
------------------------------------------------
[Extractor] JNI launch failed. Attempting legacy spawn instead
[Extractor] Attempting spawn launch
++++++++++++++++++++++++++++++++++++++++++++++++
+++ Start: Spawn launch
++++++++++++++++++++++++++++++++++++++++++++++++
[Utils] Closing logging file.
Now the situation is inverted, the "server" JVM is not found and the "client" is there (as expected).
JWrapper is still unable to load it though, and it still doesn't provide any useful information for why it can't be loaded.
The main difference now is that, even though JWrapper can't load the client JVM, it will try a legacy spawn instead, which worked well in my case.

Saving a file to 'C:\Windows\System32\dns' causes 'Could not find a part of the path' error

I've written a windows forms (.net 4) application that needs to write a file to the folder 'C:\Windows\System32\dns'. When this line of code runs:
File.WriteAllText(dnsFileLocation, luxDns)
I get the following error, does anyone know why?
Note: This happens even if I run the application as administrator!
***** Exception Text *******
System.IO.DirectoryNotFoundException: Could not find a part of the path 'C:\Windows\System32\dns\lux2.dns'.
at System.IO.__Error.WinIOError(Int32 errorCode, String maybeFullPath)
at System.IO.FileStream.Init(String path, FileMode mode, FileAccess access, Int32 rights, Boolean useRights, FileShare share, Int32 bufferSize, FileOptions options, SECURITY_ATTRIBUTES secAttrs, String msgPath, Boolean bFromProxy, Boolean useLongPath)
at System.IO.FileStream..ctor(String path, FileMode mode, FileAccess access, FileShare share, Int32 bufferSize, FileOptions options)
at System.IO.StreamWriter.CreateFile(String path, Boolean append)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding, Int32 bufferSize)
at System.IO.StreamWriter..ctor(String path, Boolean append, Encoding encoding)
at System.IO.File.InternalWriteAllText(String path, String contents, Encoding encoding)
at System.IO.File.WriteAllText(String path, String contents)
at DnsServerUpdater.Main.Main_Load(Object sender, EventArgs e)
at System.EventHandler.Invoke(Object sender, EventArgs e)
at System.Windows.Forms.Form.OnLoad(EventArgs e)
at System.Windows.Forms.Form.OnCreateControl()
at System.Windows.Forms.Control.CreateControl(Boolean fIgnoreVisible)
at System.Windows.Forms.Control.CreateControl()
at System.Windows.Forms.Control.WmShowWindow(Message& m)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ScrollableControl.WndProc(Message& m)
at System.Windows.Forms.Form.WmShowWindow(Message& m)
at System.Windows.Forms.Form.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** Loaded Assemblies **************
mscorlib
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.261 (RTMGDR.030319-2600)
CodeBase: file:///C:/Windows/Microsoft.NET/Framework/v4.0.30319/mscorlib.dll
----------------------------------------
DnsServerUpdater
Assembly Version: 1.0.0.0
Win32 Version: 1.0.0.0
CodeBase: file:///C:/web/dns/DnsServerUpdater.exe
----------------------------------------
Microsoft.VisualBasic
Assembly Version: 10.0.0.0
Win32 Version: 10.0.30319.1 built by: RTMRel
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/Microsoft.VisualBasic/v4.0_10.0.0.0__b03f5f7f11d50a3a/Microsoft.VisualBasic.dll
----------------------------------------
System
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.261 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System/v4.0_4.0.0.0__b77a5c561934e089/System.dll
----------------------------------------
System.Core
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.233 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Core/v4.0_4.0.0.0__b77a5c561934e089/System.Core.dll
----------------------------------------
System.Windows.Forms
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.235 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Windows.Forms/v4.0_4.0.0.0__b77a5c561934e089/System.Windows.Forms.dll
----------------------------------------
System.Drawing
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.276 built by: RTMGDR
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Drawing/v4.0_4.0.0.0__b03f5f7f11d50a3a/System.Drawing.dll
----------------------------------------
System.Runtime.Remoting
Assembly Version: 4.0.0.0
Win32 Version: 4.0.30319.1 (RTMRel.030319-0100)
CodeBase: file:///C:/Windows/Microsoft.Net/assembly/GAC_MSIL/System.Runtime.Remoting/v4.0_4.0.0.0__b77a5c561934e089/System.Runtime.Remoting.dll
***** JIT Debugging *******
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Are you running 64bit windows ? If yes then that's probably your issue as you will get redirected in another directory.
You will need to implement
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365743%28v=vs.85%29.aspx and
http://msdn.microsoft.com/en-us/library/windows/desktop/aa365745%28v=vs.85%29.aspx
in order to temporarily disable the 64bit redirection in order to access that folder.
Can you check if the directory exists? Since system32 is a windows folder, to create files and folders inside it requires special rights. Does the user who is running the win forms app have rights to create folder/file inside the system32 folder?

Resources