Scala Spark MLLib NoClassDefFoundError - java

I am learning ALS in Spark mllib
bu when i try to create Rating to passing to ALS.train I got this error
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/spark/mllib/recommendation/Rating
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Class.java:2625)
at java.lang.Class.getMethod0(Class.java:2866)
at java.lang.Class.getMethod(Class.java:1676)
at com.intellij.rt.execution.application.AppMain.main(AppMain.java:126)
Caused by: java.lang.ClassNotFoundException: org.apache.spark.mllib.recommendation.Rating
at java.net.URLClassLoader$1.run(URLClassLoader.java:359)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:312)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
... 5 more
Process finished with exit code 1
I use
sbt 0.13.15,
Scala 2.10.4,
spark-core 2.10,
spark-mllib 2.10,
tried on both java 7 and 8
Did I do something wrong?

I found the solution for my case
the thing is i try to run this spark with IntelliJ IDE and I found that in my Build.sbt i have something like this to use dependencies
libraryDependencies ++= Seq( "org.apache.spark" % "spark-core_2.10" % "2.1.0" , "org.apache.spark" % "spark-mllib_2.10" % "2.1.0" % "provided" )
the problem is at "provided" i should change this to "compile" when i try to run with IntelliJ otherwise i'll see error like that

Yep, just remove the provided will solve the problem
libraryDependencies ++= Seq( "org.apache.spark" % "spark-core_2.10" % "2.1.0" ,
"org.apache.spark" % "spark-mllib_2.10" % "2.1.0" )

Related

sbt run works fine but running jar fails

While I am running from sbt
(sbt run)
my akka http service is running fine, however gives the below error on running using jar
(java -jar myservice.jar)
created by publishLocal
(sbt publishLocal)
Exception in thread "main" java.lang.NoClassDefFoundError: org/slf4j/LoggerFactory
at com.rogers.profileauthn.StartProfileAuthService.<clinit>(StartProfileAuthService.java:15)
Caused by: java.lang.ClassNotFoundException: org.slf4j.LoggerFactory
at java.net.URLClassLoader.findClass(URLClassLoader.java:381)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
Dependencies in sbt file are below
val akkaVersion = "2.5.11"
val akkaHttpVersion = "10.0.11"
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % "1.2.3",
"com.typesafe.akka" %% "akka-http" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-stream" % akkaVersion,
"com.typesafe.akka" %% "akka-http-jackson" % akkaHttpVersion,
"com.typesafe.akka" %% "akka-http-testkit" % akkaHttpVersion % Test,
"com.typesafe.akka" %% "akka-testkit" % akkaVersion % Test,
"junit" % "junit" % "4.12" % Test,
"com.novocode" % "junit-interface" % "0.10" % Test,
"com.typesafe.play" %% "play-json" % "2.6.9",
"com.github.swagger-akka-http" %% "swagger-akka-http" % "0.11.0",
"com.google.inject" % "guice" % "4.1.0",
"com.google.guava" % "guava" % "18.0",
"org.mockito" % "mockito-core" % "2.11.0"
)
and the logger I am using is below
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
...
private static final Logger LOGGER = LoggerFactory.getLogger(StartService.class);
LOGGER.info("**** StartService.createAndStartActorSystem Starts ****");
I think thats because the jar did not come packaged with your dependency. Can you try creating a fat jar with sbt assembly? https://github.com/sbt/sbt-assembly. The publishLocal command is used for deploying to an ivy repository and not create jars to run like that i believe. (add plugin and run sbt assembly)

Using phoenix to save a dataframe on Hbase

