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

[Task]: Update GoogleDrive VFS #2524

Open
hansva opened this issue Mar 8, 2023 · 9 comments
Open

[Task]: Update GoogleDrive VFS #2524

hansva opened this issue Mar 8, 2023 · 9 comments
Assignees
Labels
P2 Default Priority task VFS

Comments

@hansva
Copy link
Contributor

hansva commented Mar 8, 2023

What needs to happen?

The GoogleDrive VFS uses old style key and some of the underlying libraries are outdated.
Also make it possible to use the instance role to use authentication.

Issue Priority

Priority: 2

Issue Component

Component: VFS

@MoisesArruda
Copy link

Same problem here

@pauloricardoferreira
Copy link

Same problem here.

Config:

image

Json:

image

Logs Text Input:

Error browsing to location: 'googledrive://'
HopFileException:

Unable to get VFS File object for filename 'googledrive://' : Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".
Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".

Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".

Root cause: IllegalArgumentException:

org.apache.hop.core.exception.HopFileException:

Unable to get VFS File object for filename 'googledrive://' : Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".
Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".

Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".

at org.apache.hop.core.vfs.HopVfs.getFileObject(HopVfs.java:194)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.refreshBrowser(HopVfsFileDialog.java:878)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.enteredFilenameOrFolder(HopVfsFileDialog.java:684)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.lambda$open$2(HopVfsFileDialog.java:329)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.open(HopVfsFileDialog.java:581)
at org.apache.hop.ui.core.dialog.BaseDialog.presentFileDialog(BaseDialog.java:263)
at org.apache.hop.ui.core.dialog.BaseDialog.presentFileDialog(BaseDialog.java:163)
at org.apache.hop.pipeline.transforms.fileinput.text.TextFileInputDialog.lambda$open$8(TextFileInputDialog.java:470)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
at org.apache.hop.ui.core.dialog.BaseDialog.defaultShellHandling(BaseDialog.java:513)
at org.apache.hop.pipeline.transforms.fileinput.text.TextFileInputDialog.open(TextFileInputDialog.java:487)
at org.apache.hop.ui.hopgui.file.pipeline.delegates.HopGuiPipelineTransformDelegate.editTransform(HopGuiPipelineTransformDelegate.java:174)
at org.apache.hop.ui.hopgui.file.pipeline.HopGuiPipelineGraph.editTransform(HopGuiPipelineGraph.java:3342)
at org.apache.hop.ui.hopgui.file.pipeline.HopGuiPipelineGraph.editTransform(HopGuiPipelineGraph.java:2163)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.hop.core.gui.plugin.action.GuiActionLambdaBuilder.lambda$createLambda$0(GuiActionLambdaBuilder.java:96)
at org.apache.hop.ui.hopgui.context.GuiContextUtil.lambda$handleActionSelection$0(GuiContextUtil.java:183)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4043)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3648)
at org.apache.hop.ui.hopgui.HopGui.open(HopGui.java:464)
at org.apache.hop.ui.hopgui.HopGui.main(HopGui.java:351)

Caused by: org.apache.commons.vfs2.FileSystemException: Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".
at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.processFile(GoogleDriveFileSystem.java:75)
at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.resolveFile(GoogleDriveFileSystem.java:54)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:75)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:55)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:788)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:754)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:819)
at org.apache.hop.core.vfs.HopVfs.getFileObject(HopVfs.java:188)
... 34 more
Caused by: org.apache.commons.vfs2.FileSystemException
at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.(GoogleDriveFileObject.java:99)
at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.createFile(GoogleDriveFileSystem.java:40)
at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.processFile(GoogleDriveFileSystem.java:73)
... 41 more
Caused by: java.lang.IllegalArgumentException
at com.google.common.base.Preconditions.checkArgument(Preconditions.java:131)
at com.google.api.client.util.Preconditions.checkArgument(Preconditions.java:35)
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.getDetails(GoogleClientSecrets.java:80)
at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeFlow$Builder.(GoogleAuthorizationCodeFlow.java:211)
at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.getCredentials(GoogleDriveFileObject.java:245)
at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.getDriveService(GoogleDriveFileObject.java:255)
at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.(GoogleDriveFileObject.java:96)
... 43 more

