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 192543 - Compilation fails after using Session Bean for Entity Classes wizard
Summary: Compilation fails after using Session Bean for Entity Classes wizard
Status: RESOLVED FIXED
Alias: None
Product: javaee
Classification: Unclassified
Component: Persistence (show other bugs)
Version: 7.0
Hardware: PC All
: P2 normal with 1 vote (vote)
Assignee: Sergey Petrov
URL:
Keywords:
: 193208 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-11-26 17:28 UTC by Kenneth Ganfield
Modified: 2010-12-22 10:08 UTC (History)
4 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments
Exception for the latest daily build of EL (5.45 KB, text/plain)
2010-11-30 13:12 UTC, Petr Jiricka
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Kenneth Ganfield 2010-11-26 17:28:12 UTC
Using the wizard to create a session facade results in the project failing to compile. This worked in 6.9 and it looks like the generated source code is the same. Also, it seems that if you create the EJB in 6.9 and then open the project in 7.0 and try to build, the build succeeds.

To reproduce:

1. Create EJB project, target GF 3.0.
2. Create simple entity class in EJB.
3. Use the Session Beans from Entity Classes wizard for the entity.
4. Build project.

Product Version: NetBeans IDE Dev (Build 201011260001)
Java: 1.6.0_22; Java HotSpot(TM) 64-Bit Server VM 17.1-b03-307
System: Mac OS X version 10.5.8 running on x86_64; MacRoman; en_US (nb)
Userdir: /Applications/NetBeans/userdirs/7.0-201001126

The output displays the following:

Compiling 3 source files to /Users/nb/Documents/nbtemp-project/70-temp2/EJBModule1/build/classes
Note: Creating static metadata factory ...
Note: Building metadata class for round element: ejb.AbstractFacade
error: java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$TypeSymbol cannot be cast to javax.lang.model.element.TypeElement


An annotation processor threw an uncaught exception.
Consult the following stack trace for details.
java.lang.RuntimeException: java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$TypeSymbol cannot be cast to javax.lang.model.element.TypeElement
        at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:400)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:625)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:554)
        at com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:699)
        at com.sun.tools.javac.main.JavaCompiler.processAnnotations(JavaCompiler.java:981)
        at com.sun.tools.javac.main.JavaCompiler.compile(JavaCompiler.java:727)
        at com.sun.tools.javac.main.Main.compile(Main.java:353)
        at com.sun.tools.javac.main.Main.compile(Main.java:279)
        at com.sun.tools.javac.main.Main.compile(Main.java:270)
        at com.sun.tools.javac.Main.compile(Main.java:69)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.taskdefs.compilers.Javac13.execute(Javac13.java:56)
        at org.apache.tools.ant.taskdefs.Javac.compile(Javac.java:1097)
        at org.apache.tools.ant.taskdefs.Javac.execute(Javac.java:906)
        at org.netbeans.modules.java.source.ant.JavacTask.execute(JavacTask.java:136)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.Sequential.execute(Sequential.java:68)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.taskdefs.MacroInstance.execute(MacroInstance.java:398)
        at org.apache.tools.ant.UnknownElement.execute(UnknownElement.java:291)
        at sun.reflect.GeneratedMethodAccessor383.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.tools.ant.dispatch.DispatchUtils.execute(DispatchUtils.java:106)
        at org.apache.tools.ant.Task.perform(Task.java:348)
        at org.apache.tools.ant.Target.execute(Target.java:390)
        at org.apache.tools.ant.Target.performTasks(Target.java:411)
        at org.apache.tools.ant.Project.executeSortedTargets(Project.java:1397)
        at org.apache.tools.ant.Project.executeTarget(Project.java:1366)
        at org.apache.tools.ant.helper.DefaultExecutor.executeTargets(DefaultExecutor.java:41)
        at org.apache.tools.ant.Project.executeTargets(Project.java:1249)
        at org.apache.tools.ant.module.bridge.impl.BridgeImpl.run(BridgeImpl.java:284)
        at org.apache.tools.ant.module.run.TargetExecutor.run(TargetExecutor.java:539)
        at org.netbeans.core.execution.RunClassThread.run(RunClassThread.java:154)
Caused by: java.lang.ClassCastException: com.sun.tools.javac.code.Symbol$TypeSymbol cannot be cast to javax.lang.model.element.TypeElement
        at org.eclipse.persistence.internal.jpa.modelgen.MetadataMirrorFactory.getMetadataClass(MetadataMirrorFactory.java:116)
        at org.eclipse.persistence.internal.jpa.modelgen.MetadataMirrorFactory.getMetadataClass(MetadataMirrorFactory.java:178)
        at org.eclipse.persistence.internal.jpa.modelgen.visitors.TypeVisitor.visitDeclared(TypeVisitor.java:77)
        at org.eclipse.persistence.internal.jpa.modelgen.visitors.TypeVisitor.visitDeclared(TypeVisitor.java:39)
        at com.sun.tools.javac.code.Type$ClassType.accept(Type.java:696)
        at org.eclipse.persistence.internal.jpa.modelgen.visitors.ElementVisitor.visitType(ElementVisitor.java:214)
        at org.eclipse.persistence.internal.jpa.modelgen.visitors.ElementVisitor.visitType(ElementVisitor.java:50)
        at com.sun.tools.javac.code.Symbol$ClassSymbol.accept(Symbol.java:832)
        at org.eclipse.persistence.internal.jpa.modelgen.MetadataMirrorFactory.getMetadataClass(MetadataMirrorFactory.java:125)
        at org.eclipse.persistence.internal.jpa.modelgen.MetadataMirrorFactory.setEnvironments(MetadataMirrorFactory.java:266)
        at org.eclipse.persistence.internal.jpa.modelgen.CanonicalModelProcessor.process(CanonicalModelProcessor.java:361)
        ... 46 more
/Users/nb/Documents/nbtemp-project/70-temp2/EJBModule1/nbproject/build-impl.xml:480: The following error occurred while executing this line:
/Users/nb/Documents/nbtemp-project/70-temp2/EJBModule1/nbproject/build-impl.xml:197: Compile failed; see the compiler error output for details.
BUILD FAILED (total time: 0 seconds)
Comment 1 Sergey Petrov 2010-11-26 17:34:24 UTC
Looks like known issue, already resolved on eclipselink side, will be resolved in nb after update eclipselink to milestone nexte to M5. As a workaround if no annotation processor features is used, it's possible to remove eclipselink-modelgen library from project processor path libraries.
Comment 2 Sergey Petrov 2010-11-29 12:16:28 UTC
It's new similar issue, and likely need to be resolved on eclipselink side too.
Comment 3 Sergey Petrov 2010-11-29 14:59:38 UTC
https://bugs.eclipse.org/bugs/show_bug.cgi?id=331343
Comment 4 David Konecny 2010-11-29 23:28:43 UTC
(In reply to comment #3)
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=331343

How it this Eclipse issue related to this problem? 331343 was about NPE but this one is ClassCastException, no?
Comment 5 Sergey Petrov 2010-11-30 05:38:19 UTC
yes, looks strange, may be Guy decide it's related, need to test daly eclipselink
Comment 6 Petr Jiricka 2010-11-30 13:12:13 UTC
Created attachment 103465 [details]
Exception for the latest daily build of EL

The relationship is: when you try this scenario with the latest daily build of EclipseLink (as opposed to the M4 build that we bundle), you will not get the ClassCastException, but you will get the attached NPE.
Comment 7 Sergey Petrov 2010-12-01 11:23:58 UTC
verified with eclipselink-2.2.0.v20101201-r8590 and see neither classcase nor nullpointer, build is successful.
Comment 8 Sergey Petrov 2010-12-10 11:48:00 UTC
*** Bug 193208 has been marked as a duplicate of this bug. ***
Comment 9 Sergey Petrov 2010-12-15 17:10:06 UTC
for dev/beta etc it sould be fixed http://hg.netbeans.org/web-main/rev/e9e05f2b5559 will test after  build.

for release it should be updated.
Comment 10 Quality Engineering 2010-12-16 06:41:37 UTC
Integrated into 'main-golden', will be available in build *201012160001* on http://bits.netbeans.org/dev/nightly/ (upload may still be in progress)
Changeset: http://hg.netbeans.org/main/rev/e9e05f2b5559
User: Sergey B. Petrov <sj-nb@netbeans.org>
Log: fix #192543 update to 2.2.0 m6
Comment 11 Sergey Petrov 2010-12-22 10:08:00 UTC
fixed