Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » NoClassDefFoundError -> JavaModelException running Xtext without JDT.core
NoClassDefFoundError -> JavaModelException running Xtext without JDT.core [message #1058643] Tue, 14 May 2013 06:59 Go to next message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 914
Registered: July 2009
Senior Member
Hello,

I have a working Xtext editor in an RCP with Xtext 2.0.0
I want to migrate to Xtext 2.4.0, so I replace the xtext version in my
Eclipse target platform.

So far so good, I get no compilation errors on my generated 2.0.0 Xtext
code. However when Guice binding is happening at loading of my Xtext
editor plugin, I get an exception for a class which I didn't bundle into
the product. From this Exception, I can't see which Xtext class has a
dependency to JavaModelException, but I managed to debug it and find the
culprit which is:

StorageAwareTrace

It stems from the binding:

bind(ITraceInformation.class).to(FileBasedTraceInformation.class);
in SharedModule.

Now, my questions are:

1) is this indeed a difference from Xtext 2.4 compared to 2.0? (I mean
it worked with the xtext.builder plugin without the jdt.core bundle
included in my product).

2) Could I do without xtext.builder and ui.shared, considering that I
don't need Xtext to scan for resources in my workspace. I have external
references to ECore models which are in CDO, but here I use my own
custom developed CDOResourceDescriptoions implementation.

Thanks!


These are my included bundles in the rcp product.

org.eclipse.xtext_2.4.0.v201302051002.jar
org.eclipse.xtext.builder_2.4.0.v201302051002.jar
org.eclipse.xtext.ui_2.4.0.v201302051002.jar
org.eclipse.xtext.ui.codetemplates_2.4.0.v201302051002.jar
org.eclipse.xtext.ui.codetemplates.ui_2.4.0.v201302051002.jar
org.eclipse.xtext.ui.shared_2.4.0.v201302051002.jar
org.eclipse.xtext.util_2.4.0.v201302051002.jar
org.eclipse.xtext.xbase.lib_2.4.0.v201302051002.jar



This is the Exception.

java.lang.NoClassDefFoundError: org/eclipse/jdt/core/JavaModelException
at java.lang.Class.getDeclaredConstructors0(Native Method)
at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
at java.lang.Class.getDeclaredConstructors(Class.java:1836)
at
com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243)
at
com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96)
at
com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629)
at
com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:845)
at
com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:772)
at
com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:256)
at
com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:205)
at
com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:853)
at com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46)
at
com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50)
at
com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:133)
at
com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
at com.google.inject.Guice.createInjector(Guice.java:95)
at com.google.inject.Guice.createInjector(Guice.java:72)
at com.google.inject.Guice.createInjector(Guice.java:62)

module com.netxforge.GenerateNetxscript

import org.eclipse.emf.mwe.utils.*
import org.eclipse.xtext.generator.*
import org.eclipse.xtext.ui.generator.*

var grammarURI = "classpath:/com/netxforge/Netxscript.xtext"
var file.extensions = "netxscript"
var projectName = "com.netxforge.netxscript"

var runtimeProject = "../${projectName}"
// Note when using GIT, there are subfolders, so customize, as xtext and xtext.ui are split.
// Go up to folders, to be in the repot.
var uiProject = "../../Client/${projectName}.ui"

Workflow {
bean = StandaloneSetup {
scanClassPath = true
platformUri = "${runtimeProject}/.."
// registerGeneratedEPackage = "com.netxforge.netxstudio.library.LibraryPackage"
// registerGeneratedEPackage = "com.netxforge.netxstudio.operators.OperatorsPackage"
// registerGeneratedEPackage = "com.netxforge.netxstudio.metrics.MetricsPackage"
registerGenModelFile = "platform:/resource/com.netxforge.netxstudio.models/models/cdo/13042011/netxstudio.genmodel"
}

component = DirectoryCleaner {
directory = "${runtimeProject}/src-gen"
}

component = DirectoryCleaner {
directory = "${uiProject}/src-gen"
}

component = Generator {
pathRtProject = runtimeProject
pathUiProject = "${uiProject}"
pathTestProject = "${runtimeProject}.tests"
projectNameRt = projectName
projectNameUi = "${projectName}.ui"
language = {
uri = grammarURI
fileExtensions = file.extensions

// Java API to access grammar elements (required by several other fragments)
fragment = grammarAccess.GrammarAccessFragment {}

// generates Java API for the generated EPackages
fragment = ecore.EcoreGeneratorFragment {
// referencedGenModels = "
// platform:/resource/org.eclipse.xtext.xbase/model/Xbase.genmodel,
// platform:/resource/org.eclipse.xtext.common.types/model/JavaVMTypes.genmodel
// "
}

// Serializer 2.0
fragment = serializer.SerializerFragment {}

// the serialization component (1.0)
// fragment = parseTreeConstructor.ParseTreeConstructorFragment {}

// a custom ResourceFactory for use with EMF
fragment = resourceFactory.ResourceFactoryFragment {
fileExtensions = file.extensions
}

// The antlr parser generator fragment.
fragment = parser.antlr.XtextAntlrGeneratorFragment {
// options = {
// backtrack = true
// }
}

// java-based API for validation
fragment = validation.JavaValidatorFragment {
composedCheck = "org.eclipse.xtext.validation.ImportUriValidator"
composedCheck = "org.eclipse.xtext.validation.NamesAreUniqueValidator"
}

// scoping and exporting API
// fragment = scoping.ImportURIScopingFragment {}
// fragment = exporting.SimpleNamesFragment {}

// scoping and exporting API
fragment = scoping.ImportNamespacesScopingFragment {}

// CB We override the name provider, with a custom CDO name provider, so this doesn't really make sense.
//
fragment = exporting.QualifiedNamesFragment {}
fragment = builder.BuilderIntegrationFragment {}

// generator API
// CB JDT dependency: https://bugs.eclipse.org/bugs/show_bug.cgi?id=336217
// fragment = generator.GeneratorFragment {
// generateMwe = true
// generateJavaMain = true
// }

// formatter API
fragment = formatting.FormatterFragment {}

// labeling API
fragment = labeling.LabelProviderFragment {}

// outline API
fragment = outline.OutlineTreeProviderFragment {}
fragment = outline.QuickOutlineFragment {}

// quickfix API
fragment = quickfix.QuickfixProviderFragment {}

// content assist API
fragment = contentAssist.JavaBasedContentAssistFragment {}

// generates a more lightweight Antlr parser and lexer tailored for content assist
fragment = parser.antlr.XtextAntlrUiGeneratorFragment {}

// generates junit test support classes into Generator#pathTestProject
fragment = junit.Junit4Fragment {}

// project wizard (optional)
// fragment = projectWizard.SimpleProjectWizardFragment {
// generatorProjectName = "${projectName}"
// modelFileExtension = file.extensions
// }

// provides the necessary bindings for java types integration
// CB JDT Dependent.
// fragment = types.TypesGeneratorFragment {}

//CB JDT Dependent. generates the required bindings only if the grammar inherits from Xbase
// fragment = xbase.XbaseGeneratorFragment {}

// provides a preference page for template proposals
// CB JDT Dependent, but not with custom version, also not after 2.1
fragment = templates.CodetemplatesGeneratorFragment {}

// rename refactoring
// CB Not required.
// fragment = refactoring.RefactorElementNameFragment {}

// provides a compare view
// CB Not required.
// fragment = compare.CompareFragment {
// fileExtensions = file.extensions
// }

}
}
}
Re: NoClassDefFoundError -> JavaModelException running Xtext without JDT.core [message #1058742 is a reply to message #1058643] Tue, 14 May 2013 09:59 Go to previous message
Christophe Bouhier is currently offline Christophe Bouhier
Messages: 914
Registered: July 2009
Senior Member
Hi,
OK, based on this forum entry:
news://news.eclipse.org:119/kkm4j8$746$1@xxxxxxxxe.org

I updated to xtext 2.4.1, but now I get the binding Exception below:
Any ideas?

Thx Christophe


3) Error injecting method, java.lang.NullPointerException
at
org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar.register(Unknown
Source)
at
org.eclipse.xtext.service.MethodBasedModule.configure(MethodBasedModule.java:55)
while locating
org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar
Caused by: java.lang.NullPointerException
at
org.eclipse.xtext.ui.codetemplates.ui.registry.LanguageRegistrar.register(LanguageRegistrar.java:45)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at
sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at
sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)





