実際に私は雲のパブ/サブのトピックを取得しようとしています。私は、上記のエラーが発生しているトピックを取得するためにリクエストURLを送信するとき、安らかなWebサービスでコードを書いています。いくつかのルックアップの後、pub/sub 0.17バージョンとguava 19.oバージョンのバージョンの競合のような縫い目がありますが、私はグアバ19バージョンを除外し、18バージョンを追加しました。しかし、私はすべてのグアババージョンで試してみましたが、同じエラーは使用されていません。解決方法とその理由を教えてください。 私は..ここに私のコードを添付 感謝するつもりです。..java.lang.NoSuchMethodError:com.google.common.util.concurrent.MoreExecutors.platformThreadFactory()Ljava/util/concurrent/ThreadFactory;
マイコード:
@Path("/topic")
public class PubSubServices
{
@Path("/gettopic")
@GET
@Produces({ MediaType.TEXT_HTML})
public Response getTopic() throws Exception {
String projectid="My-ProjectID";
String topicname="my-new-topic";
System.out.println("Project name is:"+projectid+" new topic name is:"+topicname);
try
{
TopicAdminClient topicAdminClient topicAdminClient=TopicAdminClient.create();
TopicName topicName = TopicName.create(projectid, topicname);
Topic topic = topicAdminClient.getTopic(topicName);
} catch(Exception e)
{
e.printStackTrace();
}
return Response.status(200).entity(topic.getName();).build();
}
のpom.xml:
<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>
<groupId>PubSub</groupId>
<artifactId>PubSub</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>0.17.2-alpha</version>
<exclusions>
<exclusion>
<artifactId>com.google</artifactId>
<groupId>guava</groupId>
</exclusion>
<exclusion>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
<version>1.22.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-server</artifactId>
<version>2.17</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-multipart</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>com.thetransactioncompany</groupId>
<artifactId>cors-filter</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
</dependency>
</dependencies>
<build>
<finalName>CloudSubPub1</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
</plugins>
</build>
私が作成しました戦争のファイルと私はガラスの魚のサーバーにアップロードされます。 Guava-18のような継ぎ目は、実行時に古いバージョンで上書きされていて、Guava-18はコンパイル時にしか動作しません。私が得た
<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>
<groupId>PubSub</groupId>
<artifactId>PubSub</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-pubsub</artifactId>
<version>0.17.2-alpha</version>
</dependencies>
</project>
Problem is that when I write code with restful web services with jersey I am getting above error, I am not able find solution. Any solution for this please?