Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » MoDisco » DiscoverSourceModelFromJavaProject(DiscoverSourceModelFromJavaProject throws Exception)
DiscoverSourceModelFromJavaProject [message #558797] Tue, 14 September 2010 13:36 Go to next message
Björn is currently offline BjörnFriend
Messages: 29
Registered: August 2010
Junior Member
hi,

currently I am working with the KDMSourceDiscoverer.

this is what I do with it:

Resource sourceModel = new XMIResourceImpl();
Map<DiscoveryParameter, Object> parameters = null;
		
DiscoverSourceModelFromJavaProject discoverer = new DiscoverSourceModelFromJavaProject()

parameters = new HashMap<DiscoveryParameter, Object>();
parameters.put(PARAMETER_SILENT_MODE, true);
parameters.put(PARAMETER_BROWSE_RESULT, false);
parameters.put(PARAMETER_TARGET_RESOURCE, sourceModel);

JavaProjectFactory javaProjectFactory = new JavaProjectFactory("MyProject");
javaProjectFactory.populateSourceFolder("Path/To/My/Sources")
IJavaProject project = javaProjectFactory.getJavaProject();

discoverer.discoverElement(project, parameters);


but then I get this strange exception:

!MESSAGE org.eclipse.gmt.modisco.omg.kdm.kdm.impl.KdmFactoryImpl cannot be cast to org.eclipse.gmt.modisco.omg.kdm.kdm.KdmFactory
!STACK 0
java.lang.ClassCastException: org.eclipse.gmt.modisco.omg.kdm.kdm.impl.KdmFactoryImpl cannot be cast to org.eclipse.gmt.modisco.omg.kdm.kdm.KdmFactory
	at org.eclipse.gmt.modisco.omg.kdm.kdm.impl.KdmFactoryImpl.init(KdmFactoryImpl.java:49)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.KdmFactory.<clinit>(KdmFactory.java:34)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.impl.KdmPackageImpl.<init>(KdmPackageImpl.java:166)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.impl.KdmPackageImpl.init(KdmPackageImpl.java:192)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.KdmPackage.<clinit>(KdmPackage.java:69)
	at org.eclipse.gmt.modisco.omg.kdm.core.impl.CorePackageImpl.init(CorePackageImpl.java:164)
	at org.eclipse.gmt.modisco.omg.kdm.core.CorePackage.<clinit>(CorePackage.java:74)
	at sun.misc.Unsafe.ensureClassInitialized(Native Method)
	at sun.reflect.UnsafeFieldAccessorFactory.newFieldAccessor(UnsafeFieldAccessorFactory.java:25)
	at sun.reflect.ReflectionFactory.newFieldAccessor(ReflectionFactory.java:122)
	at java.lang.reflect.Field.acquireFieldAccessor(Field.java:918)
	at java.lang.reflect.Field.getFieldAccessor(Field.java:899)
	at java.lang.reflect.Field.get(Field.java:358)
	at org.eclipse.emf.ecore.plugin.RegistryReader$EPackageDescriptor.getEPackage(RegistryReader.java:274)
	at org.eclipse.emf.ecore.impl.EPackageRegistryImpl.getEPackage(EPackageRegistryImpl.java:133)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.impl.KdmPackageImpl.init(KdmPackageImpl.java:197)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.KdmPackage.<clinit>(KdmPackage.java:69)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.KdmPackage$Literals.<clinit>(KdmPackage.java:1232)
	at org.eclipse.gmt.modisco.omg.kdm.kdm.impl.SegmentImpl.eStaticClass(SegmentImpl.java:80)
	at org.eclipse.emf.ecore.impl.EObjectImpl.eClass(EObjectImpl.java:269)
	at org.eclipse.emf.ecore.util.EContentsEList.createEContentsEList(EContentsEList.java:55)
	at org.eclipse.emf.ecore.impl.BasicEObjectImpl.eContents(BasicEObjectImpl.java:821)
	at org.eclipse.emf.ecore.util.EcoreUtil$ProperContentIterator.<init>(EcoreUtil.java:1246)
	at org.eclipse.emf.ecore.util.EcoreUtil$4.getChildren(EcoreUtil.java:1157)
	at org.eclipse.emf.ecore.util.EcoreUtil$ContentTreeIterator.hasNext(EcoreUtil.java:1408)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl.attached(ResourceImpl.java:860)
	at org.eclipse.emf.ecore.resource.impl.ResourceImpl$ContentsEList.inverseAdd(ResourceImpl.java:416)
	at org.eclipse.emf.common.notify.impl.NotifyingListImpl.addUnique(NotifyingListImpl.java:318)
	at org.eclipse.emf.common.util.AbstractEList.add(AbstractEList.java:307)
	at org.eclipse.gmt.modisco.kdm.source.discoverer.KDMSourceDiscoverer.createKDMModelFromFile(KDMSourceDiscoverer.java:158)
	at org.eclipse.gmt.modisco.kdm.source.discoverer.KDMSourceDiscoverer.getKDMModelFromJavaProject(KDMSourceDiscoverer.java:120)
	at org.eclipse.gmt.modisco.kdm.source.discoverer.actions.DiscoverSourceModelFromJavaProject.discoverElement(DiscoverSourceModelFromJavaProject.java:126)
	at org.eclipse.gmt.modisco.kdm.source.discoverer.actions.DiscoverSourceModelFromJavaProject.discoverElement(DiscoverSourceModelFromJavaProject.java:192)
	at kdmextractor.KDMExtractor.extractKDMSourceModel(KDMExtractor.java:427)
	at kdmextractor.KDMExtractor.extractKDMModel(KDMExtractor.java:316)
	at kdmextractor.KDMExtractor.convertKDMModel(KDMExtractor.java:281)
	at kdmextractor.KDMExtractor.getKdmModel(KDMExtractor.java:256)
	at kdmextractor.views.KDMExtractorView$2.run(KDMExtractorView.java:172)
	at org.eclipse.jface.action.Action.runWithEvent(Action.java:498)
	at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:584)
	at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:501)
	at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:411)
	at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:84)
	at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1258)
	at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:3552)
	at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3171)
	at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:2629)
	at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:2593)
	at org.eclipse.ui.internal.Workbench.access$4(Workbench.java:2427)
	at org.eclipse.ui.internal.Workbench$7.run(Workbench.java:670)
	at org.eclipse.core.databinding.observable.Realm.runWithDefault(Realm.java:332)
	at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:663)
	at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:149)
	at org.eclipse.ui.internal.ide.application.IDEApplication.start(IDEApplication.java:115)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:110)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:79)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:369)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:179)
	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.eclipse.equinox.launcher.Main.invokeFramework(Main.java:619)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:574)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1407)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1383)


and it seems to be that line 49 in the KdmFactoryImpl class

KdmFactory theKdmFactory = (KdmFactory)EPackage.Registry.INSTANCE.getEFactory("http://www.eclipse.org/MoDisco/kdm/kdm");


is causing the problem.

Does anyone have an idea why this could be?
Thanx in advance.

Cheers Björn

[Updated on: Tue, 14 September 2010 13:41]

Report message to a moderator

Re: DiscoverSourceModelFromJavaProject [message #558810 is a reply to message #558797] Tue, 14 September 2010 14:11 Go to previous message
Nicolas Bros is currently offline Nicolas BrosFriend
Messages: 49
Registered: July 2009
Member
Hi,

Which version of Eclipse and MoDisco are you using?
Have you installed a new version of MoDisco over a previous one?
Previous Topic:DiscoverSourceModelFromJavaProject
Next Topic:Use of modisco to convert javacode to KDM
Goto Forum:
  


Current Time: Sat Dec 20 09:57:21 GMT 2014

Powered by FUDForum. Page generated in 0.02222 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software