Skip to content
This repository has been archived by the owner on Feb 18, 2022. It is now read-only.

ClassCastException #19

Open
kabir opened this issue Jan 3, 2013 · 5 comments
Open

ClassCastException #19

kabir opened this issue Jan 3, 2013 · 5 comments

Comments

@kabir
Copy link

kabir commented Jan 3, 2013

Hi,

I'm trying to use this with https://github.com/jbossas/jboss-as in Eclipse 4.2.1 on OS X Lion . When building the project I get:

Description Resource Path Location Type
Internal compiler error: java.lang.ClassCastException: com.sun.istack.internal.ws.AnnotationProcessorFactoryImpl cannot be cast to com.sun.mirror.apt.AnnotationProcessorFactory at org.eclipse.jdt.apt.core.internal.AnnotationProcessorFactoryLoader.loadJava5FactoryClasses(AnnotationProcessorFactoryLoader.java:566) JGroupsLogger_$logger.java /jboss-as-clustering-jgroups/target/generated-sources/annotations/org/jboss/as/clustering/jgroups line 0 Java Problem

(We use annotation processing to create the internationalized logger classes). The class it is trying to generate would be based on clustering/jgroups/src/main/java/org/jboss/as/clustering/jgroups/JGroupsLogger.java.

$java -version
java version "1.6.0_37"
Java(TM) SE Runtime Environment (build 1.6.0_37-b06-434-11M3909)
Java HotSpot(TM) 64-Bit Server VM (build 20.12-b01-434, mixed mode)

I enabled the "Automatically Configure JDT..." for all projects in Eclipse/Preferences. Not doing that and enabling it for individual projects works, although I have not tried enabling it for the project causing the error.

@fbricon
Copy link
Member

fbricon commented Jan 3, 2013

Can you reproduce the issue in a clean workspace, only importing the offending project, or the whole clustering module?

@kabir
Copy link
Author

kabir commented Jan 3, 2013

Yes,

Here are the steps

  1. Clone a fresh copy of jboss-as
  2. Open a new Eclipse workspace
  3. Enable Eclipse/Preferences/Maven/Annotation Processing/Automatically configure JDT...
  4. Import jboss-as/clustering

I get

Description Resource Path Location Type
The project cannot be built until its prerequisite jboss-as-clustering-service is built. Cleaning and building all projects is recommended jboss-as-clustering-singleton Unknown Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-infinispan is built. Cleaning and building all projects is recommended jboss-as-clustering-impl Unknown Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-api is built. Cleaning and building all projects is recommended jboss-as-clustering-infinispan Unknown Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-common is built. Cleaning and building all projects is recommended jboss-as-clustering-jgroups Unknown Java Problem
Internal compiler error: java.lang.ClassCastException: com.sun.istack.internal.ws.AnnotationProcessorFactoryImpl cannot be cast to com.sun.mirror.apt.AnnotationProcessorFactory at org.eclipse.jdt.apt.core.internal.AnnotationProcessorFactoryLoader.loadJava5FactoryClasses(AnnotationProcessorFactoryLoader.java:566) ManagedExecutorServiceTest.java /jboss-as-clustering-common/src/test/java/org/jboss/as/clustering/concurrent line 0 Java Problem
Internal compiler error: java.lang.ClassCastException: com.sun.istack.internal.ws.AnnotationProcessorFactoryImpl cannot be cast to com.sun.mirror.apt.AnnotationProcessorFactory at org.eclipse.jdt.apt.core.internal.AnnotationProcessorFactoryLoader.loadJava5FactoryClasses(AnnotationProcessorFactoryLoader.java:566) HashableMarshalledValueFactoryTestCase.java /jboss-as-clustering-api/src/test/java/org/jboss/as/clustering line 0 Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-common is built. Cleaning and building all projects is recommended jboss-as-clustering-registry Unknown Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-infinispan is built. Cleaning and building all projects is recommended jboss-as-clustering-ejb3-infinispan Unknown Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-impl is built. Cleaning and building all projects is recommended jboss-as-clustering-web-infinispan Unknown Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-impl is built. Cleaning and building all projects is recommended jboss-as-clustering-service Unknown Java Problem
The project cannot be built until its prerequisite jboss-as-clustering-api is built. Cleaning and building all projects is recommended jboss-as-clustering-web-spi Unknown Java Problem

@fbricon
Copy link
Member

fbricon commented Jan 4, 2013

So far I've been unable to reproduce the problem on win7 64 (eclipse running with JDK 1.7.0_10, project built with JDK 1.6.0_37), using JBDS 6.0.0 (based off eclipse 4.2.1). I'll try on a linux vm tomorrow. Will need someone else to test OSX.

@chinshaw
Copy link

chinshaw commented Jun 4, 2013

I was able to resolve this issue by disabling, validation through Preferences -> Maven -> AnnotationProcessing, then manually removing the .factorypath file from command line. Refresh the project and re enable validation processing in the project preferences. I have a suspicion that the problem was due to adding a dependency for apiviz which forced me initially to add a system dependency on the java classes.jar file. Just a hunch though

<factorypathentry kind="EXTJAR" id="/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/../Classes/classes.jar" enabled="true" runInBatchMode="false"/>

@mickaelistria
Copy link

m2e-apt's code is now included in https://github.com/eclipse-m2e/m2e-core , please consider reporting issue to https://github.com/eclipse-m2e/m2e-core/issues if it's still relevant.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants