Please use the Apache issue tracking system for new NetBeans issues ( !!
Bug 203540 - [71cat] ClassCastException: class
[71cat] ClassCastException: class
Product: java
Classification: Unclassified
Component: Compiler
All All
: P3 (vote)
Assigned To: Dusan Balek
: 204071 (view as bug list)
Depends on:
  Show dependency treegraph
Reported: 2011-10-11 17:15 UTC by sunbiz
Modified: 2015-09-17 11:25 UTC (History)
1 user (show)

See Also:
Issue Type: DEFECT

stacktrace (802 bytes, text/plain)
2011-10-11 17:15 UTC, sunbiz

Note You need to log in before you can comment on or make changes to this bug.
Description sunbiz 2011-10-11 17:15:46 UTC
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

java.lang.ClassCastException: class
   at java.lang.Class.asSubclass(
   at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.checkAndCompile(
   at org.netbeans.modules.hibernate.hqleditor.HQLEditorController.processMatchingClass(
Comment 1 sunbiz 2011-10-11 17:15:52 UTC
Created attachment 111880 [details]
Comment 2 Sergey Petrov 2011-10-24 11:22:13 UTC
*** Bug 204071 has been marked as a duplicate of this bug. ***
Comment 3 Sergey Petrov 2011-10-25 11:30:38 UTC
Looks like nb javac issue, as it's just call to ToolProvider.getSystemJavaCompiler().
But feel free to push back for more investigation.
Comment 4 Jan Lahoda 2011-11-16 09:28:40 UTC
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 {
            JavaCompiler tool = ToolProvider.getSystemJavaCompiler();
        } finally {

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.
Comment 5 Sergey Petrov 2011-11-16 12:07:21 UTC
Jan, thanks, workaround.

do you want this issue to remain open?
Comment 6 Jan Lahoda 2011-11-16 14:05:55 UTC
(In reply to comment #5)
> Jan, thanks,
> workaround.


> do you want this issue to remain open?

Yes, please.
Comment 7 Quality Engineering 2011-11-17 07:31:17 UTC
Integrated into 'main-golden'
User: Sergey B. Petrov <>
Log: #203540 implemet suggested workaround
Comment 8 Exceptions Reporter 2012-02-14 09:24:59 UTC
This bug already has 5 duplicates 
Comment 9 Martin Balin 2015-09-17 11:25:36 UTC
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.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo