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.
Build: NetBeans IDE Dev (Build 201110100600) VM: Java HotSpot(TM) 64-Bit Server VM, 20.2-b06, Java(TM) SE Runtime Environment, 1.6.0_27-b07 OS: Windows 7 User Comments: sunbiz: Created POJO and Hibernate Mapping Files from database, Run HQL Query on Hibernate configuration file and got this exception Stacktrace: java.lang.ClassCastException: class com.sun.tools.javac.api.JavacTool at java.lang.Class.asSubclass(Class.java:3018) at javax.tools.ToolProvider.getSystemToolClass(ToolProvider.java:165) at javax.tools.ToolProvider.getSystemTool(ToolProvider.java:145) at javax.tools.ToolProvider.getSystemJavaCompiler(ToolProvider.java:102) at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.checkAndCompile(HQLEditorController.java:681) at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.processMatchingClass(HQLEditorController.java:664)
Created attachment 111880 [details] stacktrace
*** Bug 204071 has been marked as a duplicate of this bug. ***
Looks like nb javac issue, as it's just call to ToolProvider.getSystemJavaCompiler(). But feel free to push back for more investigation.
Hm, I would be happier if noone (except java.source) wouldn't use nb-javac for compiling - using the platform's javac should be much safer. But it is currently not possible to use the Java infrastructure and the platform's javac in one module. I guess we need to find a way out from this. In the mean time, a workaround is to wrap the invocation of ToolProvider.getSystemJavaCompiler with: ClassLoader orig = Thread.currentThread().getContextClassLoader(); try { Thread.currentThread().setContextClassLoader(ClasspathInfo.class.getClassLoader()); JavaCompiler tool = ToolProvider.getSystemJavaCompiler(); } finally { Thread.currentThread().setContextClassLoader(orig); } I would recommend using this workaround for 7.1 - it depends on a non-guaranteed implementation detail, but should work, and we will have more time to come up with a real solution. Sorry for the trouble.
Jan, thanks, http://hg.netbeans.org/web-main/rev/e3e13e0a83c0 workaround. do you want this issue to remain open?
(In reply to comment #5) > Jan, thanks, > http://hg.netbeans.org/web-main/rev/e3e13e0a83c0 workaround. Thanks. > > do you want this issue to remain open? Yes, please.
Integrated into 'main-golden' Changeset: http://hg.netbeans.org/main-golden/rev/e3e13e0a83c0 User: Sergey B. Petrov <sj-nb@netbeans.org> Log: #203540 implemet suggested workaround
This bug already has 5 duplicates see http://statistics.netbeans.org/exceptions/detail.do?id=181893
Report from old NetBeans version. Due to code changes since it was reported likely not reproducible now. Feel free to reopen if happens in 8.0.2 or 8.1.