As the title says, I want to save my DataFrame with phoenix.
I have a spark code in scala that I run on intellij IDEA.
It is quite simple :
import org.apache.spark.sql.SparkSession
import org.apache.phoenix.spark._
object MainTest extends App {
val sparkSession = SparkSession.builder()
.config("spark.sql.warehouse.dir", "file:///c:/tmp/spark-warehouse")
.master("local[*]")
.appName("spark-to-hbase")
.getOrCreate()
val sc = sparkSession.sparkContext
val sqlC = sparkSession.sqlContext
import sqlC.implicits._
val myRdd = sc.parallelize(List(("a",1), ("b", 2)))
myRdd.collect.foreach(println)
val myDf = myRdd.toDF("column1", "column2")
myDf.show()
myDf.saveToPhoenix("MY_TABLE", zkUrl = Some("localhost:16000"))
}
I also have a HBase database runing on the same pc on the port 16000.
The problem is that the line
myDf.saveToPhoenix("MY_TABLE", zkUrl = Some("localhost:16000"))
throw this exception :
Exception in thread "main" java.lang.NoClassDefFoundError:
org/apache/hadoop/hbase/types/DataType at
java.lang.ClassLoader.defineClass1(Native Method) at
java.lang.ClassLoader.defineClass(ClassLoader.java:763) at
java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:467) at
java.net.URLClassLoader.access$100(URLClassLoader.java:73) at
java.net.URLClassLoader$1.run(URLClassLoader.java:368) at
java.net.URLClassLoader$1.run(URLClassLoader.java:362) at
java.security.AccessController.doPrivileged(Native Method) at
java.net.URLClassLoader.findClass(URLClassLoader.java:361) at
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at
java.lang.ClassLoader.loadClass(ClassLoader.java:357) at
org.apache.phoenix.spark.DataFrameFunctions$$anonfun$getFieldArray$2.apply(DataFrameFunctions.scala:72)
at
org.apache.phoenix.spark.DataFrameFunctions$$anonfun$getFieldArray$2.apply(DataFrameFunctions.scala:72)
at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at
scala.collection.TraversableLike$$anonfun$map$1.apply(TraversableLike.scala:234)
at
scala.collection.IndexedSeqOptimized$class.foreach(IndexedSeqOptimized.scala:33)
at
scala.collection.mutable.ArrayOps$ofRef.foreach(ArrayOps.scala:186)
at
scala.collection.TraversableLike$class.map(TraversableLike.scala:234)
at scala.collection.mutable.ArrayOps$ofRef.map(ArrayOps.scala:186)
at
org.apache.phoenix.spark.DataFrameFunctions.getFieldArray(DataFrameFunctions.scala:72)
at
org.apache.phoenix.spark.DataFrameFunctions.saveToPhoenix(DataFrameFunctions.scala:35)
at MainTest$.delayedEndpoint$MainTest$1(MainTest.scala:23) at
MainTest$delayedInit$body.apply(MainTest.scala:8) at
scala.Function0$class.apply$mcV$sp(Function0.scala:34) at
scala.runtime.AbstractFunction0.apply$mcV$sp(AbstractFunction0.scala:12)
at scala.App$$anonfun$main$1.apply(App.scala:76) at
scala.App$$anonfun$main$1.apply(App.scala:76) at
scala.collection.immutable.List.foreach(List.scala:381) at
scala.collection.generic.TraversableForwarder$class.foreach(TraversableForwarder.scala:35)
at scala.App$class.main(App.scala:76) at
MainTest$.main(MainTest.scala:8) at MainTest.main(MainTest.scala)
Caused by: java.lang.ClassNotFoundException:
org.apache.hadoop.hbase.types.DataType at
java.net.URLClassLoader.findClass(URLClassLoader.java:381) at
java.lang.ClassLoader.loadClass(ClassLoader.java:424) at
sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:335) at
java.lang.ClassLoader.loadClass(ClassLoader.java:357) ... 33 more
From what I understand, it seems that java can't find some class.
What can I do ?
My SBT :
name := "spark-to-hbase"
version := "1.0"
scalaVersion := "2.11.8"
libraryDependencies ++= Seq(
"org.apache.hadoop" % "hadoop-mapreduce-client-core" % "2.3.0",
"org.apache.phoenix" % "phoenix-core" % "4.11.0-HBase-1.3",
"org.apache.spark" % "spark-core_2.11" % "2.1.1",
"org.apache.spark" % "spark-sql_2.11" % "2.1.1",
"org.apache.phoenix" % "phoenix-spark" % "4.11.0-HBase-1.3"
)
Method saveToPhoenix takes RDDs. For dataframes, use save (see this doc for more details):
myDf.save("org.apache.phoenix.spark", SaveMode.Overwrite,
Map("MY_TABLE" -> "OUTPUT_TABLE", "zkUrl" -> "localhost:16000"))
I found a solution to my problem.
As the exception says, my compiler isn't able to find the class HBaseConfiguration.
HBaseConfiguration is used inside org.apache.hadoop.hbase library and so is needed to compile.
I noticed that the HBaseConfiguration class wasn't present in the org.apache.hadoop library as I thought.
For the hbase 1.3.1 version installed on my PC computer, I managed to find this class in the hbase-common-1.3.1 jar located in my HBASE_HOME/lib folder.
Then I include this dependency in my built.SBT :
"org.apache.hbase" % "hbase-common" % "1.3.1"
And the Exception was gone.

java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0 in play framework project [duplicate]

This question already has answers here:
How to fix java.lang.UnsupportedClassVersionError: Unsupported major.minor version
(51 answers)
Closed 5 years ago.
Hi Everyone i was facing the below error
[error] java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0
i was using play framework of version 2.5.9.
and java of version 1.7
please find my build and plugins file :
build.sbt
name := """getbike2"""
version := "1.0-SNAPSHOT"
lazy val root = (project in file(".")).enablePlugins(PlayJava, PlayEbean)
scalaVersion := "2.11.7"
libraryDependencies ++= Seq(
javaJdbc,
cache,
javaWs,
"org.mockito" % "mockito-core" % "2.2.22",
"com.google.code.gson" % "gson" % "1.7.1",
"commons-io" % "commons-io" % "2.4",
"org.apache.directory.studio" % "org.apache.commons.io" % "2.4",
"org.apache.poi" % "poi" %"3.9",
"org.apache.poi" % "poi-ooxml" % "3.9"
)
jacoco.settings
parallelExecution in jacoco.Config := false
testOptions += Tests.Argument(TestFrameworks.JUnit, "-v", "-q", "-a")
plugins.sbt:
// The Play plugin
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.5.9")
// Web plugins
addSbtPlugin("com.typesafe.sbt" % "sbt-coffeescript" % "1.0.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-less" % "1.1.0")
addSbtPlugin("com.typesafe.sbt" % "sbt-jshint" % "1.0.4")
addSbtPlugin("com.typesafe.sbt" % "sbt-rjs" % "1.0.8")
addSbtPlugin("com.typesafe.sbt" % "sbt-digest" % "1.1.1")
addSbtPlugin("com.typesafe.sbt" % "sbt-mocha" % "1.1.0")
addSbtPlugin("org.irundaia.sbt" % "sbt-sassify" % "1.4.6")
// Play enhancer - this automatically generates getters/setters for public fields
// and rewrites accessors of these fields to use the getters/setters. Remove this
// plugin if you prefer not to have this feature, or disable on a per project
// basis using disablePlugins(PlayEnhancer) in your build.sbt
addSbtPlugin("com.typesafe.sbt" % "sbt-play-enhancer" % "1.1.0")
// Play Ebean support, to enable, uncomment this line, and enable in your build.sbt using
// enablePlugins(PlayEbean).
addSbtPlugin("com.typesafe.sbt" % "sbt-play-ebean" % "3.0.2")
addSbtPlugin("de.johoop" % "jacoco4sbt" % "2.2.0")
Terminal log:
vave#vave-Lenovo-G500:~/Desktop/getbike/getbike$ activator
[info] Loading project definition from /home/vave/Desktop/getbike/getbike/project
[info] Set current project to getbike2 (in build file:/home/vave/Desktop/getbike/getbike/)
java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:803)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:442)
at java.net.URLClassLoader.access$100(URLClassLoader.java:64)
at java.net.URLClassLoader$1.run(URLClassLoader.java:354)
at java.net.URLClassLoader$1.run(URLClassLoader.java:348)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:347)
at java.lang.ClassLoader.loadClass(ClassLoader.java:425)
at java.lang.ClassLoader.loadClass(ClassLoader.java:358)
at com.typesafe.sbt.web.SbtWeb$$anonfun$com$typesafe$sbt$web$SbtWeb$$load$1.apply(SbtWeb.scala:559)
at com.typesafe.sbt.web.SbtWeb$$anonfun$com$typesafe$sbt$web$SbtWeb$$load$1.apply(SbtWeb.scala:559)
at scala.Option.fold(Option.scala:157)
at com.typesafe.sbt.web.SbtWeb$.com$typesafe$sbt$web$SbtWeb$$load(SbtWeb.scala:573)
at com.typesafe.sbt.web.SbtWeb$$anonfun$globalSettings$1$$anonfun$apply$1.apply(SbtWeb.scala:143)
at com.typesafe.sbt.web.SbtWeb$$anonfun$globalSettings$1$$anonfun$apply$1.apply(SbtWeb.scala:143)
at scala.Function1$$anonfun$andThen$1.apply(Function1.scala:55)
at sbt.Project$.setProject(Project.scala:319)
at sbt.BuiltinCommands$.doLoadProject(Main.scala:503)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:484)
at sbt.BuiltinCommands$$anonfun$loadProjectImpl$2.apply(Main.scala:484)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
at sbt.Command$$anonfun$applyEffect$1$$anonfun$apply$2.apply(Command.scala:59)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
at sbt.Command$$anonfun$applyEffect$2$$anonfun$apply$3.apply(Command.scala:61)
at sbt.Command$.process(Command.scala:93)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
at sbt.MainLoop$$anonfun$1$$anonfun$apply$1.apply(MainLoop.scala:96)
at sbt.State$$anon$1.process(State.scala:184)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
at sbt.MainLoop$$anonfun$1.apply(MainLoop.scala:96)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:17)
at sbt.MainLoop$.next(MainLoop.scala:96)
at sbt.MainLoop$.run(MainLoop.scala:89)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:68)
at sbt.MainLoop$$anonfun$runWithNewLog$1.apply(MainLoop.scala:63)
at sbt.Using.apply(Using.scala:24)
at sbt.MainLoop$.runWithNewLog(MainLoop.scala:63)
at sbt.MainLoop$.runAndClearLast(MainLoop.scala:46)
at sbt.MainLoop$.runLoggedLoop(MainLoop.scala:30)
at sbt.MainLoop$.runLogged(MainLoop.scala:22)
at sbt.StandardMain$.runManaged(Main.scala:54)
at sbt.xMain.run(Main.scala:29)
at xsbt.boot.Launch$$anonfun$run$1.apply(Launch.scala:109)
at xsbt.boot.Launch$.withContextLoader(Launch.scala:128)
at xsbt.boot.Launch$.run(Launch.scala:109)
at xsbt.boot.Launch$$anonfun$apply$1.apply(Launch.scala:35)
at xsbt.boot.Launch$.launch(Launch.scala:117)
at xsbt.boot.Launch$.apply(Launch.scala:18)
at xsbt.boot.Boot$.runImpl(Boot.scala:41)
at xsbt.boot.Boot$.main(Boot.scala:17)
at xsbt.boot.Boot.main(Boot.scala)
[error] java.lang.UnsupportedClassVersionError: com/typesafe/config/ConfigException : Unsupported major.minor version 52.0
[error] Use 'last' for the full log.
Project loading failed: (r)etry, (q)uit, (l)ast, or (i)gnore?
So please help me how to fix this issue.
Thanks in advance
The Play framework requires Java 8 from version 2.4.0 and higher. You should update your Java to version 8 if you want to keep using Play 2.5.9.
https://www.playframework.com/changelog
Play 2.4.0 “Damiya”
Released 26 May 2015
Dependency injection out of the box.
Testing is easier thanks to better support for mocking.
It is now straightforward to embed Play in your application.
You can now aggregate reverse routers from multiple projects.
More Java 8 integration —- Java 8 is now required.
Choice of standard project layout.
Many new anorm features. Anorm is now its own project!
Upgraded to Ebean 4. Ebean is (also) its own project!
HikariCP is the default connection pool
WS supports Server Name Identification (SNI).

