fvarrui / JavaPackager

:package: Gradle/Maven plugin to package Java applications as native Windows, MacOS, or Linux executables and create installers for them.
GNU General Public License v3.0
1.07k stars 133 forks source link

Application exists unexpectedly if packaged using 1.6.4+ #185

Closed amitjoy closed 2 years ago

amitjoy commented 2 years ago

I'm submitting a…

Short description of the issue/suggestion: Build DMG using 1.6.5 (the latest release) but the application cannot be opened after finishing DMG installation on Mac.

It works perfectly with 1.6.3 or any version before it but doesn't work with 1.6.4 and 1.6.5

Steps to reproduce the issue/enhancement:

  1. Build DMG using 1.6.5
  2. Install with the recently built DMG
  3. The installed application cannot be opened anymore

What is the expected behavior? Clicking on the application after having it installed from the DMG file, the application opens normally

What is the current behavior? Clicking on the application after having it installed from the DMG file, the application exits unexpectedly

Do you have outputs, screenshots, demos or samples which demonstrate the problem or enhancement?

Screenshot 2022-04-05 at 13 58 54
-------------------------------------
Translated Report (Full Report Below)
-------------------------------------

Process:               java [15711]
Path:                  /Applications/OSGi.fx.app/Contents/MacOS/universalJavaApplicationStub
Identifier:            java
Version:               ???
Code Type:             X86-64 (Native)
Parent Process:        launchd [1]
User ID:               503

Date/Time:             2022-04-05 13:52:59.7259 +0200
OS Version:            macOS 12.1 (21C52)
Report Version:        12
Bridge OS Version:     6.1 (19P647)
Anonymous UUID:        D81ECA0D-114D-03DC-A6CC-DF084E8A619D

Sleep/Wake UUID:       C34800F9-286C-4573-BC33-D5431968F6D5

Time Awake Since Boot: 21000 seconds
Time Since Wake:       21048 seconds

System Integrity Protection: enabled

Crashed Thread:        0

Exception Type:        EXC_CRASH (SIGABRT)
Exception Codes:       0x0000000000000000, 0x0000000000000000
Exception Note:        EXC_CORPSE_NOTIFY

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/libjli.dylib
Referenced from: /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java
Reason: tried: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with cust
(terminated at launch; ignore backtrace)

Application Specific Information:
Library not loaded: @rpath/libjli.dylib
Referenced from: /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java
Reason: tried: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with cust

Thread 0 Crashed:
0   dyld                                   0x10acaa0ce __abort_with_payload + 10
1   dyld                                   0x10acc01cf abort_with_payload_wrapper_internal + 80
2   dyld                                   0x10acc0201 abort_with_payload + 9
3   dyld                                   0x10ac6e613 dyld4::halt(char const*) + 375
4   dyld                                   0x10ac6a55d dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*) + 3955
5   dyld                                   0x10ac694b4 start + 388

Thread 0 crashed with X86 Thread State (64-bit):
  rax: 0x0000000002000209  rbx: 0x0000000000000000  rcx: 0x00007ff7bf900438  rdx: 0x00007ff7bf9008a0
  rdi: 0x0000000000000006  rsi: 0x0000000000000001  rbp: 0x00007ff7bf900480  rsp: 0x00007ff7bf900438
   r8: 0x00007ff7bf9004a0   r9: 0x0000000000000000  r10: 0x000000000000006e  r11: 0x0000000000000246
  r12: 0x000000000000006e  r13: 0x00007ff7bf9008a0  r14: 0x0000000000000001  r15: 0x0000000000000006
  rip: 0x000000010acaa0ce  rfl: 0x0000000000000246  cr2: 0x000000010ac70e3c

Logical CPU:     0
Error Code:      0x02000209 
Trap Number:     133

Binary Images:
       0x10ac64000 -        0x10accffff dyld (*) <cef5a27a-d50b-3020-af03-1734b19bc8c5> /usr/lib/dyld

External Modification Summary:
  Calls made by other processes targeting this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by this process:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0
  Calls made by all processes on this machine:
    task_for_pid: 0
    thread_create: 0
    thread_set_state: 0

VM Region Summary:
ReadOnly portion of Libraries: Total=652K resident=0K(0%) swapped_out_or_unallocated=652K(100%)
Writable regions: Total=9220K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9220K(100%)

                                VIRTUAL   REGION 
REGION TYPE                        SIZE    COUNT (non-coalesced) 
===========                     =======  ======= 
STACK GUARD                       56.0M        1 
Stack                             8192K        1 
VM_ALLOCATE                         12K        3 
__DATA                              20K        2 
__DATA_CONST                        80K        1 
__LINKEDIT                         240K        4 
__TEXT                             436K        2 
dyld private memory               1024K        1 
===========                     =======  ======= 
TOTAL                             65.8M       15 

-----------
Full Report
-----------

{"app_name":"java","timestamp":"2022-04-05 13:52:59.00 +0200","app_version":"","slice_uuid":"055cde84-0613-3803-9cb9-4e216b81e0ed","build_version":"","platform":1,"share_with_app_devs":0,"is_first_party":1,"bug_type":"309","os_version":"macOS 12.1 (21C52)","incident_id":"983788D7-E033-4EBF-B4C0-64FA1D8AB506","name":"java"}
{
  "uptime" : 21000,
  "procLaunch" : "2022-04-05 13:52:55.6567 +0200",
  "procRole" : "Background",
  "version" : 2,
  "userID" : 503,
  "deployVersion" : 210,
  "modelCode" : "MacBookPro15,2",
  "procStartAbsTime" : 21243264570265,
  "coalitionID" : 4319,
  "osVersion" : {
    "train" : "macOS 12.1",
    "build" : "21C52",
    "releaseType" : "User"
  },
  "captureTime" : "2022-04-05 13:52:59.7259 +0200",
  "incident" : "983788D7-E033-4EBF-B4C0-64FA1D8AB506",
  "bug_type" : "309",
  "pid" : 15711,
  "procExitAbsTime" : 21247333361034,
  "cpuType" : "X86-64",
  "procName" : "java",
  "procPath" : "\/Applications\/OSGi.fx.app\/Contents\/MacOS\/universalJavaApplicationStub",
  "parentProc" : "launchd",
  "parentPid" : 1,
  "coalitionName" : "com.osgifx",
  "crashReporterKey" : "D81ECA0D-114D-03DC-A6CC-DF084E8A619D",
  "wakeTime" : 21048,
  "bridgeVersion" : {"build":"19P647","train":"6.1"},
  "sleepWakeUUID" : "C34800F9-286C-4573-BC33-D5431968F6D5",
  "sip" : "enabled",
  "isCorpse" : 1,
  "exception" : {"codes":"0x0000000000000000, 0x0000000000000000","rawCodes":[0,0],"type":"EXC_CRASH","signal":"SIGABRT"},
  "termination" : {"code":1,"flags":518,"namespace":"DYLD","indicator":"Library missing","details":["(terminated at launch; ignore backtrace)"],"reasons":["Library not loaded: @rpath\/libjli.dylib","Referenced from: \/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/java","Reason: tried: '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/.\/libjli.dylib' (no such file), '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/..\/lib\/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/lib\/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/.\/libjli.dylib' (no such file), '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/..\/lib\/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/lib\/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with cust"]},
  "asi" : {"dyld":["Library not loaded: @rpath\/libjli.dylib","Referenced from: \/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/java","Reason: tried: '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/.\/libjli.dylib' (no such file), '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/..\/lib\/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/lib\/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/.\/libjli.dylib' (no such file), '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/bin\/..\/lib\/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '\/Applications\/OSGi.fx.app\/Contents\/PlugIns\/jre\/Contents\/Home\/lib\/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with cust"]},
  "extMods" : {"caller":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"system":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"targeted":{"thread_create":0,"thread_set_state":0,"task_for_pid":0},"warnings":0},
  "faultingThread" : 0,
  "threads" : [{"triggered":true,"id":272997,"threadState":{"r13":{"value":140702047537312},"rax":{"value":33554953},"rflags":{"value":582},"cpu":{"value":0},"r14":{"value":1},"rsi":{"value":1},"r8":{"value":140702047536288},"cr2":{"value":4475784764},"rdx":{"value":140702047537312},"r10":{"value":110},"r9":{"value":0},"r15":{"value":6},"rbx":{"value":0},"trap":{"value":133},"err":{"value":33554953},"r11":{"value":582},"rip":{"value":4476018894,"matchesCrashFrame":1},"rbp":{"value":140702047536256},"rsp":{"value":140702047536184},"r12":{"value":110},"rcx":{"value":140702047536184},"flavor":"x86_THREAD_STATE","rdi":{"value":6}},"frames":[{"imageOffset":286926,"symbol":"__abort_with_payload","symbolLocation":10,"imageIndex":0},{"imageOffset":377295,"symbol":"abort_with_payload_wrapper_internal","symbolLocation":80,"imageIndex":0},{"imageOffset":377345,"symbol":"abort_with_payload","symbolLocation":9,"imageIndex":0},{"imageOffset":42515,"symbol":"dyld4::halt(char const*)","symbolLocation":375,"imageIndex":0},{"imageOffset":25949,"symbol":"dyld4::prepare(dyld4::APIs&, dyld3::MachOAnalyzer const*)","symbolLocation":3955,"imageIndex":0},{"imageOffset":21684,"symbol":"start","symbolLocation":388,"imageIndex":0}]}],
  "usedImages" : [
  {
    "source" : "P",
    "arch" : "x86_64",
    "base" : 4475731968,
    "size" : 442368,
    "uuid" : "cef5a27a-d50b-3020-af03-1734b19bc8c5",
    "path" : "\/usr\/lib\/dyld",
    "name" : "dyld"
  }
],
  "sharedCache" : {
  "base" : 140703484620800,
  "size" : 15216738304,
  "uuid" : "40432a03-88d3-305f-9c0c-e7549e71d927"
},
  "vmSummary" : "ReadOnly portion of Libraries: Total=652K resident=0K(0%) swapped_out_or_unallocated=652K(100%)\nWritable regions: Total=9220K written=0K(0%) resident=0K(0%) swapped_out=0K(0%) unallocated=9220K(100%)\n\n                                VIRTUAL   REGION \nREGION TYPE                        SIZE    COUNT (non-coalesced) \n===========                     =======  ======= \nSTACK GUARD                       56.0M        1 \nStack                             8192K        1 \nVM_ALLOCATE                         12K        3 \n__DATA                              20K        2 \n__DATA_CONST                        80K        1 \n__LINKEDIT                         240K        4 \n__TEXT                             436K        2 \ndyld private memory               1024K        1 \n===========                     =======  ======= \nTOTAL                             65.8M       15 \n",
  "legacyInfo" : {
  "threadTriggered" : {

  }
},
  "trialInfo" : {
  "rollouts" : [
    {
      "rolloutId" : "60da5e84ab0ca017dace9abf",
      "factorPackIds" : {

      },
      "deploymentId" : 240000008
    },
    {
      "rolloutId" : "607844aa04477260f58a8077",
      "factorPackIds" : {
        "SIRI_MORPHUN_ASSETS" : "6103050cbfe6dc472e1c982a"
      },
      "deploymentId" : 240000066
    },
    {
      "rolloutId" : "602ad4dac86151000cf27e46",
      "factorPackIds" : {
        "SIRI_DICTATION_ASSETS" : "6193d03f2171a2330e561dfc"
      },
      "deploymentId" : 240000303
    },
    {
      "rolloutId" : "601d9415f79519000ccd4b69",
      "factorPackIds" : {
        "SIRI_TEXT_TO_SPEECH" : "621d4d0f680160486b9e1c98"
      },
      "deploymentId" : 240000416
    },
    {
      "rolloutId" : "60356660bbe37970735c5624",
      "factorPackIds" : {

      },
      "deploymentId" : 240000027
    },
    {
      "rolloutId" : "5ffde50ce2aacd000d47a95f",
      "factorPackIds" : {

      },
      "deploymentId" : 240000128
    },
    {
      "rolloutId" : "5fb4245a1bbfe8005e33a1e1",
      "factorPackIds" : {

      },
      "deploymentId" : 240000014
    },
    {
      "rolloutId" : "5fc94383418129005b4e9ae0",
      "factorPackIds" : {

      },
      "deploymentId" : 240000313
    }
  ],
  "experiments" : [

  ]
}
}

