We are switching from CF2018 to lucee and I ran in...
# lucee
m
We are switching from CF2018 to lucee and I ran into a problem with some java objects that we use to get google analytics data. When one of them is initialized I get 'No matching Constructor for com.google.api.services.analytics.Analytics$Builder(com.google.api.client.http.javanet.NetHttpTransport, com.google.api.client.json.jackson2.JacksonFactory, lucee.runtime.java.JavaObject) found'. The third argument is showing as lucee.runtime.java.JavaObject, when the object I am passing is a com.google.api.client.http.HttpRequestInitializer. It has the correct class when I dump it out, but not when I try to pass it to the other object.
Our server is on 5.3.8.206 and I also tested on 5.3.9.141 and I get the same result.
b
That's interesting. Can you toss together a repro case somewhere?
m
Yeah I'll see if I can put together a simple example.
Ok this repo shows the issue if you run the index.cfm
d
It feels like I've seen this behavior before when I had a Java object that was loaded in a different class loader than the class I was trying to use.
m
I don't think that is happening here. You can look at the example now. It is just a few createObject calls on the same page.
I'm not really sure what is going on though, so it could be related
d
com.google.api.client.http.HttpRequestInitializer appears to be an Interface, not a class
It would seem like you need com.google.api.client.http.BasicAuthentication instead
m
yeah I'll try that. It is weird. This code was running on cf2018
It still gets the same error even if I change that.
I think I figured it out.
If I change that to the BasicAuthentication class, then it has a constructor that takes 2 strings as arguments. If I call init() and pass 2 empty strings, then the line that was erroring works.
It is still a bit mysterious how it was working before.
And I'll have to see if it actually works when I pass in 2 empty strings, or if those arguments are important to what I am doing.
d
I'm surprised it worked in CF2018.
The docs for the Builder class say you can pass in
null
for the
HttpRequestInitializer
argument, so that's what I'd do if you don't need the BasicAuthenticator. I actually wonder if that's why it was working in CF2018, because trying to create an instance of
com.google.api.client.http.HttpRequestInitializer
was actually generating a
null
value.
m
yeah that seems to work, and would kind of make sense as to why it was working
Thanks for the help