Unresolved dependency error with SecureSocial

I require Secure Social Plugin [http://securesocial.ws/guide/installation.html ] for my project. When I run the play 2 app I am getting the following error.
I also referred the following post: Why is the Unresolved Dependencies error with SecureSocial and Play 2.3.2?
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: UNRESOLVED DEPENDENCIES ::
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
[warn] :: ws.securesocial#securesocial;2.1.4: not found
[warn] ::::::::::::::::::::::::::::::::::::::::::::::
sbt.ResolveException: unresolved dependency:ws.securesocial#securesocial;2.1.4: not found
at sbt.IvyActions$.sbt$IvyActions$$resolve(IvyActions.scala:217)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:126)
at sbt.IvyActions$$anonfun$update$1.apply(IvyActions.scala:125)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$Module$$anonfun$withModule$1.apply(Ivy.scala:115)
at sbt.IvySbt$$anonfun$withIvy$1.apply(Ivy.scala:103)
at sbt.IvySbt.sbt$IvySbt$$action$1(Ivy.scala:48)
at sbt.IvySbt$$anon$3.call(Ivy.scala:57)
at xsbt.boot.Locks$GlobalLock.withChannel$1(Locks.scala:93)
at xsbt.boot.Locks$GlobalLock.xsbt$boot$Locks$GlobalLock$$withChannelRetries$1(Locks.scala:81)
at xsbt.boot.Locks$GlobalLock$$anonfun$withFileLock$1.apply(Locks.scala:102)
at xsbt.boot.Using$.withResource(Using.scala:11)
at xsbt.boot.Using$.apply(Using.scala:10)
at xsbt.boot.Locks$GlobalLock.ignoringDeadlockAvoided(Locks.scala:62)
at xsbt.boot.Locks$GlobalLock.withLock(Locks.scala:52)
at xsbt.boot.Locks$.apply0(Locks.scala:31)
at xsbt.boot.Locks$.apply(Locks.scala:28)
at sbt.IvySbt.withDefaultLogger(Ivy.scala:57)
at sbt.IvySbt.withIvy(Ivy.scala:98)
at sbt.IvySbt.withIvy(Ivy.scala:94)
at sbt.IvySbt$Module.withModule(Ivy.scala:115)
at sbt.IvyActions$.update(IvyActions.scala:125)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1223)
at sbt.Classpaths$$anonfun$sbt$Classpaths$$work$1$1.apply(Defaults.scala:1221)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1244)
at sbt.Classpaths$$anonfun$doWork$1$1$$anonfun$74.apply(Defaults.scala:1242)
at sbt.Tracked$$anonfun$lastOutput$1.apply(Tracked.scala:35)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1246)
at sbt.Classpaths$$anonfun$doWork$1$1.apply(Defaults.scala:1241)
at sbt.Tracked$$anonfun$inputChanged$1.apply(Tracked.scala:45)
at sbt.Classpaths$.cachedUpdate(Defaults.scala:1249)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1214)
at sbt.Classpaths$$anonfun$updateTask$1.apply(Defaults.scala:1192)
at scala.Function1$$anonfun$compose$1.apply(Function1.scala:47)
at sbt.$tilde$greater$$anonfun$$u2219$1.apply(TypeFunctions.scala:42)
at sbt.std.Transform$$anon$4.work(System.scala:64)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1$$anonfun$apply$1.apply(Execute.scala:237)
at sbt.ErrorHandling$.wideConvert(ErrorHandling.scala:18)
at sbt.Execute.work(Execute.scala:244)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.Execute$$anonfun$submit$1.apply(Execute.scala:237)
at sbt.ConcurrentRestrictions$$anon$4$$anonfun$1.apply(ConcurrentRestrictions.scala:160)
at sbt.CompletionService$$anon$2.call(CompletionService.scala:30)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:744)
[error] (*:update) sbt.ResolveException: unresolved dependency: ws.securesocial#securesocial;2.1.4: not found
[error] Total time: 14 s, completed 8 Mar, 2015 9:22:50 AM
Process finished with exit code 1
This is my build.sbt file
name := "testing"
version := "0.1"
lazy val `testing` = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.1"
resolvers ++= Seq(
Resolver.sonatypeRepo("snapshots"),
Resolver.url("SecureSocial Repository", url("http://securesocial.ws/repository/snapshots/"))(Resolver.ivyStylePatterns)
)
libraryDependencies ++= Seq( javaJdbc , javaEbean , cache , javaWs,
"ws.securesocial" % "securesocial" % "2.1.4",
"org.mongodb" % "mongo-java-driver" % "2.12.1",
"org.jongo" % "jongo" % "1.1")
unmanagedResourceDirectories in Test <+= baseDirectory ( _ /"target/web/public/test" )
Am I missing something? Can anyone help me out with this?
Changed "ws.securesocial" % "securesocial" % "2.1.4" to "ws.securesocial" % "securesocial_2.11" % "3.0-M3"
name := "testing"
version := "0.1"
lazy val `testing` = (project in file(".")).enablePlugins(PlayJava)
scalaVersion := "2.11.1"
resolvers += (
Resolver.url("SecureSocial Repository", url("http://securesocial.ws/repository/snapshots/"))(Resolver.ivyStylePatterns)
)
libraryDependencies ++= Seq(
"ws.securesocial" % "securesocial_2.11" % "3.0-M3",
"org.mongodb" % "mongo-java-driver" % "2.12.1",
"org.jongo" % "jongo" % "1.1")
unmanagedResourceDirectories in Test <+= baseDirectory ( _ /"target/web/public/test" )
Check this link for the sample implementation in java and scala.
https://github.com/jaliss/securesocial/tree/master/samples

