1

似乎无法使其正常工作。

以下是使用 Java 设置服务的文档:https ://developers.google.com/admin-sdk/directory/v1/guides/delegation

我正在尝试在 ColdFusion 中重新创建它。这是我的代码:

    var p12File = createObject( 'java', 'java.io.File' ).init( [File Location] );
    var accountId = JavaCast( "string", "[Account Email]" );

    var GoogleCredential = createObject( "java", "com.google.api.client.googleapis.auth.oauth2.GoogleCredential$Builder" );
    var HttpTransport = createObject( "java", "com.google.api.client.http.HttpTransport" );
    var NetHttpTransport = createObject( "java", "com.google.api.client.http.javanet.NetHttpTransport" );
    var JsonFactory = createObject( "java", "com.google.api.client.json.JsonFactory" );
    var JacksonFactory = createObject( "java", "com.google.api.client.json.jackson.JacksonFactory" );
    var Directory = createObject( "java", "com.google.api.services.admin.directory.Directory$Builder" );
    var DirectoryScopes = createObject( "java", "com.google.api.services.admin.directory.DirectoryScopes" );
    var Collections = createObject( "java", "java.util.Collections" );


    var credential = GoogleCredential
        .setTransport( NetHttpTransport )
        .setJsonFactory( JacksonFactory )
        .setServiceAccountId( accountId )
        .setServiceAccountScopes( Collections.singleton( DirectoryScopes.ADMIN_DIRECTORY_USER ) )
        .setServiceAccountPrivateKeyFromP12File( p12File )
        .build();

    var service = Directory.Init( NetHttpTransport, JacksonFactory, javaCast( "null", "" ) ).setHttpRequestInitializer( credential ).build();

在我尝试创建服务之前,一切似乎都运行良好。我收到以下错误消息:

    Object instantiation exception. An exception occurred while instantiating a Java object. The class must not be an interface or an abstract class. Error: ''. 

如果有区别,我正在使用 ColdFusing 11 ColdBox 4.0。提前感谢你们可以提供的任何帮助!

4

0 回答 0