Migrate from Play 2.0.4 to 2.1: Tika doesn't find my class anymore - scala

I migrated a web application from Play Framework 2.0.4 to 2.1.
The application uses Apache Tika (V. 1.3) with a custom parser as described here on the Tika-Homepage.
A file myPlayProject/conf/META-INF/services/org.apache.tika.parser.Parsercontains the name of the custom parser class like this:
# Add here all custom parsers for Apache Tika.
com.test.CustomTikaParser
The custom parser will get detected with Play 2.0.4, but not anymore with Play 2.1. I have tried it with two fresh 2.0.4vs2.1-projects and got the same problem with V. 2.1.
Has something changed with the classpath between these Play versions?
(I can read the file META-INF/services/org.apache.tika.parser.Parser with Play 2.0.4 and Play 2.1 under the classpath.)

maybe try a simple command :
play clean-all update reload compile,
it will be clean your .target do an update and reload of your application then a compile...

Related

UnsupportedClassVersionError on play with JDK 1.7

I am getting the same error as this post. i'm trying to resolve the problem as mentioned in the proposed solution but i didn't understand how ?
If you are using version 2.4.x (or newer), you must use Java 8. From the Highlights of version 2.4:
Play 2.4 now requires JDK 8. Due to this, Play can, out of the box, provide support for Java 8 data types. For example, Play’s JSON APIs now support Java 8 temporal types including Instance, LocalDateTime and LocalDate.
To confirm that you are using Play 2.4, see file project/plugins.sbt.
Edit:
If you can't (or don't want to) use Java 8, you have to use Play 2.3 instead. To do so, you must edit project/plugins.sbt to change the used version of Play:
// Notice we are now using version 2.3.10
addSbtPlugin("com.typesafe.play" % "sbt-plugin" % "2.3.10")
If this is a brand new project, you can recreate it using 2.3 template instead:
activator new play-scala-2.3 name-of-your-project
Or, for Java:
activator new play-java-2.3 name-of-your-project

play querydsl plugin Limiting Qclass generation by package

I am using play framework version 2.2.0 and using play-querydsl plugin.
I am using Spring Data JPA version 1.7.2 integrated with play framework.
I am not using querydsl for all the model classes and only for few scenarios which are not supported by Spring Data JPA such as mixing more than one AND, OR checks in the WHERE clause.
Hence I would like to limit the generation of the QClasses by the play-querydsl plugin to few packages only and not all the packages which contain ENTITY classes.
I referred to https://github.com/CedricGatay/play-querydsl and added the QueryDSLPlugin.queryDSLPackage entry to my build.sbt as below :
playJavaSettings ++ QueryDSLPlugin.queryDSLSettings
QueryDSLPlugin.queryDSLPackage := "com.codetroopers.app.models"
But after this, when I try to build the play app using activator, the Q classes are not getting generated. When I removed the QueryDSLPlugin.queryDSLPackage entry from my build.sbt file, the Q classes are generated normally for all ENTITY classes inside models package.
Is there a way to limit the Q class generation by the plugin to only few packages or to only package ?
Vijay
Check out version 0.1.2 of the plugin -it's just been released. According to docs:
//From Play 2.3 and onward (thanks to autoImport feature)
queryDSLPackage := "com/codetroopers/app/models"
//OR Up to play 2.2
QueryDSLPlugin.queryDSLPackage := "com/codetroopers/app/models"
I'm using Play 2.3 and can confirm that it now works as expected (everything under com/codetroopers/app/models is scanned recursively).

In Play 2.3 and above, how do you create a war file?

I'm trying to do this for a scala Play app. With Play 2.3, the play command is replaced by activator. And the following doesn't work:
activator war myapp -o myapp.war
Only Play 1.x had built in war generation. Since 2.0 you've had to use the Play2-War plugin. Support for Play 2.3 is currently in beta.

Can create a play 2.2.0 project -- Error adding module to project: Cannot create module

I have play 2.2.0 and IntellyJ Idea 12 and Play Framework plugin for it. I can create a play project due to the error Error adding module to project: Cannot create module
Why is that?

configuring Play framework with Scala to use Neo4j graph db

I'm using scala in my app, it run without problem, but if I add neo4j in the dependencies, it throws a NoSuchMethod error. I didn't even have references to any neo4j classes in my code...
I have no problem using play framework with scala, or play framework (Java) with neo4j, just when using both together, it crash...
and I tried both neo4j 1.4.2 and 1.5.M02 to no avail.
thanks for any help~
Chris
dependencies.yml
# Application dependencies
require:
- play
- play -> scala 0.9.1
- org.neo4j -> neo4j 1.4.2
exception details:
play.exceptions.UnexpectedException: Unexpected Error
at play.Invoker$Invocation.onException(Invoker.java:232)
at play.Invoker$Invocation.run(Invoker.java:273)
at Invocation.HTTP Request(Play!)
Caused by: java.lang.NoSuchMethodError: scala.collection.generic.GenericTraversableTemplate.flatten(Lscala/Function1;)Lscala/collection/Traversable;
at play.scalasupport.compiler.PlayScalaCompiler$.scanFiles(ScalaCompiler.scala:18)
at play.scalasupport.compiler.PlayScalaCompiler$$anonfun$scanFiles$1.apply(ScalaCompiler.scala:17)
at play.scalasupport.compiler.PlayScalaCompiler$$anonfun$scanFiles$1.apply(ScalaCompiler.scala:15)
at play.scalasupport.compiler.PlayScalaCompiler$.scanFiles(ScalaCompiler.scala:15)
at play.scalasupport.compiler.PlayScalaCompiler$$anonfun$scanFiles$1.apply(ScalaCompiler.scala:17)
at play.scalasupport.compiler.PlayScalaCompiler$$anonfun$scanFiles$1.apply(ScalaCompiler.scala:15)
at play.scalasupport.compiler.PlayScalaCompiler$.scanFiles(ScalaCompiler.scala:15)
at play.scalasupport.ScalaPlugin$$anonfun$templates$1.apply(ScalaPlugin.scala:178)
at play.scalasupport.ScalaPlugin$$anonfun$templates$1.apply(ScalaPlugin.scala:177)
at play.scalasupport.ScalaPlugin.templates(ScalaPlugin.scala:177)
at play.scalasupport.ScalaPlugin.update(ScalaPlugin.scala:195)
at play.scalasupport.ScalaPlugin.detectClassesChange(ScalaPlugin.scala:107)
at play.plugins.PluginCollection.detectClassesChange(PluginCollection.java:358)
at play.Play.detectChanges(Play.java:594)
at play.Invoker$Invocation.init(Invoker.java:186)
... 1 more
it turns out that scala-library-2.9.0-1.jar is included as a dependency for neo4j...
every time I run play dependencies it will be downloaded into the lib folder, after I delete it from the folder, it works without problem (so far I just have code for starting and shutting down of the DB).
The Cypher Query language depends on Scala. We will update that dependency to 2.9.1 for the 1.5 release.