Unable to resolve mailer and util plugin [2.2 java ]

I am new to play 2.2 framework. I am getting started with secure social plugin and I have unresolved dependencies during compilation.
sbt.ResolveException: unresolved dependency: com.typesafe#play-plugins-util_2.10;2.2.0: not found
[error] unresolved dependency: com.typesafe#play-plugins-mailer_2.10;2.2.0: not found
The content of my build.sbt is:
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
"mysql" % "mysql-connector-java" % "5.1.18",
"com.typesafe" %% "play-plugins-util" % "2.1",
"com.typesafe" %% "play-plugins-mailer" % "2.1",
"securesocial" %% "securesocial" % "master-SNAPSHOT"
)
resolvers += Resolver.url("sbt-plugin-releases",
new URL("http://repo.scala-sbt.org/scalasbt/sbt-plugin-releases"))(Resolver.ivyStylePatterns)
resolvers += Resolver.url("typesafe plugins", new URL("http://repo.typesafe.com/typesafe/releases/"))(Resolver.ivyStylePatterns)
resolvers += Resolver.url("sbt-plugin-snapshots", new URL("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/"))(Resolver.ivyStylePatterns)
and play.plugins is
1000:org.jooq.play.JooqPlugin
150000:com.typesafe.plugin.CommonsMailerPlugin
9994:securesocial.core.DefaultAuthenticatorStore
9995:securesocial.core.DefaultIdGenerator
9996:securesocial.core.providers.utils.DefaultPasswordValidator
9997:securesocial.controllers.DefaultTemplatesPlugin
9998:your.user.Service.Implementation <-- Important: You need to change this
9999:securesocial.core.providers.utils.BCryptPasswordHasher
10004:securesocial.core.providers.UsernamePasswordProvider
I have also tried to download these jars and put them in lib folder. Is this a known issue? It would be great if someone can help me out on this. Also, like in rails, how do we force installing the plugins to a given path like bundle install --path=.path ?
The following build.sbt should work:
name := """hello-play"""
version := "1.0-SNAPSHOT"
resolvers += Resolver.url("sbt-plugin-snapshots", new URL("http://repo.scala-sbt.org/scalasbt/sbt-plugin-snapshots/"))(Resolver.ivyStylePatterns)
libraryDependencies ++= Seq(
javaJdbc,
javaEbean,
cache,
"mysql" % "mysql-connector-java" % "5.1.18",
"com.typesafe" %% "play-plugins-util" % "2.2.0",
"com.typesafe" %% "play-plugins-mailer" % "2.2.0",
"securesocial" %% "securesocial" % "master-SNAPSHOT"
)
play.Project.playScalaSettings

Categories