On 14-05-13 12:59, Christophe Bouhier wrote:
> Hello,
>
> I have a working Xtext editor in an RCP with Xtext 2.0.0
> I want to migrate to Xtext 2.4.0, so I replace the xtext version in my
> Eclipse target platform.
>
> So far so good, I get no compilation errors on my generated 2.0.0 Xtext
> code. However when Guice binding is happening at loading of my Xtext
> editor plugin, I get an exception for a class which I didn't bundle into
> the product. From this Exception, I can't see which Xtext class has a
> dependency to JavaModelException, but I managed to debug it and find the
> culprit which is:
>
> StorageAwareTrace
>
> It stems from the binding:
>
> bind(ITraceInformation.class).to(FileBasedTraceInformation.class);
> in SharedModule.
>
> Now, my questions are:
>
> 1) is this indeed a difference from Xtext 2.4 compared to 2.0? (I mean
> it worked with the xtext.builder plugin without the jdt.core bundle
> included in my product).
>
> 2) Could I do without xtext.builder and ui.shared, considering that I
> don't need Xtext to scan for resources in my workspace. I have external
> references to ECore models which are in CDO, but here I use my own
> custom developed CDOResourceDescriptoions implementation.
>
> Thanks!
>
>
> These are my included bundles in the rcp product.
>
> org.eclipse.xtext_2.4.0.v201302051002.jar
> org.eclipse.xtext.builder_2.4.0.v201302051002.jar
> org.eclipse.xtext.ui_2.4.0.v201302051002.jar
> org.eclipse.xtext.ui.codetemplates_2.4.0.v201302051002.jar
> org.eclipse.xtext.ui.codetemplates.ui_2.4.0.v201302051002.jar
> org.eclipse.xtext.ui.shared_2.4.0.v201302051002.jar
> org.eclipse.xtext.util_2.4.0.v201302051002.jar
> org.eclipse.xtext.xbase.lib_2.4.0.v201302051002.jar
>
>
>
> This is the Exception.
>
> java.lang.NoClassDefFoundError: org/eclipse/jdt/core/JavaModelException
> at java.lang.Class.getDeclaredConstructors0(Native Method)
> at java.lang.Class.privateGetDeclaredConstructors(Class.java:2389)
> at java.lang.Class.getDeclaredConstructors(Class.java:1836)
> at
> com.google.inject.spi.InjectionPoint.forConstructorOf(InjectionPoint.java:243)
>
> at
> com.google.inject.internal.ConstructorBindingImpl.create(ConstructorBindingImpl.java:96)
>
> at
> com.google.inject.internal.InjectorImpl.createUninitializedBinding(InjectorImpl.java:629)
>
> at
> com.google.inject.internal.InjectorImpl.createJustInTimeBinding(InjectorImpl.java:845)
>
> at
> com.google.inject.internal.InjectorImpl.createJustInTimeBindingRecursive(InjectorImpl.java:772)
>
> at
> com.google.inject.internal.InjectorImpl.getJustInTimeBinding(InjectorImpl.java:256)
>
> at
> com.google.inject.internal.InjectorImpl.getBindingOrThrow(InjectorImpl.java:205)
>
> at
> com.google.inject.internal.InjectorImpl.getInternalFactory(InjectorImpl.java:853)
>
> at
> com.google.inject.internal.FactoryProxy.notify(FactoryProxy.java:46)
> at
> com.google.inject.internal.ProcessedBindingData.runCreationListeners(ProcessedBindingData.java:50)
>
> at
> com.google.inject.internal.InternalInjectorCreator.initializeStatically(InternalInjectorCreator.java:133)
>
> at
> com.google.inject.internal.InternalInjectorCreator.build(InternalInjectorCreator.java:106)
>
> at com.google.inject.Guice.createInjector(Guice.java:95)
> at com.google.inject.Guice.createInjector(Guice.java:72)
> at com.google.inject.Guice.createInjector(Guice.java:62)
Previous Topic:Making validator work
Next Topic:apologize
Goto Forum:
  


Current Time: Mon Sep 01 09:55:33 EDT 2014

Powered by FUDForum. Page generated in 0.02687 seconds