Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » [Solved] Message "Error creating Groovy: java.lang.ClassNotFoundException" when using JDT'(java.lang.ClassNotFoundException: org.codehaus.jdt.groovy.integration.internal.GroovyLanguageSupport)
[Solved] Message "Error creating Groovy: java.lang.ClassNotFoundException" when using JDT' [message #1817506] Mon, 25 November 2019 08:00 Go to next message
Chkiron Chronos is currently offline Chkiron ChronosFriend
Messages: 8
Registered: October 2019
Junior Member
Hi all,

I have written a code to format Java sources using JDT's libs.

When I run it, it works as expected, but displays this stacktrace:

Error creating Groovy language support:
java.lang.ClassNotFoundException: org.codehaus.jdt.groovy.integration.internal.GroovyLanguageSupport
        at java.net.URLClassLoader.findClass(URLClassLoader.java:382)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:349)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
        at java.lang.Class.forName0(Native Method)
        at java.lang.Class.forName(Class.java:264)
        at org.codehaus.jdt.groovy.integration.LanguageSupportFactory.tryInstantiate(LanguageSupportFactory.java:143)
        at org.codehaus.jdt.groovy.integration.LanguageSupportFactory.getLanguageSupport(LanguageSupportFactory.java:126)
        at org.codehaus.jdt.groovy.integration.LanguageSupportFactory.getParser(LanguageSupportFactory.java:57)
        at org.eclipse.jdt.core.dom.CompilationUnitResolver.parse(CompilationUnitResolver.java:521)
        at org.eclipse.jdt.core.dom.ASTParser.internalCreateAST(ASTParser.java:1209)
        at org.eclipse.jdt.core.dom.ASTParser.createAST(ASTParser.java:812)
        at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.parseSourceCode(DefaultCodeFormatter.java:322)
        at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.parseSourceCode(DefaultCodeFormatter.java:297)
        at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.prepareFormattedCode(DefaultCodeFormatter.java:190)
        at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:159)
        at org.eclipse.jdt.internal.formatter.DefaultCodeFormatter.format(DefaultCodeFormatter.java:142)
        ...   (omitting custom code trace)


This is the line that triggers the exception:

    
TextEdit textEdit = codeFormatter.format(
        CodeFormatter.K_COMPILATION_UNIT | CodeFormatter.F_INCLUDE_COMMENTS, 
        sourceCodeToFormat,
        FROM_THE_BEGINNING, 
        sourceCodeToFormat.length(), 
        ZERO_INITIAL_INDENTATION, 
        LINE_SEPARATOR);


These are the JDT libs I am using:




  • org.eclipse.core.contenttype_3.7.400.v20190624-1144.jar
  • org.eclipse.core.jobs_3.10.500.v20190620-1426.jar
  • org.eclipse.core.resources_3.13.500.v20190819-0800.jar
  • org.eclipse.core.runtime_3.16.0.v20190823-1314.jar
  • org.eclipse.equinox.common_3.10.500.v20190815-1535.jar
  • org.eclipse.equinox.preferences_3.7.500.v20190815-1535.jar
  • org.eclipse.jdt.core_3.19.0.v201909291620-e1909-RELEASE.jar
  • org.eclipse.osgi_3.15.0.v20190830-1434.jar
  • org.eclipse.text_3.9.0.v20190826-1019.jar



I suspect one of libs is checking for the presence of Groovy and, not find a jar for it, and, not finding any, printing the stack trace and moving forward.

Would someone know which lib I should add to solve this runtime dependency? Or if there is anyway to turn off this Groovy support check?

Thanks!

[Updated on: Mon, 25 November 2019 15:19]

Report message to a moderator

Re: Message "Error creating Groovy: java.lang.ClassNotFoundException" when using JDT's Cod [message #1817530 is a reply to message #1817506] Mon, 25 November 2019 12:59 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1828
Registered: July 2009
Senior Member
This plugin:
 org.eclipse.jdt.core_3.19.0.v201909291620-e1909-RELEASE.jar

is not an official version released from Eclipse.org, but the variant patched for Groovy support.
Please report the problem to the developers of Groovy-Eclipse. Apparently s.t. is incomplete on their side.
Re: Message "Error creating Groovy: java.lang.ClassNotFoundException" when using JDT's Cod [message #1817539 is a reply to message #1817530] Mon, 25 November 2019 15:18 Go to previous message
Chkiron Chronos is currently offline Chkiron ChronosFriend
Messages: 8
Registered: October 2019
Junior Member
Hi Stephan,

you nailed it, that was the problem!

I got that jar from my company's custom Eclipse installation and assumed that it was the original one.

After your answer, I downloaded an official Eclipse release and surely enough it was a different jar, as you said.

After I replaced the existing jar by the new one on my application path, the Groovy error was gone.

Thank you very much for your attention and time, cheers!

Previous Topic:Cannot resolve binding of Custom ParameterizedType's attributes
Next Topic:Unbound classpath container: JRE System Library (in test, OS X, tycho)
Goto Forum:
  


Current Time: Sat Oct 24 10:04:58 GMT 2020

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

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

Back to the top