Model: MacBookPro15,2, BootROM 1715.60.5.0.0 (iBridge: 19.16.10647.0.0,0), 4 processors, Quad-Core Intel Core i5, 2,4 GHz, 16 GB, SMC 
Graphics: Intel Iris Plus Graphics 655, Intel Iris Plus Graphics 655, Built-In
Display: Color LCD, 2560 x 1600 Retina, Main, MirrorOff, Online
Memory Module: BANK 0/ChannelA-DIMM0, 8 GB, LPDDR3, 2133 MHz, Samsung, K4EBE304EC-EGCG
Memory Module: BANK 2/ChannelB-DIMM0, 8 GB, LPDDR3, 2133 MHz, Samsung, K4EBE304EC-EGCG
AirPort: spairport_wireless_card_type_wifi (0x14E4, 0x7BF), wl0: Jul 12 2021 19:26:30 version 9.30.464.0.32.5.76 FWID 01-45ccefcd
Bluetooth: Version (null), 0 services, 0 devices, 0 incoming serial ports
Network Service: Wi-Fi, AirPort, en0
USB Device: USB31Bus
USB Device: T2Bus
USB Device: Touch Bar Backlight
USB Device: Touch Bar Display
USB Device: Apple Internal Keyboard / Trackpad
USB Device: Headset
USB Device: Ambient Light Sensor
USB Device: FaceTime HD Camera (Built-in)
USB Device: Apple T2 Controller
Thunderbolt Bus: MacBook Pro, Apple Inc., 47.5
Thunderbolt Bus: MacBook Pro, Apple Inc., 47.5

What is the motivation / use case for changing the behavior?

Please tell us about your environment:

Other information (e.g. related issues, suggestions how to fix, links for us to have context)

If you are wondering why I am not using jpackage, there is a strong reason for it. I have been banging my head around about a month but the application after having installed from the DMG built by jpackage cannot be opened at all. It can only be opened if I start the application from command line. But it works perfectly if I use JavaPackager. That's why I had to switch to JavaPacakger once again.

fvarrui commented 2 years ago

Hi @amitjoy! Please, could you try to run your app from the command line and tell me what happens? Run next command directly from the Terminal: /Applications/OSGi.fx.app/Contents/MacOS/universalJavaApplicationStub

I hope you don't mind, but I've taken the liberty of looking at your project's build.gradle (I guess I looked right) and found the following:

https://github.com/amitjoy/osgifx/blob/b63d8217fc728a9758fff4fab06c3a0bb54cc412/com.osgifx.console.dist/build.gradle#L17-L43

AFAIK, next line in your config is bundling a JDK with your app:

https://github.com/amitjoy/osgifx/blob/b63d8217fc728a9758fff4fab06c3a0bb54cc412/com.osgifx.console.dist/build.gradle#L28

Why don't you let JavaPackager to generate a JRE for your app removing this property?

fvarrui commented 2 years ago

Please, could you try to run your app from the command line and tell me what happens? Run next command directly from the Terminal: /Applications/OSGi.fx.app/Contents/MacOS/universalJavaApplicationStub

If this step doesn't throw any light, try to inspect syslog with Console.app, please. universalJavaApplicationStub logs failures and other info there.

amitjoy commented 2 years ago

@fvarrui Thanks a lot for your quick response. I tried to run the application from command line and surprisingly it works perfectly. The application starts as usual but when I double click on the application icon, it doesn't work.

By the way, I have removed the line jrePath property from the configuration as you suggested to let javapackager generate a JRE.

amitjoy commented 2 years ago

When starting the application by double clicking on it, the following syslog got generated:

Library Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' (Team ID: none, platform: no) for process 'java(18638)' (Team ID: none, platform: no), reason: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)

I think this is why the application couldn't be started

amitjoy commented 2 years ago

The following contains all the syslogs while opening the application by double clicking on it:

default16:23:08.886848+0200lsd- 45683955: Checking whether application is managed at file:///Applications/OSGi.fx.app//com.osgifx
default16:23:08.925782+0200dmdReceived xpc stream event (distributed notification matching) with name: com.apple.LaunchServices.applicationRegistered user info: {
    CFBundleDisplayName = "OSGi.fx";
    bundleIDs =     (
        "com.osgifx"
    );
    isPlaceholder = 0;
}
default16:23:08.956732+0200loginwindow-[PersistentAppsSupport applicationReady:] | App: OSGi.fx, ready, updating active tracking timer
default16:23:08.956868+0200loginwindow-[ApplicationManager checkInAppContext:eventData:] | ApplicationManager: Checked in app : OSGi.fx
default16:23:08.996611+0200runningboarddAcquiring assertion targeting [app<application.com.osgifx.65003644.65003654(503)>:4311] from originator [daemon<com.apple.coreservices.appleevents(55)>:396] with description <RBSAssertionDescriptor| "AE/OSGi.fx" ID:183-396-2320 target:4311 attributes:[
<RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"LSNotification" sourceEnvironment:"(null)">
]>
default16:23:09.912554+0200syslog[4311][universalJavaApplicationStub] [StubDir] /Applications/OSGi.fx.app/Contents/MacOS
default16:23:09.944993+0200syslog[4311][OSGi.fx] [PlistStyle] Apple
default16:23:10.067277+0200syslog[4311][OSGi.fx] [JavaRequirement] JVM minimum version:
default16:23:10.074940+0200syslog[4311][OSGi.fx] [JavaRequirement] JVM maximum version:
default16:23:10.084086+0200syslog[4311][OSGi.fx] [LanguageSearch] Checking preferred languages in macOS System Preferences...
default16:23:10.114979+0200syslog[4311][OSGi.fx] [LanguageSearch] ... found [en-IN de-DE]
default16:23:10.122754+0200syslog[4311][OSGi.fx] [LanguageSearch] ... selected 'en-IN' ('en') as the default language for the launcher stub
default16:23:10.130395+0200syslog[4311][OSGi.fx] [Language] en
default16:23:10.343471+0200syslog[4311][OSGi.fx] [JavaSearch] Checking for $JAVA_HOME ...
default16:23:10.353478+0200syslog[4311][OSGi.fx] [JavaSearch] ... found JAVA_HOME with value Contents/PlugIns/jre/Contents/Home
default16:23:10.363291+0200syslog[4311][OSGi.fx] [JavaSearch] ... parsing JAVA_HOME as relative path inside the App bundle to the executable '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java'
default16:23:10.366272+0200kernelAMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java' is adhoc signed.
default16:23:10.368720+0200amfid/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java signature not valid: -67050
default16:23:10.371519+0200kernelAMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' is adhoc signed.
default16:23:10.373343+0200amfid/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib signature not valid: -67050
error16:23:10.375098+0200kernelLibrary Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' (Team ID: none, platform: no) for process 'java(4419)' (Team ID: none, platform: no), reason: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
error16:23:10.377342+0200kernelLibrary Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' (Team ID: none, platform: no) for process 'java(4419)' (Team ID: none, platform: no), reason: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
default16:23:10.383965+0200ReportCrashASI found [dyld] (sensitive) 'Library not loaded: @rpath/libjli.dylib
  Referenced from: /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java
  Reason: tried: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not <…>'
