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.
I created a maven based JPA project with persistence.xml in META-INF folder. When I do "clean and build" or "clean", it fails to delete the persistence.xml. I am not able to delete it through windows explore either. I only can delete it when I restart netbeans. Thanks Jia
what do you mean maven based with jpa and persistence? I don't see any atomic action to create this environment, what action was used to produce persistence.xml?
please reopen with more details. I have no problem with create j2se or web maven project create persistece unit with almost a;; defaults select persistence.xml and remove . success
I have the same problem using Netbeans 8.0 on Windows 8.1. When I open Netbeans and "clean" my project it works (one time). All subsequent "clean" or "clean & build" runs fail with the following message: =========== Maven Output =========== Failed to execute goal org.apache.maven.plugins:maven-clean-plugin:2.4.1:clean (default-clean) on project CominottoBackendEJB: Failed to clean project: Failed to delete C:\Users\xxxx\Documents\Projects\Cominotto_MVN\CominottoBackendEJB\target\classes\META-INF\persistence.xml -> [Help 1] ==================================== Even when I try to delete "target\classes\META-INF\persistence.xml" via Windows Explorer while Netbeans is running the file is locked. When I close Netbeans the file gets unlocked and I can manually delete it. As soon as I do one build in Netbeans the file is locked again. What also works is closing Netbeans, restarting it and then do a "clean" (but this works exactly once). Environment: Product Version: NetBeans IDE 8.0 (Build 201403101706) Java: 1.7.0_45; Java HotSpot(TM) 64-Bit Server VM 24.45-b08 Runtime: Java(TM) SE Runtime Environment 1.7.0_45-b18 System: Windows 8 version 6.2 running on amd64; Cp1252; en_GB (nb)
Still can't reproduce, tried web and j2se maven projects with open and closed persistence.xml editor, without deploy to gf4 and after deloy to gf4. With bundled maven. What project type is used? What maven is usedd - bundled or another one? Is server registered in the project, what server, is it started/project deployed? Can you reproduce if create new project and add persistence.xml or it's reproducible with some old complex project only?
What I did was migrating a formerly ant-based project to maven. Therefore I've created the Maven projects with File, New Project, Maven, Enterprise Application. Then I begun to build up dependencies and copy *.java files from the ant project to maven. So there is some complexity in the project. The target server is "JBoss EAP 6.2.0". I use the bundled Maven. The server is registered in the Maven project and all it's modules. Up to now I was not able to reproduce the error when starting a simple new project. But I'll keep on trying.
Created attachment 148125 [details] Maven based project which contains the error
Update: It seems that the problem is somehow related to the Hibernate JPA static metamodel generator. As soon as I have the following dependency in my POM the problem occurs: <dependency> <groupId>org.hibernate</groupId> <artifactId>hibernate-jpamodelgen</artifactId> <version>4.3.5.Final</version> <optional>true</optional> </dependency> If I use the bundled version of Maven outside the Netbeans IDE (on the command line) everything works. So it seems to be somehow related to the combination of Netbeans plus Metamodel generation. I've been able to create a project which triggers the error, see attachment https://netbeans.org/bugzilla/attachment.cgi?id=148125
Outside of nb the entire application which build the project is closed afeter building, it may cause release of file handles, in case of internal execution just some part of code ends and if hibernate modelgen have some problems within, it may case these problems. But I may need additional evaluation.
I dn't kow why but I can't do any action on attached project build/clean/clean&buil just fails silently. project is marked as a project with probles for jbos--ee-api and for jpamodelgen as not present in local repository but I'm not sure it's related. I've tried new maven ejb project and create persistence unit with bundled(since 8.0.1) hibernate 4.3.1, by default modelgen is added, I see static metamodel class is generated after build and I can rebuild without any problem. I do not expect it's smth fixed in dev build, instead I may moss some details, but you can try dev build to verify.
Just tried the uploaded project on a different machine. First I also get the "Resolve Project Problems..." mark, but after doing the first build it is gone (when the dependencies are downloaded). The locking problem is the same, after the first build, the file persistence.xml remains locked and "Clean" fails. I've just downloaded and set-up "NetBeans IDE Build 201407090001". The problem is the same in this version. So unfortunately not fixed in dev-build. The problem does not occur when I use the dev-build version without JaveEE and Maven Enterprise Application Support.
ok, I suppose I need to setup jboss, as I miss it before
After jboss installation, I can build. But also I can rebuild without any problem, an it's possibke with jboss started and stopped/ with deploy on save enabled/disabled.Do you use win7? jdk version? any exceptions in message.log?
spaces in path, local version, os 32/64bit, jdk 32/64 bit?
this - value: java.io.FileInputStream #2 <- in - class: java.io.BufferedInputStream, value: java.io.FileInputStream #2 <- fInputStream - class: com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream, value: java.io.BufferedInputStream #3 <- stream - class: com.sun.xml.internal.stream.Entity$ScannedEntity, value: com.sun.org.apache.xerces.internal.impl.XMLEntityManager$RewindableInputStream #2 <- fCurrentEntity - class: com.sun.org.apache.xerces.internal.impl.XMLEntityScanner, value: com.sun.xml.internal.stream.Entity$ScannedEntity #2 <- fEntityScanner - class: com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl, value: com.sun.org.apache.xerces.internal.impl.XMLEntityScanner #7 <- fTempReader - class: com.sun.xml.internal.stream.XMLInputFactoryImpl, value: com.sun.org.apache.xerces.internal.impl.XMLStreamReaderImpl #1 <- XML_INPUT_FACTORY (JNI global) - class: org.hibernate.jpamodelgen.util.xml.XmlParserHelper, value: com.sun.xml.internal.stream.XMLInputFactoryImpl #2 It's nearest GC root(org.hibernate.jpamodelgen.util.xml.XmlParserHelper) for unclosed FileInpitStream, I'm not sure I can do smth, an least easily, you may need to remove modelgen dependency in case of hibernate. Set to P3 for now as woraround is easier the reload ide each time but may not be very good if you need static metamodel. Another option build should be started in separate vm, but I'm not expert in this approach.
Removing modelgen is not really an option, cause it's needed for the Criteria Query API Queries. Is the root cause in Hibernate's modelgen, or in Netbeans! Would it make sense to open a bug at Hibernate's site?
See provided trace from head dump, XmlParserHelper have static field which seems to keep streams, as it's static, even if there is no instances of XmlParserHelper, it may keep streams open if are not closed properly. In case of external execution all classes are unloaded when jvm is terminated, but not in case if smth is executed from withing another jvm. In my opinion t may have sense to file an issue against hibenrate modelgen.
Oops, sorry I updated wrong issue :) Changing it back.
on other side, it seems to be reproducible with maven projects only, it may mean classes loading may behave a bit different from ant projects and classes unloading may be affected. Martin, do you know anything about this area?
(In reply to Sergey Petrov from comment #18) > on other side, it seems to be reproducible with maven projects only, it may > mean classes loading may behave a bit different from ant projects and > classes unloading may be affected. > Martin, do you know anything about this area? Sorry, not at all. Is there any easy way how to reproduce the issue? I could at least take a look if something comes to my mind.
(In reply to Martin Janicek from comment #19) > Is there any easy way how to reproduce the issue? I could > at least take a look if something comes to my mind. Reproduction should be fairly easy using the attachment "Maven based project which contains the error". Just use Netbeans with EE support enabled.
Ye, I have done that. But I'm able to Build/Clean/Clean&Build how many times I want to and don't see any kind of error. What exact steps caused you the problem?
I have it after the first build. So every goal which involves clean fails after there was one build. Did the modelgen generate the classes for JPA entities in your case (just to be sure that it was invoked)?
yes, I wasn't able to reproduce initially too, if it's reproducible it should fail on second compilation, when 1st compilation was on clean project, if you have 2 successful compilation it will fail never with later attempts (at least in my attempts). also do not forget to register jboss 6.2
(In reply to t3_chris from comment #22) > Did the modelgen generate the classes for JPA entities in your case (just to > be sure that it was invoked)? Yes, it did. (In reply to Sergey Petrov from comment #23) > also do not forget to register jboss 6.2 Ok I haven't done this before. I will give it a try
Sorry, still the same situation. Can't reproduce and thus I'm afraid I can't help either :-/ What comes to my mind is to try to use different version of hibernate-jpamodelgen if you have suspicion that it might caused those problems. It's the easiest way how to find out if the problem is on our side or not.
I suffer the same problem. We have a maven project with several modules. Two modules have a persistence.xml, one of them is consistently locked by netbeans (when it's in the target folder after the build). Luckely I can just remove the jpa model gen dependency since it's not used in that module, which fixes the problem. The problem must be within netbeans since I never had the problem when just doing a maven build command line.
Sometimes this effect occures when netbeans do the "background scaning of projects". After this operation a can clean via Aggregator project.
regarding #26 as I said, usage in an application which is closed after execution will release all file handles even if you have bugs with resource releasing, on other side internal usage may keep these handles, and it's hold by hibernate static field. regarding #27 from quite limited information, it may be also another issue but may be the same.
Same error. Using Win 7 - 64 bits and Java SDK (build 1.7.0_55-b13) - 64 bits Maven is running under proxy. All projects are running well with exception the projects with JPA/Hibernate. I have to restart Netbeans every time. It sucks my day ! I cannot delete the file manually too. Please, at least "Release" the file "persistence.xml" after compilation in order we can delete it manually.
org.hibernate.jpamodelgen.util.xml.XmlParserHelper have static field which after some chain hold open FileInputStream for persistence.xml I would say either it's a bug in hibernate of nb do not support hibernate modelgen(consider if issue may have workaround) sorry, have no time to file corresponding hibernate issue so far
This old bug may not be relevant anymore. If you can still reproduce it in 8.2 development builds please reopen this issue. Thanks for your cooperation, NetBeans IDE 8.2 Release Boss
Hi All. I have the same problem in Netbeans 8.2 To solve I delete this dependency from my pom file. <dependency> <groupId>unknown.binary</groupId> <artifactId>hibernate-jpamodelgen-4.3.1.Final</artifactId> <version>SNAPSHOT</version> <scope>provided</scope> </dependency> Greetings.