This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 226499 - jarsigner: attempt to rename fails - ide seems to lock the file
Summary: jarsigner: attempt to rename fails - ide seems to lock the file
Status: REOPENED
Alias: None
Product: javafx
Classification: Unclassified
Component: Project (show other bugs)
Version: 7.3
Hardware: PC Windows Vista
: P2 normal with 1 vote (vote)
Assignee: Petr Somol
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-02-22 04:56 UTC by sviyer
Modified: 2018-06-30 12:23 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description sviyer 2013-02-22 04:56:14 UTC
I am running both NB7.2 and NB7.3RC on Vista
Using java version "1.7.0_13"
Java(TM) SE Runtime Environment (build 1.7.0_13-b20)
Java HotSpot(TM) Client VM (build 23.7-b01, mixed mode, sharing)

Every now and then (inconsistently) ant build fails with the following error:

Signing JAR: C:\DevFiles\Projects\JavaFX\TB\dist\TB.jar to C:\DevFiles\Projects\JavaFX\TB\dist\TB.jar as nb-jfx
jarsigner: attempt to rename C:\DevFiles\Projects\JavaFX\TB\dist\TB.jar to C:\DevFiles\Projects\JavaFX\TB\dist\TB.jar.orig failed
Enter Passphrase for keystore: Enter key password for nb-jfx: 
C:\DevFiles\Projects\JavaFX\TB\nbproject\jfx-impl.xml:1351: The following error occurred while executing this line:
C:\DevFiles\Projects\JavaFX\TB\nbproject\jfx-impl.xml:2405: The following error occurred while executing this line:
C:\DevFiles\Projects\JavaFX\TB\nbproject\jfx-impl.xml:1686: jarsigner returned: 1
BUILD FAILED (total time: 13 seconds)


This problem is inconsistent but occurs quite frequently during a development session.  Happens in both NB7.2 and NB7.3RC.

Restarting the IDE makes the problem go away.

I am not sure if ant or the IDE is locking the jar file ?
Comment 1 Petr Somol 2013-03-11 10:21:00 UTC
will need to check whether this relates to Issue #150112
Comment 2 Petr Somol 2013-06-04 15:40:16 UTC
I investigated this and the conclusion is as follows.

- roughly a year ago I had experienced the same problem with the then current JDK7 version and NB dev build, later it ceased to manifest itself and I have not observed it since

- now, I tried the following JDKs: 7u14, 7u21, 7u40 and 8b91 on Windows 7 64 SP1 with the current NB dev build. The current dev build contains Ant version 1.9.0. Even after a large number of tests with both small and large projects, single and dependent, I could not reproduce the issue. Additionally I tried it in Ubuntu 12.04 with Ant 1.8.4. also unable to reproduce.

- the IDE does not lock the jar file as the jar does not exist before Ant has created it using the <fx:jar> task. The potential culprit thus could be the <fx:jar> task, but I checked in its source code that it does release its lock when it has created the jar file.

- the search for lock handlers during the build process in the configurations stated above did not reveal anything that would keep the lock at any suspicious moment (although checking this is difficult when the problem does not happen)

From the above, and from the experience that Windows file system suffered lock release delay problems especially in older Windows versions, the conclusion is that the problem most likely follows from the combination of outdated JDK, Ant, and Windows version. As the issue could not be reproduced in the current settings described above, I am closing as worksforme.
Comment 3 js-java 2016-04-15 13:29:43 UTC
Having this issue on a complete new Windows 10 64 Bit system with latest JDK 8 and Netbeans 8.1 fresh installed. No this doesn't look like a problem of out dated releases. Same jar sign ant task was (is) running on a Win 7 system and a slower Win 10 system.
Comment 4 js-java 2016-04-15 13:40:23 UTC
Additional info:

This is working:

<signjar alias="XXXX" verbose="true" jar="${dist.jar}" keypass="XXXXXX" storepass="keypassword" keystore="keystore" preservelastmodified="true" tsaurl="XXXXXX">
</signjar>

But using path sub tag failes (nearly every time with clean & build):

<signjar alias="XXXX" verbose="true" keypass="XXXXX" storepass="keypassword" keystore="keystore" preservelastmodified="true" tsaurl="XXXXXXX">
  <path>
    <fileset file="${dist.jar}">
    </fileset>
  </path>
</signjar>
Comment 5 js-java 2016-04-15 13:44:09 UTC
(In reply to js-java from comment #4)
> Additional info:
> 
> This is working:
> 
> <signjar alias="XXXX" verbose="true" jar="${dist.jar}" keypass="XXXXXX"
> storepass="keypassword" keystore="keystore" preservelastmodified="true"
> tsaurl="XXXXXX">
> </signjar>
> 
> But using path sub tag failes (nearly every time with clean & build):
> 
> <signjar alias="XXXX" verbose="true" keypass="XXXXX" storepass="keypassword"
> keystore="keystore" preservelastmodified="true" tsaurl="XXXXXXX">
>   <path>
>     <fileset file="${dist.jar}">
>     </fileset>
>   </path>
> </signjar>

Well, after several tens of run, both failed.
Comment 6 stmsat 2016-09-19 15:24:53 UTC
This seems to be reproduced with Netbeans 8.1 and java 7u79 and 8u101 when the output jar is also in the classpath.

Simply removing the jars from the classpath is not sufficient; a NBs restart is required. After the restart, the issue is gone.

I could also reproduce the issue by running the ant buildfile from Eclipse, with Netbeans open (and the output jar in the classpath).
Comment 7 freshbiology 2018-06-30 12:23:01 UTC
Hi I am using Netbeans 8.2, Windows 10 x64
I am working on a JavaFX project. I get this error frequently when I try to run the Project.

Enter Passphrase for keystore: Enter key password for nb-jfx: 
E:\files\dev\java\NetBeansProjects\JavaFX\JavaFXSunApp\nbproject\jfx-impl.xml:1487: The following error occurred while executing this line:
E:\files\dev\java\NetBeansProjects\JavaFX\JavaFXSunApp\nbproject\jfx-impl.xml:3009: The following error occurred while executing this line:
E:\files\dev\java\NetBeansProjects\JavaFX\JavaFXSunApp\nbproject\jfx-impl.xml:1981: jarsigner returned: 1
BUILD FAILED (total time: 3 seconds)

First attempt fails. Building again is successful. It mostly happens when I make changes in fxml file. But it has started to happen frequently.