Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose org.graalvm.sdk:graal-sdk dependency #352

Open
wants to merge 1 commit into
base: 5.0.x
Choose a base branch
from

Conversation

jamesfredley
Copy link

This saves having to add it to every Grails 7 application

This saves having to add it to every Grails 7 application
@codeconsole
Copy link
Contributor

That dependency is not required. I am running a Grails 7 app and Asset Pipeline 5.0.1 and do not need it.

@davydotcom
Copy link
Contributor

This is only needed for compile time or development runtime. We wanted to explicitly exclude it from getting injected into the war/jar because its not required for production war builds.

@jamesfredley
Copy link
Author

Without this dependency added to the grails 7 test apps:

runtimeOnly("org.graalvm.sdk:graal-sdk:22.0.0.2")

the following has occurred across a number of test applications:

Grails application running at http://localhost:8080 in environment: development
2024-10-11T09:19:27.912-04:00 ERROR 7768 --- [io-8080-exec-10] .C.[.[.[.[dispatcherServletRegistration] : Servlet.service() for servlet [dispatcherServletRegistration] in context with path [] threw exception [Filter execution threw an exception] with root cause

java.lang.ClassNotFoundException: org.graalvm.polyglot.Context
	at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:641)
	at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:188)
	at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:525)
	at java.base/java.lang.Class.getDeclaredMethods0(Native Method)
	at java.base/java.lang.Class.privateGetDeclaredMethods(Class.java:3402)
	at java.base/java.lang.Class.privateGetPublicMethods(Class.java:3427)
	at java.base/java.lang.Class.getMethods(Class.java:2019)
	at java.desktop/com.sun.beans.introspect.MethodInfo.get(MethodInfo.java:70)
	at java.desktop/com.sun.beans.introspect.ClassInfo.getMethods(ClassInfo.java:80)
	at java.desktop/java.beans.Introspector.getTargetMethodInfo(Introspector.java:1029)
	at java.desktop/java.beans.Introspector.getBeanInfo(Introspector.java:446)
	at java.desktop/java.beans.Introspector.getBeanInfo(Introspector.java:195)
	at groovy.lang.MetaClassImpl.lambda$addProperties$25(MetaClassImpl.java:3466)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:569)
	at groovy.lang.MetaClassImpl.doPrivileged(MetaClassImpl.java:3519)
	at groovy.lang.MetaClassImpl.addProperties(MetaClassImpl.java:3466)
	at groovy.lang.MetaClassImpl.reinitialize(MetaClassImpl.java:3448)
	at groovy.lang.MetaClassImpl.initialize(MetaClassImpl.java:3441)
	at org.codehaus.groovy.reflection.ClassInfo.getMetaClassUnderLock(ClassInfo.java:272)
	at org.codehaus.groovy.reflection.ClassInfo.getMetaClass(ClassInfo.java:314)
	at org.codehaus.groovy.runtime.metaclass.MetaClassRegistryImpl.getMetaClass(MetaClassRegistryImpl.java:269)
	at org.codehaus.groovy.runtime.InvokerHelper.getMetaClass(InvokerHelper.java:596)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallStaticSite(CallSiteArray.java:69)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.createCallSite(CallSiteArray.java:159)
	at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:45)
	at org.codehaus.groovy.runtime.callsite.StaticMetaMethodSite.call(StaticMetaMethodSite.java:95)
	at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:139)
	at asset.pipeline.AbstractAssetFile.processedStream(AbstractAssetFile.groovy:180)
	at asset.pipeline.AbstractAssetFile.processedStream(AbstractAssetFile.groovy)
	at asset.pipeline.DirectiveProcessor.fileContents(DirectiveProcessor.groovy:320)
	at asset.pipeline.DirectiveProcessor$fileContents$2.call(Unknown Source)
	at asset.pipeline.AssetPipeline.serveUncompiledAsset(AssetPipeline.groovy:67)
	at asset.pipeline.AssetPipelineFilter.doFilterInternal(AssetPipelineFilter.groovy:288)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
	at org.springframework.web.filter.ServerHttpObservationFilter.doFilterInternal(ServerHttpObservationFilter.java:113)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
	at org.springframework.web.filter.CorsFilter.doFilterInternal(CorsFilter.java:91)
	at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:116)
	at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:164)
	at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:140)
	at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:167)
	at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:90)
	at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:483)
	at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:115)
	at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:93)
	at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:74)
	at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:344)
	at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:384)
	at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:63)
	at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:905)
	at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1741)
	at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:52)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1190)
	at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
	at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:63)
	at java.base/java.lang.Thread.run(Thread.java:840)

@jamesfredley
Copy link
Author

jamesfredley commented Oct 11, 2024

@codeconsole's Grails 7 application doesn't need this dependency because he removed.

implementation("com.bertramlabs.plugins:asset-pipeline-gradle:5.0.1") from buildSrc/build.gradle, he actually fully consolidated buildSrc and settings.gradle into build.gradle, but that one line is the source of this error.

And has it defined in one location in build.gradle:

plugins {
     id "com.bertramlabs.asset-pipeline" version "5.0.1"
}

Example where it was required: https://github.com/jamesfredley/grails-website-test

We had planned to go that direction for forge create-app and grails-shell create-app, so if we don't think this will pop up in another way, we can close it.

@jamesfredley
Copy link
Author

grails/grails-forge#395

@davydotcom
Copy link
Contributor

so this issue is purely related to the gradle side?

@davydotcom
Copy link
Contributor

you do need it in grails run-app or dev but not in the final jar or war. need a way to inject this dependency but NOT package it in the war/jar

@mkobel
Copy link
Contributor

mkobel commented Nov 11, 2024

We have a similar, probably related, issue using spring boot .

A possible workaround is adding graalvm to implementation in build.gradle:

dependecies {
    [..]
    implementation 'org.graalvm.polyglot:js:24.1.1' // avoid java.lang.ClassNotFoundException: org.graalvm.polyglot.Value when calling js file
    implementation 'org.graalvm.polyglot:polyglot:24.1.1' // avoid java.lang.ClassNotFoundException: org.graalvm.polyglot.Value when 
calling js file
    [..]
}

Using implementation 'org.graalvm.sdk:graal-sdk:24.1.1' as workaround works too.

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

Successfully merging this pull request may close these issues.

4 participants