default16:23:10.394217+0200syslog[4311][OSGi.fx] [JavaCommand] '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java'
error16:23:10.402374+0200kernelLibrary Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' (Team ID: none, platform: no) for process 'java(4432)' (Team ID: none, platform: no), reason: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
error16:23:10.404797+0200kernelLibrary Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' (Team ID: none, platform: no) for process 'java(4432)' (Team ID: none, platform: no), reason: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
default16:23:10.409733+0200ReportCrashASI found [dyld] (sensitive) 'Library not loaded: @rpath/libjli.dylib
  Referenced from: /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java
  Reason: tried: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not <…>'
default16:23:10.415621+0200syslog[4311][OSGi.fx] [JavaVersion]  / 00000000
default16:23:10.425241+0200syslog[4311][OSGi.fx] [WorkingDirectory] /Applications/OSGi.fx.app/Contents/Resources
default16:23:10.434927+0200syslog[4311][OSGi.fx] [Exec] "/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java" -cp ".:Java/osgifx.jar"  -Xdock:icon="/Applications/OSGi.fx.app/Contents/Resources/OSGi.fx.icns" -Xdock:name="OSGi.fx" aQute.launcher.pre.EmbeddedLauncher
error16:23:10.440080+0200kernelLibrary Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' (Team ID: none, platform: no) for process 'java(4311)' (Team ID: none, platform: no), reason: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
error16:23:10.442338+0200kernelLibrary Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' (Team ID: none, platform: no) for process 'java(4311)' (Team ID: none, platform: no), reason: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)
default16:23:10.447000+0200ReportCrashASI found [dyld] (sensitive) 'Library not loaded: @rpath/libjli.dylib
  Referenced from: /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java
  Reason: tried: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not <…>'
default16:23:10.454065+0200loginwindow-[PersistentAppsSupport applicationQuit:] | for app:OSGi.fx, _appTrackingState = 2
default16:23:10.454090+0200loginwindow-[PersistentAppsSupport applicationQuit:] | App: OSGi.fx, quit, updating active tracking timer
fvarrui commented 2 years ago

It seems that the problem is when signing the JRE binaries, so I've been analysing the situation and seen two options (a or b),

a) Set macConfig.codesignApp to false and try again. b) Set macConfig.developerId with a valid Apple Development code sign identity.

I hope it helps!

fvarrui commented 2 years ago

As you said that it stopped working since v1.6.4, I checked the changelog and found this:

https://github.com/fvarrui/JavaPackager/blob/dd2fa512609aaa7020357afa4d6cab9000ab4677/src/main/java/io/github/fvarrui/javapackager/packagers/MacPackager.java#L153-L165

This piece of code include "hardened codesign" (--options runtime) when codesigning in order to the app can be notirized. Maybe this change breaks your app. I'm going to remove this change in issue-185 branch ASAP, so you can install the plugin manully to your local repo and test it. I'll let you know when it's done.

amitjoy commented 2 years ago

I have diabled code signing by setting macConfig.codesignApp property to false. Now, the app appears on the dock and keeps jumping up and down. The Ui just never shows up.

fvarrui commented 2 years ago

Try to run it again from command line, please

fvarrui commented 2 years ago

I've added a new boolean property macConfig.hardededCodesign and released changes to issue-185 branch. If it's set to false, hardened codesiging is skipped. You have to install JavaPackager manually to your local repo. Please, package your app with this version (1.6.7-SNAPSHOT) and give me some feedback!

amitjoy commented 2 years ago

I have built the 1.6.7-SNAPSHOT version to give it a go. The application appears on the dock but keeps on jumping up and down on the dock. The UI doesn't appear at all.

The following contains the syslogs:

default 20:24:58.242970+0200    lsd - 45683955: Checking whether application is managed at file:///Applications/OSGi.fx.app//com.osgifx
default 20:24:58.245740+0200    lsd com.osgifx:5:5:1:1:Building bundle record for app
default 20:24:58.245908+0200    lsd com.osgifx:5:5:2:1:Built bundle record for app
default 20:24:58.251550+0200    lsd com.osgifx:5:4:2:1:_LSServerRegisterItemInfo result = 0
default 20:24:58.263714+0200    runningboardd   Launch request for app<application.com.osgifx.65048374.65048384(503)> is using uid 503 (divined from auid 503 euid 503)
default 20:24:58.263797+0200    runningboardd   Acquiring assertion targeting app<application.com.osgifx.65048374.65048384(503)> from originator [daemon<com.apple.Dock.agent(503)>:517] with description <RBSAssertionDescriptor| "LS launch com.osgifx" ID:185-517-3883 target:app<application.com.osgifx.65048374.65048384(503)> attributes:[
    <RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"LaunchRoleUserInteractive" sourceEnvironment:"(null)">
    ]>
default 20:24:58.263885+0200    runningboardd   Assertion 185-517-3883 (target:app<application.com.osgifx.65048374.65048384(503)>) will be created as active
default 20:24:58.264049+0200    runningboardd   Executing launch request for app<application.com.osgifx.65048374.65048384(503)> (LS launch com.osgifx)
default 20:24:58.264092+0200    runningboardd   Creating and launching job for: app<application.com.osgifx.65048374.65048384(503)>
default 20:24:58.264116+0200    runningboardd   _mutateContextIfNeeded called for com.osgifx
default 20:24:58.273941+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] This process will not be managed.
default 20:24:58.273969+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] HOME is <private>
default 20:24:58.273988+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] TMPDIR is <private>
default 20:24:58.274008+0200    runningboardd   Now tracking process: [app<application.com.osgifx.65048374.65048384(503)>:5500]
default 20:24:58.274086+0200    runningboardd   Using default underlying assertion for app: [app<application.com.osgifx.65048374.65048384(503)>:5500]
default 20:24:58.274106+0200    runningboardd   Calculated state for app<application.com.osgifx.65048374.65048384(503)>: running-active (role: UserInteractive)
default 20:24:58.274207+0200    runningboardd   Acquiring assertion targeting [app<application.com.osgifx.65048374.65048384(503)>:5500] from originator [app<application.com.osgifx.65048374.65048384(503)>:5500] with description <RBSAssertionDescriptor| "RB Underlying Assertion" ID:185-185-3884 target:5500 attributes:[
    <RBSDomainAttribute| domain:"com.apple.underlying" name:"defaultUnderlyingAppAssertion" sourceEnvironment:"(null)">,
    <RBSAcquisitionCompletionAttribute| policy:AfterApplication>
    ]>
