java.lang.ClassCastException: class lucee.runtime.java.JavaObject cannot be cast to class io.proactive.GraphQLProvider

Description

Hi,
I’m getting casting errors in multiple places as we try to upgrade from lucee 5 to 6
The following works in 6.1.1.118 but breaks in 6.2.0.284 (but we can’t use 6.1.1.118 because of other issues)
we are getting casting errors when passing Lucee objects to Java. Below is one example

//Application.cfc code creating our custom WebSocketServer for GraphQL subscriptions ... application.GQL = new GraphQL() var websocketServer = createObject("java", "websockets.WebSocketServer").init(application.GQL)

 

//GraphQL.cfc component displayname="GraphQL" { this.GQL = createObject("java","path.to.GraphQLProvider") public any function init() { ...
//WebSocketServer.java public WebSocketServer(Component graphqlObject) { //trying to cast graphqlObject passed from cf to type GraphQLProvider GraphQLProvider context = (GraphQLProvider) graphqlObject.get("GQL"); }

This Works in 5.4.3.16-light-nginx-tomcat9.0-jdk11-temurin-focal or lucee:6.1.1.118-nginx-tomcat9.0-jdk21-temurin-jammy

In 6.2.0.284 we get this error

java.lang.ClassCastException: class lucee.runtime.java.JavaObject cannot be cast to class io.proactive.GraphQLProvider (lucee.runtime.java.JavaObject is in unnamed module of loader org.apache.felix.framework.BundleWiringImpl$BundleClassLoader @205b132e; io.proactive.GraphQLProvider is in unnamed module of loader java.net.URLClassLoader @1cf4f579) graphql-app | at websockets.WebSocketServer.<init>(WebSocketServer.java:26) graphql-app | at lucee.invoc.wrap.v4.websockets.WebSocketServer.____init_____11gjzcmqfqnlx.apply(Unknown Source) graphql-app | at lucee.runtime.reflection.pairs.ConstructorInstance.invoke(ConstructorInstance.java:63) graphql-app | at lucee.runtime.reflection.Reflector.callConstructor(Reflector.java:841) graphql-app | at lucee.runtime.java.JavaObject.init(JavaObject.java:308) graphql-app | at lucee.runtime.java.JavaObject.call(JavaObject.java:247) graphql-app | at lucee.runtime.java.JavaObject.call(JavaObject.java:280) graphql-app | at lucee.runtime.util.VariableUtilImpl.callFunctionWithoutNamedValues(VariableUtilImpl.java:797) graphql-app | at lucee.runtime.PageContextImpl.getFunction(PageContextImpl.java:2050) graphql-app | at application_cfc$cf.udfCall(/Application.cfc:120)

Please let me know if you need any further info.

Cheers
Regan

Environment

Docker Image: lucee:6.2.0.284-RC-light-nginx-tomcat10.1-jre21-temurin-jammy

Activity

Show:

Regan Simons 27 January 2025 at 20:59

This issue is fixed for us in 6.2.0.298. Many thanks for resolving this quickly slightly smiling face

Michael Offner 24 January 2025 at 20:28

please give it a try

Michael Offner 24 January 2025 at 20:28

Michael Offner 24 January 2025 at 17:16

important part


class lucee.runtime.java.JavaObject cannot be cast to class com.proworkflow.test.LuceeJavaObject at com.proworkflow.test.LuceeObjectConsumer.<init>(LuceeObjectConsumer.java:12) at lucee.invoc.wrap.v4.com.proworkflow.test.LuceeObjectConsumer.____init_____11gjzcmqfqnlx.apply(Unknown Source) at lucee.runtime.reflection.pairs.ConstructorInstance.invoke(ConstructorInstance.java:63)
Fixed

Details

Assignee

Reporter

Priority

Labels

Fix versions

New Issue warning screen

Before you create a new Issue, please post to the mailing list first https://dev.lucee.org

Once the issue has been verified, one of the Lucee team will ask you to file an issue

Sprint

Affects versions

Created 16 January 2025 at 15:47
Updated 27 January 2025 at 21:08
Resolved 27 January 2025 at 21:08

Flag notifications