Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
385 views
in Technique[技术] by (71.8m points)

playframework - sbt compile fails due to missing constructor Jedis(java.net.URI) in Jedis 2.1.0

My simple project has a library dependency on Jedis (the Java Redis library):

name := "fit001"

version := "1.0-SNAPSHOT"

libraryDependencies ++= Seq(
  javaJdbc,
  javaEbean,
  cache,
  "redis.clients" % "jedis" % "2.1.0"
)

play.Project.playJavaSettings

I ran both play update and play dependencies successfully.

Here are the resolved dependencies of your application:

+-------------------------------------------------------------------+--------------------------------------------------------+------------------------------+
| Module                                                            | Required by                                            | Note                         |
+-------------------------------------------------------------------+--------------------------------------------------------+------------------------------+
| redis.clients:jedis:2.1.0                                         | default:fit001_2.10:1.0-SNAPSHOT                       | As jedis-2.1.0.jar           |
+-------------------------------------------------------------------+--------------------------------------------------------+------------------------------+
| commons-pool:commons-pool:1.5.5                                   | redis.clients:jedis:2.1.0                              | As commons-pool-1.5.5.jar    |
+-------------------------------------------------------------------+--------------------------------------------------------+------------------------------+
| com.typesafe.play:play-cache_2.10:2.2.0                           | default:fit001_2.10:1.0-SNAPSHOT                       | As play-cache_2.10.jar       |

But when I execute sbt compile, it reports the following issue:

[error] /Users/jkwok/Personal/play/fit001/app/com/games/leaderboard/Leaderboard.java:49: cannot find symbol
[error] symbol  : constructor Jedis(java.net.URI)
[error] location: class redis.clients.jedis.Jedis
[error]         this(leaderboardName, pageSize, new Jedis(uri));

What am I doing wrong?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

The version of the library you selected doesn't seem to have that constructor. https://github.com/xetorthio/jedis/blob/jedis-2.1.0/src/main/java/redis/clients/jedis/Jedis.java

It appears to have been added in 2.2.0.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...