default 20:24:58.274353+0200    runningboardd   Assertion 185-185-3884 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500]) will be created as active
default 20:24:58.274534+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring jetsam update because this process is not memory-managed
default 20:24:58.274569+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring suspend because this process is not lifecycle managed
default 20:24:58.274753+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Set darwin role to: UserInteractive
default 20:24:58.274920+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring GPU update because this process is not GPU managed
default 20:24:58.275520+0200    runningboardd   Calculated state for app<application.com.osgifx.65048374.65048384(503)>: running-active (role: UserInteractive)
default 20:24:58.275973+0200    runningboardd   Acquiring assertion targeting [app<application.com.osgifx.65048374.65048384(503)>:5500] from originator [daemon<com.apple.coreservices.launchservicesd>:136] with description <RBSAssertionDescriptor| "foregroundApp:5500" ID:185-136-3885 target:5500 attributes:[
    <RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"RoleUserInteractiveNonFocal" sourceEnvironment:"(null)">
    ]>
default 20:24:58.276083+0200    runningboardd   Assertion 185-136-3885 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500]) will be created as active
default 20:24:58.276839+0200    runningboardd   Calculated state for app<application.com.osgifx.65048374.65048384(503)>: running-active (role: UserInteractive)
default 20:24:58.276874+0200    runningboardd   Acquiring assertion targeting [app<application.com.osgifx.65048374.65048384(503)>:5500] from originator [daemon<com.apple.coreservices.launchservicesd>:136] with description <RBSAssertionDescriptor| "foregroundApp:5500" ID:185-136-3886 target:5500 attributes:[
    <RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"RoleUserInteractiveNonFocal" sourceEnvironment:"(null)">
    ]>
default 20:24:58.277163+0200    runningboardd   Assertion 185-136-3886 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500]) will be created as active
default 20:24:58.278296+0200    loginwindow -[PersistentAppsSupport applicationReady:] | App: OSGi.fx, ready, updating active tracking timer
default 20:24:58.278378+0200    loginwindow -[ApplicationManager checkInAppContext:eventData:] | ApplicationManager: Checked in app : OSGi.fx
default 20:24:58.278688+0200    runningboardd   Invalidating assertion 185-136-3885 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500]) from originator [daemon<com.apple.coreservices.launchservicesd>:136]
default 20:24:58.279512+0200    runningboardd   Acquiring assertion targeting [app<application.com.osgifx.65048374.65048384(503)>:5500] from originator [daemon<com.apple.coreservices.launchservicesd>:136] with description <RBSAssertionDescriptor| "foregroundApp:5500" ID:185-136-3887 target:5500 attributes:[
    <RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"RoleUserInteractiveNonFocal" sourceEnvironment:"(null)">
    ]>
default 20:24:58.279684+0200    runningboardd   Assertion 185-136-3887 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500]) will be created as active
default 20:24:58.280190+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] reported to RB as running
default 20:24:58.281291+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring jetsam update because this process is not memory-managed
default 20:24:58.281546+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring suspend because this process is not lifecycle managed
default 20:24:58.281754+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring GPU update because this process is not GPU managed
default 20:24:58.281796+0200    runningboardd   Invalidating assertion 185-136-3886 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500]) from originator [daemon<com.apple.coreservices.launchservicesd>:136]
default 20:24:58.282407+0200    runningboardd   Successfully acquired underlying assertion for [app<application.com.osgifx.65048374.65048384(503)>:5500]
default 20:24:58.282512+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring jetsam update because this process is not memory-managed
default 20:24:58.282773+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring suspend because this process is not lifecycle managed
default 20:24:58.282979+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring GPU update because this process is not GPU managed
default 20:24:58.285739+0200    distnoted   register name: com.apple.sharedfilelist.change object: com.apple.LSSharedFileList.ApplicationRecentDocuments/com.osgifx token: 710000003d pid: 517
default 20:24:58.297911+0200    runningboardd   Acquiring assertion targeting [app<application.com.osgifx.65048374.65048384(503)>:5500] from originator [daemon<com.apple.coreservices.appleevents(55)>:398] with description <RBSAssertionDescriptor| "AE/OSGi.fx" ID:185-398-3888 target:5500 attributes:[
    <RBSDomainAttribute| domain:"com.apple.launchservicesd" name:"LSNotification" sourceEnvironment:"(null)">
    ]>