@pauloricardoferreira
Copy link

Ow.. new error.

the consent screen appeared to give permission and then it displayed the error below

Error browsing to location: 'googledrive://'
ExceptionInInitializerError:
Root cause: IllegalStateException: You are currently running with version 2.0.1 of google-api-client. You need at least version 1.15 of google-api-client to run version 1.25.0 of the Drive API library.

java.lang.ExceptionInInitializerError
at com.google.api.services.drive.Drive$Builder.build(Drive.java:10116)
at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.getDriveService(GoogleDriveFileObject.java:258)
at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.(GoogleDriveFileObject.java:96)
at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.createFile(GoogleDriveFileSystem.java:40)
at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.processFile(GoogleDriveFileSystem.java:73)
at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.resolveFile(GoogleDriveFileSystem.java:54)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:75)
at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:55)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:788)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:754)
at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:819)
at org.apache.hop.core.vfs.HopVfs.getFileObject(HopVfs.java:188)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.refreshBrowser(HopVfsFileDialog.java:878)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.enteredFilenameOrFolder(HopVfsFileDialog.java:684)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.lambda$open$2(HopVfsFileDialog.java:329)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.open(HopVfsFileDialog.java:581)
at org.apache.hop.ui.core.dialog.BaseDialog.presentFileDialog(BaseDialog.java:263)
at org.apache.hop.ui.core.dialog.BaseDialog.presentFileDialog(BaseDialog.java:163)
at org.apache.hop.pipeline.transforms.fileinput.text.TextFileInputDialog.lambda$open$8(TextFileInputDialog.java:470)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4251)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4068)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3645)
at org.apache.hop.ui.core.dialog.BaseDialog.defaultShellHandling(BaseDialog.java:513)
at org.apache.hop.pipeline.transforms.fileinput.text.TextFileInputDialog.open(TextFileInputDialog.java:487)
at org.apache.hop.ui.hopgui.file.pipeline.delegates.HopGuiPipelineTransformDelegate.editTransform(HopGuiPipelineTransformDelegate.java:174)
at org.apache.hop.ui.hopgui.file.pipeline.HopGuiPipelineGraph.editTransform(HopGuiPipelineGraph.java:3342)
at org.apache.hop.ui.hopgui.file.pipeline.HopGuiPipelineGraph.editTransform(HopGuiPipelineGraph.java:2163)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.base/java.lang.reflect.Method.invoke(Method.java:566)
at org.apache.hop.core.gui.plugin.action.GuiActionLambdaBuilder.lambda$createLambda$0(GuiActionLambdaBuilder.java:96)
at org.apache.hop.ui.hopgui.context.GuiContextUtil.lambda$handleActionSelection$0(GuiContextUtil.java:183)
at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:40)
at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages(Synchronizer.java:132)
at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:4043)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3648)
at org.apache.hop.ui.hopgui.HopGui.open(HopGui.java:464)
at org.apache.hop.ui.hopgui.HopGui.main(HopGui.java:351)
Caused by: java.lang.IllegalStateException: You are currently running with version 2.0.1 of google-api-client. You need at least version 1.15 of google-api-client to run version 1.25.0 of the Drive API library.
at com.google.common.base.Preconditions.checkState(Preconditions.java:534)
at com.google.api.client.util.Preconditions.checkState(Preconditions.java:113)
at com.google.api.services.drive.Drive.(Drive.java:48)
... 46 more

@pauloricardoferreira
Copy link

Hello.

I performed a test with version 0.70 and managed to connect with googledrive following the documentation recommendations

I released the google account for third-party Apps

I added an API of type Oauth2.

After these steps I was successful in reading files

@hansva
Copy link
Contributor Author

hansva commented Mar 13, 2023

We can tackle it all with this ticket and add some tests to check if everything keeps working.
The documentation could probably also use an update when we start working on this

@pauloricardoferreira
Copy link

Hello...

They managed to move forward with this Ticket.

I'm on version 2.9.0 and the problem still persists.

@pauloricardoferreira
Copy link

I found another problem with Google VFS.

When trying to access the folder where the Google credentials are, I am receiving the error below.

image

Error browsing to location: 'C:\opt\apache\hop\google'
ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
Root cause: ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0

java.lang.ArrayIndexOutOfBoundsException: Index -1 out of bounds for length 0
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.populateFolder(HopVfsFileDialog.java:1003)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.refreshBrowser(HopVfsFileDialog.java:897)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.fileDefaultSelected(HopVfsFileDialog.java:812)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
at org.apache.hop.ui.core.vfs.HopVfsFileDialog.open(HopVfsFileDialog.java:581)
at org.apache.hop.ui.core.dialog.BaseDialog.presentFileDialog(BaseDialog.java:269)
at org.apache.hop.ui.core.dialog.BaseDialog.presentFileDialog(BaseDialog.java:163)
at org.apache.hop.ui.core.gui.GuiCompositeWidgets.lambda$getTextControl$2(GuiCompositeWidgets.java:488)
at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:89)
at org.eclipse.swt.widgets.Display.sendEvent(Display.java:4256)
at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:1066)
at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:4054)
at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:3642)
at org.apache.hop.ui.hopgui.HopGui.open(HopGui.java:473)
at org.apache.hop.ui.hopgui.HopGui.main(HopGui.java:351)

@gingras
Copy link

gingras commented Nov 18, 2024

Still getting "Unable to get VFS File object for filename 'googledrive://'" and "Index -1 out of bounds for length 0" on version 2.10. No replies in a while, has anyone gotten this working?

@bamaer
Copy link
Contributor

bamaer commented Nov 25, 2024

Caused by: org.apache.commons.vfs2.FileSystemException: Unknown message with code "Unable to get Google Drive file object for 'googledrive:///'".
	at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.processFile(GoogleDriveFileSystem.java:74)
	at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.resolveFile(GoogleDriveFileSystem.java:53)
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:75)
	at org.apache.commons.vfs2.provider.AbstractOriginatingFileProvider.findFile(AbstractOriginatingFileProvider.java:55)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:788)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:754)
	at org.apache.commons.vfs2.impl.DefaultFileSystemManager.resolveFile(DefaultFileSystemManager.java:819)
	at org.apache.hop.core.vfs.HopVfs.getFileObject(HopVfs.java:231)
	... 31 more
Caused by: org.apache.commons.vfs2.FileSystemException: Unknown message with code "class com.google.api.client.auth.oauth2.StoredCredential cannot be cast to class com.google.api.client.auth.oauth2.StoredCredential (com.google.api.client.auth.oauth2.StoredCredential is in unnamed module of loader 'app'; com.google.api.client.auth.oauth2.StoredCredential is in unnamed module of loader org.apache.hop.core.plugins.HopURLClassLoader @e706aa)".
	at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.<init>(GoogleDriveFileObject.java:98)
	at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.createFile(GoogleDriveFileSystem.java:39)
	at org.apache.hop.vfs.googledrive.GoogleDriveFileSystem.processFile(GoogleDriveFileSystem.java:72)
	... 38 more
Caused by: java.lang.ClassCastException: class com.google.api.client.auth.oauth2.StoredCredential cannot be cast to class com.google.api.client.auth.oauth2.StoredCredential (com.google.api.client.auth.oauth2.StoredCredential is in unnamed module of loader 'app'; com.google.api.client.auth.oauth2.StoredCredential is in unnamed module of loader org.apache.hop.core.plugins.HopURLClassLoader @e706aa)
	at com.google.api.client.auth.oauth2.AuthorizationCodeFlow.loadCredential(AuthorizationCodeFlow.java:280)
	at com.google.api.client.extensions.java6.auth.oauth2.AuthorizationCodeInstalledApp.authorize(AuthorizationCodeInstalledApp.java:101)
	at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.getCredentials(GoogleDriveFileObject.java:247)
	at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.getDriveService(GoogleDriveFileObject.java:251)
	at org.apache.hop.vfs.googledrive.GoogleDriveFileObject.<init>(GoogleDriveFileObject.java:95)
	... 40 more

@bamaer bamaer self-assigned this Nov 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
P2 Default Priority task VFS
Projects
None yet
Development

No branches or pull requests

5 participants