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

"Constructor doesn't exist" while calling Java constructor having Parent Interface in the Definition. #497

Open
shardul-rajhans-precisely opened this issue Aug 18, 2022 · 0 comments

Comments

@shardul-rajhans-precisely
Copy link

shardul-rajhans-precisely commented Aug 18, 2022

We have a hierarchy where the 2 classes 'DefaultDownloadManager' and 'S3DownloadManager' implements the 'DownloadManager' interface. There is a Java class 'AddressingProvider' which has the following constructor.

public AddressingProvider(String path, DownloadManager downloadManager, List<String> resources, String libAddress) {
// Other Initialization Stuff
} 

I call the AddressingProvider constructor as follows:

Addressing_Provider = gateway.jvm.com.bigdata.spark.api.AddressingProvider(someString, defaultDownloadManager, somePythonList, someOtherInput)

When I call the constructor from python by accessing the AddressingProvider class from a gateway jvm, I get the following exception:

An error occurred while calling None.com.bigdata.spark.api.AddressingProvider. Trace:
py4j.Py4JException: Constructor com.bigdata.spark.api.AddressingProvider([class java.lang.String, class com.bigdata.spark.api.internal.DefaultDownloadManager, class java.util.ArrayList, class java.lang.String]) does not exist
at py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:179)
at py4j.reflection.ReflectionEngine.getConstructor(ReflectionEngine.java:196)
at py4j.Gateway.invoke(Gateway.java:237)
at py4j.commands.ConstructorCommand.invokeConstructor(ConstructorCommand.java:80)
at py4j.commands.ConstructorCommand.execute(ConstructorCommand.java:69)
at py4j.ClientServerConnection.waitForCommands(ClientServerConnection.java:182)
at py4j.ClientServerConnection.run(ClientServerConnection.java:106)
at java.base/java.lang.Thread.run(Thread.java:834)

I am not able to understand why Py4j is not accepting the Child Class DefaultDownloadManager in the constructor? Does it only accepts the actual classes?

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

No branches or pull requests

1 participant