default 20:24:58.298019+0200    runningboardd   Assertion 185-398-3888 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500]) will be created as active
default 20:24:58.298468+0200    runningboardd   Calculated state for app<application.com.osgifx.65048374.65048384(503)>: running-active (role: UserInteractive)
default 20:24:58.298481+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring jetsam update because this process is not memory-managed
default 20:24:58.298926+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring suspend because this process is not lifecycle managed
default 20:24:58.299072+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring GPU update because this process is not GPU managed
default 20:24:58.299154+0200    Dock    LAUNCH: 0x0-0xa60a6 com.osgifx starting stopped process.
default 20:24:58.300772+0200    runningboardd   Invalidating assertion 185-517-3883 (target:app<application.com.osgifx.65048374.65048384(503)>) from originator [daemon<com.apple.Dock.agent(503)>:517]
default 20:24:58.326953+0200    dmd Received xpc stream event (distributed notification matching) with name: com.apple.LaunchServices.applicationRegistered user info: {
    CFBundleDisplayName = "OSGi.fx";
    bundleIDs =     (
        "com.osgifx"
    );
    isPlaceholder = 0;
}
default 20:24:58.402319+0200    runningboardd   Calculated state for app<application.com.osgifx.65048374.65048384(503)>: running-active (role: UserInteractiveNonFocal)
default 20:24:58.402378+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring jetsam update because this process is not memory-managed
default 20:24:58.402535+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring suspend because this process is not lifecycle managed
default 20:24:58.402678+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Set darwin role to: UserInteractiveNonFocal
default 20:24:58.402812+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring GPU update because this process is not GPU managed
default 20:24:59.065574+0200    syspolicyd  GK evaluateScanResult: 2, PST: (vuid: 2C791C77-22C7-42FC-9185-B7BB52D6A633), (objid: 65048374), (team: (null)), (id: com.osgifx), (bundle_id: com.osgifx), 0, 0, 1, 0, 0, 0
default 20:24:59.093344+0200    syslog  [5500][universalJavaApplicationStub] [StubDir] /Applications/OSGi.fx.app/Contents/MacOS
default 20:24:59.121526+0200    syslog  [5500][OSGi.fx] [PlistStyle] Apple
default 20:24:59.261023+0200    syslog  [5500][OSGi.fx] [JavaRequirement] JVM minimum version:
default 20:24:59.269349+0200    syslog  [5500][OSGi.fx] [JavaRequirement] JVM maximum version:
default 20:24:59.277378+0200    syslog  [5500][OSGi.fx] [LanguageSearch] Checking preferred languages in macOS System Preferences...
default 20:24:59.303420+0200    syslog  [5500][OSGi.fx] [LanguageSearch] ... found [en-IN de-DE]
default 20:24:59.311466+0200    syslog  [5500][OSGi.fx] [LanguageSearch] ... selected 'en-IN' ('en') as the default language for the launcher stub
default 20:24:59.319833+0200    syslog  [5500][OSGi.fx] [Language] en
default 20:24:59.692791+0200    syslog  [5500][OSGi.fx] [JavaSearch] Checking for $JAVA_HOME ...
default 20:24:59.701406+0200    syslog  [5500][OSGi.fx] [JavaSearch] ... found JAVA_HOME with value Contents/PlugIns/jre/Contents/Home
default 20:24:59.709218+0200    syslog  [5500][OSGi.fx] [JavaSearch] ... parsing JAVA_HOME as relative path inside the App bundle to the executable '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java'
default 20:24:59.712863+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java' is adhoc signed.
default 20:24:59.714838+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java signature not valid: -67050
default 20:24:59.717479+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' is adhoc signed.
default 20:24:59.719440+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib signature not valid: -67050
default 20:24:59.728009+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/server/libjvm.dylib' is adhoc signed.
default 20:24:59.731336+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/server/libjvm.dylib signature not valid: -67050
default 20:24:59.750796+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjimage.dylib' is adhoc signed.
default 20:24:59.752429+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjimage.dylib signature not valid: -67050
default 20:24:59.759016+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjava.dylib' is adhoc signed.
default 20:24:59.760796+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjava.dylib signature not valid: -67050
default 20:24:59.767546+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libzip.dylib' is adhoc signed.
default 20:24:59.769325+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libzip.dylib signature not valid: -67050
default 20:24:59.844872+0200    syslog  [5500][OSGi.fx] [JavaCommand] '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java'
default 20:24:59.933367+0200    syslog  [5500][OSGi.fx] [JavaVersion] 17.0.2 / 17000002
default 20:24:59.941700+0200    syslog  [5500][OSGi.fx] [WorkingDirectory] /Applications/OSGi.fx.app/Contents/Resources
default 20:24:59.949352+0200    syslog  [5500][OSGi.fx] [Exec] "/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java" -cp ".:Java/osgifx.jar"  -Xdock:icon="/Applications/OSGi.fx.app/Contents/Resources/OSGi.fx.icns" -Xdock:name="OSGi.fx" aQute.launcher.pre.EmbeddedLauncher
default 20:25:00.030797+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnio.dylib' is adhoc signed.
default 20:25:00.032977+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnio.dylib signature not valid: -67050
default 20:25:00.033760+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnet.dylib' is adhoc signed.
default 20:25:00.036076+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnet.dylib signature not valid: -67050
default 20:25:03.280117+0200    loginwindow -[PersistentAppsSupport saveLogoutPersistentState:finalSnapshot:] |      previouslyRunningApps: (
        {
        BackgroundState = 2;
        BundleID = "com.apple.terminal";
        Hide = 0;
        Path = "/System/Applications/Utilities/Terminal.app";
    },
        {
        BackgroundState = 2;
        BundleID = "epp.package.rcp";
        Hide = 0;
        Path = "/Users/amit/eclipse/osgifx/Eclipse.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.apple.safari";
        Hide = 0;
        Path = "/Applications/Safari.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.axosoft.gitkraken";
        Hide = 0;
        Path = "/Applications/GitKraken.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.apple.finder";
        Hide = 0;
        Path = "/System/Library/CoreServices/Finder.app";
    },
        {
        BackgroundState = 3;
        BundleID = "com.culturedcode.thingsmac";
        Hide = 0;
        Path = "/Applications/Things3.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.sublimetext.4";
        Hide = 0;
        Path = "/Applications/Sublime Text.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.apple.console";
        Hide = 0;
        Path = "/System/Applications/Utilities/Console.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.macpaw.cleanmymac4";
        Hide = 0;
        Path = "/Applications/CleanMyMac X.app";
    }
)
default 20:25:03.287349+0200    loginwindow -[PersistentAppsSupport saveLogoutPersistentState:finalSnapshot:] |           Contents:(
        {
        BackgroundState = 2;
        BundleID = "com.apple.console";
        Hide = 0;
        Path = "/System/Applications/Utilities/Console.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.apple.terminal";
        Hide = 0;
        Path = "/System/Applications/Utilities/Terminal.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.apple.finder";
        Hide = 0;
        Path = "/System/Library/CoreServices/Finder.app";
    },
        {
        BackgroundState = 2;
        BundleID = "epp.package.rcp";
        Hide = 0;
        Path = "/Users/amit/eclipse/osgifx/Eclipse.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.apple.safari";
        Hide = 0;
        Path = "/Applications/Safari.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.sublimetext.4";
        Hide = 0;
        Path = "/Applications/Sublime Text.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.axosoft.gitkraken";
        Hide = 0;
        Path = "/Applications/GitKraken.app";
    },
        {
        BackgroundState = 3;
        BundleID = "com.culturedcode.thingsmac";
        Hide = 0;
        Path = "/Applications/Things3.app";
    },
        {
        BackgroundState = 2;
        BundleID = "com.macpaw.cleanmymac4";
        Hide = 0;
        Path = "/Applications/CleanMyMac X.app";
    }
)
default 20:25:03.659006+0200    runningboardd   Assertion did invalidate due to timeout: 185-185-3884 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500])
default 20:25:03.659148+0200    runningboardd   Assertion did invalidate due to timeout: 185-398-3888 (target:[app<application.com.osgifx.65048374.65048384(503)>:5500])
default 20:25:03.770951+0200    runningboardd   Calculated state for app<application.com.osgifx.65048374.65048384(503)>: running-active (role: UserInteractiveNonFocal)
default 20:25:03.770982+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring jetsam update because this process is not memory-managed
default 20:25:03.771040+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring suspend because this process is not lifecycle managed
default 20:25:03.771094+0200    runningboardd   [app<application.com.osgifx.65048374.65048384(503)>:5500] Ignoring GPU update because this process is not GPU managed
default 20:25:05.159359+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libverify.dylib' is adhoc signed.
default 20:25:05.161556+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libverify.dylib signature not valid: -67050
fvarrui commented 2 years ago

I've filtered your syslog output:

