Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/maven/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 谷歌云存储运行时错误_Java_Maven_Google App Engine_Google Cloud Storage - Fatal编程技术网

Java 谷歌云存储运行时错误

Java 谷歌云存储运行时错误,java,maven,google-app-engine,google-cloud-storage,Java,Maven,Google App Engine,Google Cloud Storage,我只是尝试使用以下代码从我的GAE(java)中列出我的Google云存储桶的内容: GcsService gcsService = GcsServiceFactory.createGcsService(new RetryParams.Builder() .initialRetryDelayMillis(10) .retryMaxAttempts(10)

我只是尝试使用以下代码从我的GAE(java)中列出我的Google云存储桶的内容:

GcsService gcsService = GcsServiceFactory.createGcsService(new RetryParams.Builder()
                        .initialRetryDelayMillis(10)
                        .retryMaxAttempts(10)
                        .totalRetryPeriodMillis(15000)
                        .build());

try{
     ListResult list = gcsService.list("MyTestBucket", new ListOptions.Builder().setPrefix("testFolder").setRecursive(true).build());
   }
它可以编译,但当我运行它时,我得到了以下错误,我不明白:

Caused by: java.lang.NoSuchMethodError: com.google.appengine.tools.cloudstorage.GcsService.list(Ljava/lang/String;Lcom/google/appengine/tools/cloudstorage/ListOptions;)Lcom/google/appengine/tools/cloudstorage/ListResult;
POM依赖项包括Google存储,如下所示:

<dependency>
    <groupId>com.google.appengine.tools</groupId>
    <artifactId>appengine-gcs-client</artifactId>
    <version>0.6</version>
</dependency>

com.google.appengine.tools
appengine gcs客户端
0.6
我试过各种各样的
,但似乎都不管用。 谢谢 提姆

POM文件:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0</version>

<groupId>com.xyz.abc</groupId>
<artifactId>xyzclienttest</artifactId>

<properties>
    <appengine.app.version>1</appengine.app.version>
    <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>

<prerequisites>
    <maven>3.1.0</maven>
</prerequisites>

<dependencies>
    <!-- Compile/runtime dependencies -->
    <dependency>
        <groupId>com.google.appengine</groupId>
        <artifactId>appengine-api-1.0-sdk</artifactId>
        <version>1.9.54</version>
    </dependency>

    <dependency>
        <groupId>com.google.appengine.tools</groupId>
        <artifactId>appengine-gcs-client</artifactId>
        <version>0.6</version>
    </dependency>

    <dependency>
        <groupId>org.glassfish.jersey.containers</groupId>
        <artifactId>jersey-container-servlet-core</artifactId>
        <version>2.17</version>
    </dependency>
    <dependency>
        <groupId>org.glassfish.jersey.media</groupId>
        <artifactId>jersey-media-moxy</artifactId>
        <version>2.17</version>
    </dependency>
    <dependency>
        <groupId>commons-codec</groupId>
        <artifactId>commons-codec</artifactId>
        <version>1.10</version>
    </dependency>
    <dependency>
        <groupId>com.googlecode.objectify</groupId>
        <artifactId>objectify</artifactId>
        <version>5.1.5</version>
    </dependency>
    <dependency>
        <groupId>javax.servlet</groupId>
        <artifactId>servlet-api</artifactId>
        <version>2.5</version>
        <scope>provided</scope>
    </dependency>
    <dependency>
        <groupId>javax.inject</groupId>
        <artifactId>javax.inject</artifactId>
        <version>1</version>
    </dependency>
    <dependency>
        <groupId>javax.jdo</groupId>
        <artifactId>jdo-api</artifactId>
        <version>3.1</version>
    </dependency>
    <dependency>
        <groupId>com.google.code.gson</groupId>
        <artifactId>gson</artifactId>
        <version>2.3.1</version>
    </dependency>
    <dependency>
        <groupId>com.github.mpkorstanje</groupId>
        <artifactId>simmetrics-core</artifactId>
        <version>3.2.3</version>
    </dependency>

</dependencies>

<build>      <outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>versions-maven-plugin</artifactId>
            <version>2.1</version>
            <executions>
                <execution>
                    <phase>compile</phase>
                    <goals>
                        <goal>display-dependency-updates</goal>
                        <goal>display-plugin-updates</goal>
                    </goals>
                </execution>
            </executions>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
            <configuration>
                <source>1.7</source>
                <target>1.7</target>
                <encoding>UTF-8</encoding>
            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-war-plugin</artifactId>
            <version>2.6</version>
        </plugin>
        <plugin>
            <groupId>com.google.appengine</groupId>
            <artifactId>appengine-maven-plugin</artifactId>
            <version>1.9.54</version>
            <configuration>
                <enableJarClasses>false</enableJarClasses>
                <!-- Comment in the below snippet to bind to all IPs instead of just localhost -->
                <!-- address>0.0.0.0</address>
                <port>8080</port -->
                <!-- Comment in the below snippet to enable local debugging with a remove debugger
                     like those included with Eclipse or IntelliJ -->
                <!-- jvmFlags>
                  <jvmFlag>-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n</jvmFlag>
                </jvmFlags -->
            </configuration>
        </plugin>
    </plugins>
</build>

<reporting>
    <plugins>
        <plugin>
            <groupId>org.codehaus.mojo</groupId>
            <artifactId>findbugs-maven-plugin</artifactId>
            <configuration>
                <!--
                    Enables analysis which takes more memory but finds more bugs.
                    If you run out of memory, changes the value of the effort element
                    to 'low'.
                -->
                <effort>Max</effort>
                <!-- Reports all bugs (other values are medium and max) -->
                <threshold>Low</threshold>
                <onlyAnalyze>com.xyz.abc.*,com.xyz.abc.util.*</onlyAnalyze>
                <!-- Produces XML report -->
                <xmlOutput>true</xmlOutput>
                <xmlOutputDirectory>target/site</xmlOutputDirectory>
            </configuration>
        </plugin>       
    </plugins>
</reporting>

4.0.0
战争
1
com.xyz.abc
XYZ客户机
1.
UTF-8
3.1.0
com.google.appengine
appengine-api-1.0-sdk
1.9.54
com.google.appengine.tools
appengine gcs客户端
0.6
org.glassfish.jersey.containers
jersey容器servlet核心
2.17
org.glassfish.jersey.media
泽西媒体公司
2.17
通用编解码器
通用编解码器
1.10
com.googlecode.objectify
客观化
5.1.5
javax.servlet
servlet api
2.5
假如
javax.inject
javax.inject
1.
javax.jdo
jdoapi
3.1
com.google.code.gson
格森
2.3.1
com.github.mpkorstanje
simmetrics核心
3.2.3
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
org.codehaus.mojo
版本maven插件
2.1
编写
显示依赖项更新
显示插件更新
org.apache.maven.plugins
maven编译器插件
3.5.1
1.7
1.7
UTF-8
org.apache.maven.plugins
maven战争插件
2.6
com.google.appengine
appengine maven插件
1.9.54
错误的
org.codehaus.mojo
findbugs maven插件
马克斯
低的
com.xyz.abc.*,com.xyz.abc.util*
符合事实的
目标/地点

尝试删除
false
。我怀疑这是导致GCS库的JAR没有包含在GAE上运行的工件中的原因。因此,可能缺少必需的类。

修复了它!我查看了.war文件,发现appengine gcs客户端jar文件有两个版本。0.2和0.6。我做了一个mvn清理,它解决了问题。我真的应该在之前这样做:-(生活和学习!

你能分享完整的POM文件吗?可能是其他原因(例如阴影)导致了问题。在原始帖子中添加了完整的POM文件。看到了吗?谢谢,但这似乎没有任何区别。我应该添加其他依赖项的例外吗?