default 20:24:59.093344+0200    syslog  [5500][universalJavaApplicationStub] [StubDir] /Applications/OSGi.fx.app/Contents/MacOS
default 20:24:59.121526+0200    syslog  [5500][OSGi.fx] [PlistStyle] Apple
default 20:24:59.261023+0200    syslog  [5500][OSGi.fx] [JavaRequirement] JVM minimum version:
default 20:24:59.269349+0200    syslog  [5500][OSGi.fx] [JavaRequirement] JVM maximum version:
default 20:24:59.277378+0200    syslog  [5500][OSGi.fx] [LanguageSearch] Checking preferred languages in macOS System Preferences...
default 20:24:59.303420+0200    syslog  [5500][OSGi.fx] [LanguageSearch] ... found [en-IN de-DE]
default 20:24:59.311466+0200    syslog  [5500][OSGi.fx] [LanguageSearch] ... selected 'en-IN' ('en') as the default language for the launcher stub
default 20:24:59.319833+0200    syslog  [5500][OSGi.fx] [Language] en
default 20:24:59.692791+0200    syslog  [5500][OSGi.fx] [JavaSearch] Checking for $JAVA_HOME ...
default 20:24:59.701406+0200    syslog  [5500][OSGi.fx] [JavaSearch] ... found JAVA_HOME with value Contents/PlugIns/jre/Contents/Home
default 20:24:59.709218+0200    syslog  [5500][OSGi.fx] [JavaSearch] ... parsing JAVA_HOME as relative path inside the App bundle to the executable '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java'
default 20:24:59.712863+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java' is adhoc signed.
default 20:24:59.714838+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java signature not valid: -67050
default 20:24:59.717479+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' is adhoc signed.
default 20:24:59.719440+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib signature not valid: -67050
default 20:24:59.728009+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/server/libjvm.dylib' is adhoc signed.
default 20:24:59.731336+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/server/libjvm.dylib signature not valid: -67050
default 20:24:59.750796+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjimage.dylib' is adhoc signed.
default 20:24:59.752429+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjimage.dylib signature not valid: -67050
default 20:24:59.759016+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjava.dylib' is adhoc signed.
default 20:24:59.760796+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjava.dylib signature not valid: -67050
default 20:24:59.767546+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libzip.dylib' is adhoc signed.
default 20:24:59.769325+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libzip.dylib signature not valid: -67050
default 20:24:59.844872+0200    syslog  [5500][OSGi.fx] [JavaCommand] '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java'
default 20:24:59.933367+0200    syslog  [5500][OSGi.fx] [JavaVersion] 17.0.2 / 17000002
default 20:24:59.941700+0200    syslog  [5500][OSGi.fx] [WorkingDirectory] /Applications/OSGi.fx.app/Contents/Resources
default 20:24:59.949352+0200    syslog  [5500][OSGi.fx] [Exec] "/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java" -cp ".:Java/osgifx.jar"  -Xdock:icon="/Applications/OSGi.fx.app/Contents/Resources/OSGi.fx.icns" -Xdock:name="OSGi.fx" aQute.launcher.pre.EmbeddedLauncher
default 20:25:00.030797+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnio.dylib' is adhoc signed.
default 20:25:00.032977+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnio.dylib signature not valid: -67050
default 20:25:00.033760+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnet.dylib' is adhoc signed.
default 20:25:00.036076+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libnet.dylib signature not valid: -67050
default 20:25:05.159359+0200    kernel  AMFI: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libverify.dylib' is adhoc signed.
default 20:25:05.161556+0200    amfid   /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libverify.dylib signature not valid: -67050

universalJavaApplicationStub seems to be working fine, but your system is reporting that some JRE libraries are not signed. It seems that you can't run your app on your Mac OS if it's not codesigned, so, enable codesigning again.

Are you using any Apple Developer ID to sign your app?

I've got a Mac Mini with Mac OS 10.15 and I'll try your project when arrive at home .... could you give me some instructions in order to build your app, please?

fvarrui commented 2 years ago

Going back to the beginning:

Termination Reason:    Namespace DYLD, Code 1 Library missing
Library not loaded: @rpath/libjli.dylib
Referenced from: /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java
Reason: tried: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with cust
(terminated at launch; ignore backtrace)

Application Specific Information:
Library not loaded: @rpath/libjli.dylib
Referenced from: /Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/java
Reason: tried: '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/./libjli.dylib' (no such file), '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/bin/../lib/libjli.dylib' (code signature in <366E8331-0250-383A-B5D7-C02420BA71E5> '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' not valid for use in process: mapped file has no Team ID and is not a platform binary (signed with cust

I'm not an expert, but maybe you need to disable security checks on your Mac OS to run your app, or you should sign and notarize it.

One question; you said that JavaPackager 1.6.3 worked fine for you ... did you use it on the same system? same Mac OS version? Or have you upgraded your system and then you upgrade JavaPackager from 1.6.3 to 1.6.4/.5?

amitjoy commented 2 years ago

@fvarrui Thanks a lot for your continuous support. Since macOS Moneterey, the code signing is required as a mandatory step which makes macOS application distribution pretty difficult. Apart from that, code signing is automatically enabled due to my system policy as it is configured by the system admin. That's why code signing cannot be disabled. That's a pain right now.

The last successful test I could perform was on 1.6.2 which can generate macOS and linux artifacts pretty easily but in case of windows (if built using Java 17) encounters ExceptionInInitializerError and that's why I updated to 1.6.5 as a first step and then the builds succeed even for windows but the built macOS artifact doesn't work. I downgraded to 1.6.4 and the behaviour is the same. I downgraded once again and then it worked only once for 1.6.3. Yesterday I tried quite a lot of times with 1.6.3 and unfortunately it didn't work at all. And the most funny part is that, it doesn't work for 1.6.2 anymore since yesterday.

fvarrui commented 2 years ago

It's quite puzzling. I'm sorry I can't help you more, but I don't have a latest generation Mac and I don't have an Apple developer certificate, which costs €99 per year.

So, I guess you are not codesigning and notarizing your app with a valid Apple Developer cert and maybe this is the problem.

I'm going to ask to another JavaPackager user which had a successful story with it. Maybe he could provide us a step by step guide.

AstroPixelProcessor commented 2 years ago

Hi @fvarrui and @amitjoy ,

@amitjoy , can your issue be fixed with the following:

1) do code sign with hardened runtime 2) add the following runtime exceptions entitlements to your entitlements file from: https://developer.apple.com/documentation/security/hardened_runtime

so an example entitlements.plist file would look:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.disable-executable-page-protection</key>
    <true/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
</dict>
</plist>

Notice the last one, disable library validation and compare to your initial error of:

Library Validation failed: Rejecting '/Applications/OSGi.fx.app/Contents/PlugIns/jre/Contents/Home/lib/libjli.dylib' 
(Team ID: none, platform: no) for process 'java(18638)' (Team ID: none, platform: no), reason: 
mapped file has no Team ID and is not a platform binary (signed with custom identity or adhoc?)

And you need to check if the JDK that you use is properly signed I think. Old JDKs can be problem maybe?

Hope this solves it for you?

fvarrui commented 2 years ago

Thanks so much Mabula!!!

EasyG0ing1 commented 2 years ago

@amitjoy - I'll take issue with your statement

Since macOS Moneterey, the code signing is required as a mandatory step which makes macOS application distribution pretty difficult.

I've successfully compiled and run MacOS Java apps that run fine without any code signing ... I've tested the .app files with a clean install of Monterey 12.3 in a virtual machine and the app was built and compiled using the latest Java version 18.

AstroPixelProcessor commented 2 years ago

@EasyG0ing1 , but..., without code signing (and notarization), your application will never pass the macOS gatekeeper, on latest macOS versions, without telling the user that the software is not safe to use... The user then has to manually approve it in security and privacy settings to get it to run... (which many users struggle with I know for a fact.)

So yes, it can still run and work, but it will not give the users of your software a good install experience nor cofirm to the user that your package installation is mature, would you not agree?

EasyG0ing1 commented 2 years ago

@fvarrui - Agreed... but the more I think about it, the only way I was able to get a packaged Java program to run on a machine without a JDK or JRE installed, was to install a JDK or a JRE, then it would run just fine ... but now I'm thinking that the reason why it would run, is because it defaulted to use those Java libraries which ARE code signed and were installed and approved for use ... so the program is basically just "piggybacking" off of previously authorized code... so I spoke too soon on this topic, as it seems that @amitjoy is correct, there is no way to run software that is not signed on Monterey.

amitjoy commented 2 years ago

Thanks a lot everyone for taking up the issue. I believe to ensure that the app runs everywhere including Monterey, I have to sign and notarize the application.

EasyG0ing1 commented 2 years ago

@amitjoy - I was able to get my app to run on a Mac that has no JRE, WITHOUT signing it, simply by putting the file entitlements.plist in the same folder as my POM file, then adding this line to the mac portion of my execution:

<entitlements>entitlements.plist</entitlements>

... using version 1.6.6 of JavaPackager.

Here is entitlements.plist

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    <key>com.apple.security.cs.allow-jit</key>
    <true/>
    <key>com.apple.security.cs.allow-unsigned-executable-memory</key>
    <true/>
    <key>com.apple.security.cs.disable-executable-page-protection</key>
    <true/>
    <key>com.apple.security.cs.allow-dyld-environment-variables</key>
    <true/>
    <key>com.apple.security.cs.disable-library-validation</key>
    <true/>
</dict>
</plist>

And here is what my Javapackager config looks like in my POM file:

<plugin>
    <groupId>io.github.fvarrui</groupId>
    <artifactId>javapackager</artifactId>
    <version>1.6.6</version>
    <configuration>
        <mainClass>${exec.mainClass}</mainClass>
        <bundleJre>true</bundleJre>
        <customizedJre>false</customizedJre>
        <generateInstaller>true</generateInstaller>
        <administratorRequired>false</administratorRequired>
    </configuration>
    <executions>
        <execution>
            <id>windows</id>
            <phase>package</phase>
            <goals>
                <goal>package</goal>
            </goals>
            <configuration>
                <platform>auto</platform>
                <createZipball>false</createZipball>
                <createTarball>true</createTarball>
                <macConfig>
                    <icnsFile>/Users/michael/IdeaProjects/GistFX/src/main/resources/com/redmondsims/gistfx/Assets/mac/GistFX.icns</icnsFile>
                    <generateDmg>true</generateDmg>
                    <generatePkg>false</generatePkg>
                    <volumeName>GistFX</volumeName>
                    <volumeIcon>/Users/michael/IdeaProjects/GistFX/src/main/resources/com/redmondsims/gistfx/Assets/mac/GistFX.icns</volumeIcon>
                    <entitlements>entitlements.plist</entitlements>
                </macConfig>
            </configuration>
        </execution>
    </executions>
</plugin>

I did have a module-info.java file in my project, but I had to remove it to get things to work correctly, but I'm going to see if I can re-integrate it just out of curiosity to see if the size of the compiled code is any different, since that is one of the biggest selling points of modularity ... efficiency and granular control over what gets thrown into the soup ... as it were ☺

fvarrui commented 2 years ago

Including a module-info.java has nothing to do with JavaPackager, as it only provides strong encapsulation, so you can't access classes which are not specifically exported, being checked by the JVM at runtime. JavaPackager copies all dependencies to your app and then analyzes them using jdeps tool in order to know which core modules are required. Some dependencies are modularized, and some others aren't (those are called automatic modules), which usually causes a module not found exception. Then, with those core modules, it generates a customized and reduced JRE using jlink. That was the idea, but this dependency analysis process has to be improved, as jdeps is not working as I expected.

fvarrui commented 2 years ago

So, when jdeps fails or doesn't work fine, we have to include all core modules in the generated JRE, losing the possibility to bundle a reduced JRE for distribution. Or specify one by one in which core modules our app depends on, and its dependencies, and dependencies of its dependencies, and .... the same recursively (for transitive dependencies)

fvarrui commented 2 years ago

Branch issue-185 merged into devel (included macConfig.hardenedCodesigning property)

EasyG0ing1 commented 2 years ago

@fvarrui - Are you saying that the inclusion of a module-info.java will have no impact one way or the other on the JavaPackager process? Or are you saying that in some circumstances, it may cause it to fail or improperly build a distribution package?

fvarrui commented 2 years ago

Hi @EasyG0ing1! Sorry for my late reply.

Are you saying that the inclusion of a module-info.java will have no impact one way or the other on the JavaPackager process?

Not exactly. I think I didn't explain myself well. JavaPackager analyzes all JARs included with the app (your app JAR and all its dependencies). So, modules required in your module-info.java are also considered when bundling a customized JRE.

Or are you saying that in some circumstances, it may cause it to fail or improperly build a distribution package?

Distribution packages are well built by JavaPackager, but the building process could fail when searching the required modules with jdeps.

Anyway, I think that there are some things in JavaPackager which has to be improved when dealing with modules. For example, after finding required modules, all those which are not core modules should be excluded when running jlink, since the idea is to create a reduced JRE, and keep all the libraries (both modular and non-modular) in the "libs" directory (not included in the JRE). Although perhaps another approach would be that those modular libraries to be part of the JRE and leave the non-modular libraries only in "libs". I'm woking on it!

fvarrui commented 2 years ago

JavaPackager v1.6.7 released to Maven Central. See changes here.