I upgraded play framework to version 2.4, but in my jars file I still see specs2 version 2.4.13 jars that I did not understand their origin, since play framework 2.4 uses specs2 independently this caused a version conflict.
I tried to determine which dependency is calling specs2 version 2.4.13 implicitly with this plugin:
addSbtPlugin("net.virtual-void" % "sbt-dependency-graph" % "0.10.0-RC1")
but it did not resolve the ptoblem.
The output of dependencyTree task:
+-com.github.nscala-time:nscala-time_2.11:2.2.0 [S]
[info] | +-joda-time:joda-time:2.8.2
[info] | +-org.joda:joda-convert:1.2
[info] |
[info] +-com.google.code.findbugs:jsr305:1.3.9
[info] +-com.google.guava:guava:18.0
[info] +-com.madgag:scala-io-file_2.11:0.4.10-itb [S]
[info] | +-com.madgag:scala-io-core_2.11:0.4.10-itb [S]
[info] | | +-com.jsuereth:scala-arm_2.11:2.0 [S]
[info] | |
[info] | +-org.scala-lang.modules:scala-parser-combinators_2.11:1.0.5 [S]
[info] |
[info] +-log4j:log4j:1.2.17
[info] +-net.htmlparser.jericho:jericho-html:3.3
[info] +-net.sourceforge.htmlcleaner:htmlcleaner:2.2
[info] +-org.apache.commons:commons-lang3:3.3.2
[info] +-org.scalaz:scalaz-core_2.11:7.1.3 [S]
[info] | +-org.scala-lang.modules:scala-parser-combinators_2.11:1.0.4 (evicted by: 1.0.5)
[info] | +-org.scala-lang.modules:scala-parser-combinators_2.11:1.0.5 [S]
[info] | +-org.scala-lang.modules:scala-xml_2.11:1.0.4 (evicted by: 1.0.6)
[info] | +-org.scala-lang.modules:scala-xml_2.11:1.0.6 [S]
[info] |
[info] +-xalan:serializer:2.7.2
the origin error is :
* After upgrade, I added to the build sbt file the specs2 dependency, as a result I got 2 versions of jars file and in test file
class testSpec extends Specification with Forms
read Specification from specs version 3.6.6 and read Forms from version 2.4.13 *
Please try a clean-build by removing all the previous conflicting dependencies
Related
I need to install magnolia-rest-content-delivery module in Maven.
Before installing this module I had following dependencies. Project was built and installed without problems.
Question: How it's possible not to define dependency version in magnolia projects?
1st attempt to install without version like others from group info.magnolia.rest
That cause error `[ERROR] 'dependencies.dependency.version' for info.magnolia.rest:magnolia-rest-content-delivery:jar is missing.``
Question: What's so special about magnolia-rest-content-delivery so it does need version?
2nd attempt - add version to
That cause error during deployment
Module Magnolia REST Content Delivery (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
3rd attempt: adding same version to all dependencies in info.magnolia.rest groupId
That cause same error during deployment
Module Magnolia REST Content Delivery (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
What can I try next to resolve issue?
Thank you.
Update:
Project's pom have dependency from magnolia-enterprise-bundle-parent v#5.5.4
in dependency tree I can see that magnolia-rest-integration picked-up version 1.2.1
What would be safe way to override version defined in BOM?
Update 2:
I end-up with overriding dependency versions in dependencyManagement section
Clean local maven repository and build
Regardles that effective pom now shows correct versions for magnolia rest modules result is almost the same
[ERROR] Module Magnolia REST Tools (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
[ERROR] Module Magnolia REST Content Delivery (version 2.0.1) is dependent on rest-integration (version 2.0.1/*),
but Magnolia REST Integration (version 1.2.1) is currently installed.
I couldn't attach dependency tree output file (here is small excerpt)
[INFO] +- info.magnolia.eebundle:magnolia-enterprise-standard-webapp:war:5.5.4:compile
[INFO] +- info.magnolia.rest:magnolia-rest-integration:jar:2.0.1:compile
[INFO] | +- info.magnolia.core:magnolia-configuration:jar:5.5.4:compile
[INFO] | | \- org.atteo:evo-inflector:jar:1.2.1:compile
[INFO] | +- javax.xml.bind:jaxb-api:jar:2.2:compile
[INFO] | | \- javax.xml.stream:stax-api:jar:1.0-2:compile
[INFO] | +- org.jboss.resteasy:resteasy-jaxrs:jar:3.0.19.SP1-redhat-1:compile
[INFO] | | +- org.jboss.spec.javax.annotation:jboss-annotations-api_1.2_spec:jar:1.0.0.Final-redhat-1:compile
[INFO] | | \- org.jboss.logging:jboss-logging:jar:3.3.0.Final-redhat-1:compile
[INFO] | +- org.jboss.resteasy:resteasy-jackson2-provider:jar:3.0.19.SP1-redhat-1:compile
[INFO] | | +- com.fasterxml.jackson.core:jackson-core:jar:2.8.6:compile
[INFO] | | \- com.fasterxml.jackson.jaxrs:jackson-jaxrs-json-provider:jar:2.8.6:compile
[INFO] | | +- com.fasterxml.jackson.jaxrs:jackson-jaxrs-base:jar:2.8.6:compile
[INFO] | | \- com.fasterxml.jackson.module:jackson-module-jaxb-annotations:jar:2.8.6:compile
[INFO] | +- org.jboss.resteasy:resteasy-jaxb-provider:jar:3.0.19.SP1-redhat-1:compile
[INFO] | +- javax.ws.rs:javax.ws.rs-api:jar:2.0:compile
[INFO] | \- com.google.guava:guava:jar:18.0:compile
[INFO] +- info.magnolia.rest:magnolia-rest-services:jar:2.0.1:compile
[INFO] | +- com.fasterxml.jackson.core:jackson-annotations:jar:2.8.0:compile
[INFO] | +- io.swagger:swagger-annotations:jar:1.5.4:compile
[INFO] | +- org.apache.jackrabbit:jackrabbit-jcr-commons:jar:2.12.4:compile
[INFO] | +- commons-codec:commons-codec:jar:1.10:compile
[INFO] | +- org.jboss.resteasy:resteasy-jackson-provider:jar:3.0.19.SP1-redhat-1:compile
[INFO] | | +- org.codehaus.jackson:jackson-core-asl:jar:1.9.12:compile
[INFO] | | +- org.codehaus.jackson:jackson-mapper-asl:jar:1.9.12:compile
[INFO] | | +- org.codehaus.jackson:jackson-jaxrs:jar:1.9.12:compile
[INFO] | | \- org.codehaus.jackson:jackson-xc:jar:1.9.12:compile
[INFO] | \- org.jboss.resteasy:resteasy-client:jar:3.0.19.SP1-redhat-1:compile
[INFO] +- info.magnolia.rest:magnolia-rest-tools:jar:2.0.1:compile
[INFO] | +- io.swagger:swagger-jaxrs:jar:1.5.4:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-yaml:jar:2.8.6:compile
[INFO] | | +- com.fasterxml.jackson.dataformat:jackson-dataformat-xml:jar:2.8.6:compile
[INFO] | | | +- org.codehaus.woodstox:stax2-api:jar:3.1.4:compile
[INFO] | | | \- com.fasterxml.woodstox:woodstox-core:jar:5.0.3:compile
[INFO] | | \- io.swagger:swagger-core:jar:1.5.4:compile
[INFO] | | +- com.fasterxml.jackson.datatype:jackson-datatype-joda:jar:2.8.6:compile
[INFO] | | \- javax.validation:validation-api:jar:1.1.0.Final:compile
[INFO] | \- io.swagger:swagger-models:jar:1.5.4:compile
[INFO] +- info.magnolia.rest:magnolia-rest-content-delivery:jar:2.0.1:compile
[INFO] | +- javax.json:javax.json-api:jar:1.0:compile
[INFO] | +- org.glassfish:javax.json:jar:1.0:compile
[INFO] | \- org.apache.jackrabbit:jackrabbit-spi-commons:jar:2.12.4:compile
[INFO] | \- org.apache.jackrabbit:jackrabbit-spi:jar:2.12.4:compile
The only place where this mistic "Magnolia REST Integration (version 1.2.1)" mentioned is:
.m2\repository\info\magnolia\bundle\magnolia-bundle-parent\5.5.4\magnolia-bundle-parent-5.5.4.pom
Version numbers for rest comes from parent pom that you most likely extend or from dependency section of Magnolia CE or EE webapp that you import or from BOM. No way to say w/o seeing whole pom. As for what's special about Content Delivery - it's not defined in the "source" of versions for other modules hence you need to declare it explicitly.
From the error it most likely looks like you end up with both versions of the artefact in your webapp or version is not being picked up (i.e. some error in your pom). You should not need to declare magnolia-rest-integration at all as it should be pulled in by either magnolia-rest-content-delivery or by -services or -tools modules anyway.
Please include link to whole pom. Also please provide output of running mvn dependency:tree to point out exactly what is wrong.
build.sbt
scalaVersion := "2.11.4"
project/build.properties
sbt.version=0.13.7
Then
> show scalaVersion
[info] 2.11.4
> show crossScalaVersions
[info] List(2.10.4)
> inspect crossScalaVersions
[info] Setting: scala.collection.Seq[java.lang.String] = List(2.10.4)
[info] Description:
[info] The versions of Scala used when cross-building.
[info] Provided by:
[info] */*:crossScalaVersions
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:237
[info] Delegates:
[info] *:crossScalaVersions
[info] {.}/*:crossScalaVersions
[info] */*:crossScalaVersions
[info] Related:
[info] */*:crossScalaVersions
It seems like crossScalaVersions should be List(2.11.4).
Look at SBT's source code, that's also what I would think.
crossScalaVersions := Seq(scalaVersion.value)
Why doesn't crossScalaVersions correspond to scalaVersion?
scalaVersion.value is context-dependent. So in Defaults.scala it's */*:scalaVersion from appConfiguration.value.provider.scalaProvider. It's the version used to compile your project's definition, including your build.sbt file (sbt 0.13.7 uses 2.10.4 scala-compiler to compile your project definitions). And that the only way as your project's definitions (including scalaVersion) isn't compiled yet when Defaults executed and crossScalaVersions defined. So, */*:crossScalaVersions depends on */*:scalaVersion not proj/*:scalaVersion.
Just compare Provided by with explicit scalaVersion := 2.11.4 inside build.sbt:
> inspect scalaVersion
[info] Setting: java.lang.String = 2.11.4
[info] Description:
[info] The version of Scala used for building.
[info] Provided by:
[info] {file:/Users/user/dev/proj/}proj/*:scalaVersion
[info] Defined at:
[info] /Users/user/dev/proj/build.sbt:1
[info] Reverse dependencies (D=derives):
[info] *:allDependencies
[info] D *:scalaBinaryVersion
[info] *:libraryDependencies
[info] *:scalaInstance
[info] *:crossScalaVersions
[info] *:update
[info] Delegates:
[info] *:scalaVersion
[info] {.}/*:scalaVersion
[info] */*:scalaVersion
[info] Related:
[info] */*:scalaVersion
And without one (just empty project):
> inspect scalaVersion
[info] Setting: java.lang.String = 2.10.4
[info] Description:
[info] The version of Scala used for building.
[info] Provided by:
[info] */*:scalaVersion
[info] Defined at:
[info] (sbt.Defaults) Defaults.scala:232
[info] Reverse dependencies:
[info] *:allDependencies
[info] *:libraryDependencies
[info] *:update
[info] *:scalaInstance
[info] Delegates:
[info] *:scalaVersion
[info] {.}/*:scalaVersion
[info] */*:scalaVersion
[info] Related:
[info] */*:scalaVersion
So, you just need to redefine */*:scalaVersion in your build.sbt:
scalaVersion in GlobalScope := "2.11.2"
I just downloaded playframework 2.2.2 and created new project with play new and chose simple scala appplication
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
$cd test
$test>play
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; sup
port was removed in 8.0
[info] Loading project definition from C:\Users\JJ-Solutions\test\project
[info] Set current project to test (in build file:/C:/Users/JJ-Solutions/test/)
_
_ __ | | __ _ _ _
| '_ \| |/ _' | || |
| __/|_|\____|\__ /
|_| |__/
play 2.2.2 built with Scala 2.10.3 (running Java 1.8.0_05), http://www.playframe
work.com
> Type "help play" or "license" for more information.
> Type "exit" or use Ctrl+D to leave this console.
[test] $
When I run play run command. I get this error message when using http://localhost:9000 I get error: The compilation failed without reporting any problem!
$play run
Java HotSpot(TM) 64-Bit Server VM warning: ignoring option MaxPermSize=256M; sup
port was removed in 8.0
[info] Loading project definition from C:\Users\TestUser\test\project
[info] Set current project to play (in build file:/C:/Users/JJ-Solutions/test/)
[info] Updating {file:/C:/Users/JJ-Solutions/test/}test...
[info] Resolving org.scala-lang#scala-library;2.10.3 ...
[info] Resolving com.typesafe.play#play-jdbc_2.10;2.2.2 ...
[info] Resolving com.typesafe.play#play_2.10;2.2.2 ...
[info] Resolving com.typesafe.play#sbt-link;2.2.2 ...
[info] Resolving org.javassist#javassist;3.18.0-GA ...
[info] Resolving com.typesafe.play#play-exceptions;2.2.2 ...
[info] Resolving com.typesafe.play#templates_2.10;2.2.2 ...
[info] Resolving com.github.scala-incubator.io#scala-io-file_2.10;0.4.2 ...
[info] Resolving com.github.scala-incubator.io#scala-io-core_2.10;0.4.2 ...
[info] Resolving com.jsuereth#scala-arm_2.10;1.3 ...
[info] Resolving com.typesafe.play#play-iteratees_2.10;2.2.2 ...
[info] Resolving org.scala-stm#scala-stm_2.10;0.7 ...
[info] Resolving com.typesafe#config;1.0.2 ...
[info] Resolving com.typesafe.play#play-json_2.10;2.2.2 ...
[info] Resolving com.typesafe.play#play-functional_2.10;2.2.2 ...
[info] Resolving com.typesafe.play#play-datacommons_2.10;2.2.2 ...
[info] Resolving joda-time#joda-time;2.2 ...
[info] Resolving org.joda#joda-convert;1.3.1 ...
[info] Resolving com.fasterxml.jackson.core#jackson-annotations;2.2.2 ...
[info] Resolving com.fasterxml.jackson.core#jackson-core;2.2.2 ...
[info] Resolving com.fasterxml.jackson.core#jackson-databind;2.2.2 ...
[info] Resolving org.scala-lang#scala-reflect;2.10.3 ...
[info] Resolving io.netty#netty;3.7.0.Final ...
[info] Resolving com.typesafe.netty#netty-http-pipelining;1.1.2 ...
[info] Resolving org.slf4j#slf4j-api;1.7.5 ...
[info] Resolving org.slf4j#jul-to-slf4j;1.7.5 ...
[info] Resolving org.slf4j#jcl-over-slf4j;1.7.5 ...
[info] Resolving ch.qos.logback#logback-core;1.0.13 ...
[info] Resolving ch.qos.logback#logback-classic;1.0.13 ...
[info] Resolving com.typesafe.akka#akka-actor_2.10;2.2.0 ...
[info] Resolving com.typesafe.akka#akka-slf4j_2.10;2.2.0 ...
[info] Resolving org.apache.commons#commons-lang3;3.1 ...
[info] Resolving com.ning#async-http-client;1.7.18 ...
[info] Resolving oauth.signpost#signpost-core;1.2.1.2 ...
[info] Resolving commons-codec#commons-codec;1.3 ...
[info] Resolving oauth.signpost#signpost-commonshttp4;1.2.1.2 ...
[info] Resolving org.apache.httpcomponents#httpcore;4.0.1 ...
[info] Resolving org.apache.httpcomponents#httpclient;4.0.1 ...
[info] Resolving commons-logging#commons-logging;1.1.1 ...
[info] Resolving xerces#xercesImpl;2.11.0 ...
[info] Resolving xml-apis#xml-apis;1.4.01 ...
[info] Resolving javax.transaction#jta;1.1 ...
[info] Resolving com.jolbox#bonecp;0.8.0.RELEASE ...
[info] Resolving com.google.guava#guava;14.0.1 ...
[info] Resolving com.h2database#h2;1.3.172 ...
[info] Resolving tyrex#tyrex;1.0.1 ...
[info] Resolving com.typesafe.play#anorm_2.10;2.2.2 ...
[info] Resolving com.typesafe.play#play-cache_2.10;2.2.2 ...
[info] Resolving net.sf.ehcache#ehcache-core;2.6.6 ...
[info] Resolving com.typesafe.play#play-test_2.10;2.2.2 ...
[info] Resolving junit#junit;4.11 ...
[info] Resolving org.hamcrest#hamcrest-core;1.3 ...
[info] Resolving org.specs2#specs2_2.10;2.1.1 ...
[info] Resolving org.scalaz#scalaz-core_2.10;7.0.2 ...
[info] Resolving org.scalaz#scalaz-concurrent_2.10;7.0.2 ...
[info] Resolving org.scalaz#scalaz-effect_2.10;7.0.2 ...
[info] Resolving com.novocode#junit-interface;0.10 ...
[info] Resolving org.scala-tools.testing#test-interface;0.5 ...
[info] Resolving com.google.code.findbugs#jsr305;2.0.1 ...
[info] Resolving org.fluentlenium#fluentlenium-festassert;0.8.0 ...
[info] Resolving org.fluentlenium#fluentlenium-core;0.8.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-java;2.32.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-android-driver;2.32.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-remote-driver;2.32.0 ...
[info] Resolving cglib#cglib-nodep;2.1_3 ...
[info] Resolving org.json#json;20080701 ...
[info] Resolving org.seleniumhq.selenium#selenium-api;2.32.0 ...
[info] Resolving org.apache.httpcomponents#httpclient;4.2.1 ...
[info] Resolving org.apache.httpcomponents#httpcore;4.2.1 ...
[info] Resolving commons-codec#commons-codec;1.6 ...
[info] Resolving org.apache.commons#commons-exec;1.1 ...
[info] Resolving net.java.dev.jna#jna;3.4.0 ...
[info] Resolving net.java.dev.jna#platform;3.4.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-chrome-driver;2.32.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-htmlunit-driver;2.32.0 ...
[info] Resolving net.sourceforge.htmlunit#htmlunit;2.12 ...
[info] Resolving xalan#xalan;2.7.1 ...
[info] Resolving xalan#serializer;2.7.1 ...
[info] Resolving commons-collections#commons-collections;3.2.1 ...
[info] Resolving org.apache.httpcomponents#httpmime;4.2.3 ...
[info] Resolving net.sourceforge.htmlunit#htmlunit-core-js;2.12 ...
[info] Resolving net.sourceforge.nekohtml#nekohtml;1.9.18 ...
[info] Resolving net.sourceforge.cssparser#cssparser;0.9.9 ...
[info] Resolving org.w3c.css#sac;1.3 ...
[info] Resolving commons-io#commons-io;2.2 ...
[info] Resolving org.eclipse.jetty#jetty-websocket;8.1.9.v20130131 ...
[info] Resolving org.eclipse.jetty#jetty-util;8.1.9.v20130131 ...
[info] Resolving org.eclipse.jetty#jetty-io;8.1.9.v20130131 ...
[info] Resolving org.eclipse.jetty#jetty-http;8.1.9.v20130131 ...
[info] Resolving org.seleniumhq.selenium#selenium-firefox-driver;2.32.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-ie-driver;2.32.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-iphone-driver;2.32.0 ...
[info] Resolving org.seleniumhq.selenium#selenium-safari-driver;2.32.0 ...
[info] Resolving org.webbitserver#webbit;0.4.14 ...
[info] Resolving org.seleniumhq.selenium#selenium-support;2.32.0 ...
[info] Resolving org.easytesting#fest-assert;1.4 ...
[info] Resolving org.easytesting#fest-util;1.1.6 ...
[info] Resolving com.typesafe.play#play-docs_2.10;2.2.2 ...
[info] Resolving com.typesafe.play#play-doc_2.10;1.0.3 ...
[info] Resolving org.pegdown#pegdown;1.4.0 ...
[info] Resolving org.parboiled#parboiled-java;1.1.5 ...
[info] Resolving org.parboiled#parboiled-core;1.1.5 ...
[info] Resolving org.ow2.asm#asm;4.1 ...
[info] Resolving org.ow2.asm#asm-tree;4.1 ...
[info] Resolving org.ow2.asm#asm-analysis;4.1 ...
[info] Resolving org.ow2.asm#asm-util;4.1 ...
[info] Resolving commons-io#commons-io;2.4 ...
[info] Resolving org.scala-lang#scala-compiler;2.10.3 ...
[info] Resolving org.scala-lang#jline;2.10.3 ...
[info] Resolving org.fusesource.jansi#jansi;1.4 ...
[info] Done updating.
--- (Running the application from SBT, auto-reloading is enabled) ---
[info] play - Listening for HTTP on /0:0:0:0:0:0:0:0:9000
(Server started, use Ctrl+D to stop and go back to the console...)
[info] Compiling 5 Scala sources and 1 Java source to C:\Users\TestUser\test
\target\scala-2.10\classes...
[info] 'compiler-interface' not yet compiled for Scala 2.10.3. Compiling...
[info] Compilation completed in 10.405 s
[error] Error: Could not find or load main class com.sun.tools.javac.Main
[error] (compile:compile) javac returned nonzero exit code
[error] application -
! #6i3ag10ga - Internal server error, for (GET) [/] ->
play.PlayExceptions$UnexpectedException: Unexpected exception[The compilation fa
iled without reporting any problem!]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfu
n$apply$17.apply(PlayReloader.scala:306) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14$$anonfu
n$apply$17.apply(PlayReloader.scala:306) ~[na:na]
at scala.Option.getOrElse(Option.scala:120) ~[scala-library.jar:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(P
layReloader.scala:305) ~[na:na]
at play.PlayReloader$$anon$1$$anonfun$reload$2$$anonfun$apply$14.apply(P
layReloader.scala:298) ~[na:na]
at scala.Option.map(Option.scala:145) ~[scala-library.jar:na]
sbt.compiler.CompileFailed: null
at sbt.compiler.JavaCompiler$JavaTool0.compile(JavaCompiler.scala:77) ~[
na:na]
at sbt.compiler.JavaTool$class.apply(JavaCompiler.scala:35) ~[na:na]
at sbt.compiler.JavaCompiler$JavaTool0.apply(JavaCompiler.scala:63) ~[na
:na]
at sbt.compiler.JavaCompiler$class.compile(JavaCompiler.scala:21) ~[na:n
a]
at sbt.compiler.JavaCompiler$JavaTool0.compile(JavaCompiler.scala:63) ~[
na:na]
at sbt.compiler.AggressiveCompile$$anonfun$3$$anonfun$compileJava$1$1.ap
ply$mcV$sp(AggressiveCompile.scala:126) ~[na:na]
[warn] play - No application found at invoker init
Any idea what would be causing this?
I've added play folder to system environment variables and also I've JAVA_HOME at Path variable.
I've Windows 7 x64 and Oracle JDK 8
java -version
java version "1.8.0_05"
Java(TM) SE Runtime Environment (build 1.8.0_05-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.5-b02, mixed mode)
Looks like your Java setup is not entirely correct which is indicated by these two lines in your log:
[error] Error: Could not find or load main class com.sun.tools.javac.Main
[error] (compile:compile) javac returned nonzero exit code
It means that the Main class could not be found. It is located in tools.jar, which should be in the JAVA_HOME\lib dir.
Re-check your Java installation and make sure all paths are set correctly. Try compiling a simple Java file first to make sure you can compile.
I am trying to set up a local DBpedia Information Extraction Framework, but there seems to have some problems which I cannot deal with. I followed the instructions on the official site using Intelli J, it went well until I get to the final step that tells "select DBpedia dump extraction ->Plugins -> scala ->scala:run", the error message shows below:
D:\program\jdk\bin\java -Dmaven.home=D:\program\apache-maven-3.0.5 -Dclassworlds.conf=D:\program\apache-maven-3.0.5\bin\m2.conf -Didea.launcher.port=7534 "-Didea.launcher.bin.path=D:\program\IntelliJ IDEA Community Edition 12.1.3\bin" -Dfile.encoding=UTF-8 -classpath "D:\program\apache-maven-3.0.5\boot\plexus-classworlds-2.4.jar;D:\program\IntelliJ IDEA Community Edition 12.1.3\lib\idea_rt.jar" com.intellij.rt.execution.application.AppMain org.codehaus.classworlds.Launcher --fail-fast --strict-checksums org.scala-tools:maven-scala-plugin:2.15.2:run
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building DBpedia Dump Extraction 3.8
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> maven-scala-plugin:2.15.2:run (default-cli) # dump >>>
[INFO]
[INFO] --- maven-resources-plugin:2.5:resources (default-resources) # dump ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\code\Scala\extraction_framework\dump\src\main\resources
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:compile (process-resources) # dump ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:compile (default-compile) # dump ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:compile (compile) # dump ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-resources-plugin:2.5:testResources (default-testResources) # dump ---
[debug] execute contextualize
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory E:\code\Scala\extraction_framework\dump\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:2.3.2:testCompile (default-testCompile) # dump ---
[INFO] No sources to compile
[INFO]
[INFO] --- maven-scala-plugin:2.15.2:testCompile (test-compile) # dump ---
[INFO] Checking for multiple versions of scala
[INFO] includes = [**/*.scala,**/*.java,]
[INFO] excludes = []
[WARNING] No source files found.
[INFO]
[INFO] org.dbpedia.extraction.dump.sql.Import
parsing \home\release\wikipedia\wikipedias.csv
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:601)
at org_scala_tools_maven_executions.MainHelper.runMain(MainHelper.java:161)
at org_scala_tools_maven_executions.MainWithArgsInFile.main(MainWithArgsInFile.java:26)
Caused by: java.io.FileNotFoundException: \home\release\wikipedia\wikipedias.csv (ϵͳ�Ҳ���ָ����·����)
at java.io.FileInputStream.open(Native Method)
at java.io.FileInputStream.(FileInputStream.java:138)
at scala.io.Source$.fromFile(Source.scala:91)
at scala.io.Source$.fromFile(Source.scala:76)
at org.dbpedia.extraction.util.WikiInfo$.fromFile(WikiInfo.scala:26)
at org.dbpedia.extraction.util.ConfigUtils$.parseLanguages(ConfigUtils.scala:43)
at org.dbpedia.extraction.dump.sql.Import$.main(Import.scala:26)
at org.dbpedia.extraction.dump.sql.Import.main(Import.scala)
... 6 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 2.104s
[INFO] Finished at: Fri May 24 18:34:48 CST 2013
[INFO] Final Memory: 10M/175M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.scala-tools:maven-scala-plugin:2.15.2:run (default-cli) on project dump: wrap: org.apache.commons.exec.ExecuteException: Process exited with an error: -10000(Exit value: -10000) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException
Process finished with exit code 1
what should I do to fix it?
PS: I did it all on windows 7 OS, with intelli j 12 community version, maven 3 and jdk 7 installed. If any other info is needed, please let me know, thanks.
When I execute the following code in scala REPL:
javax.persistence.Persistence.createEntityManagerFactory("manager1")
I get
javax.persistence.PersistenceException: No Persistence provider for EntityManager named manager1
The same maven project running Java has no problems (in other words, I believe my dependecies are setup correctly)
Using the remote debugger I found the problem seem to be at PersistenceProviderResolverHolder where it executed the following code:
Enumeration<URL> resources = cl.getResources( "META-INF/services/" + PersistenceProvider.class.getName() )
The returned enumeration has no elements.
When I execute the same REPL session
val cl = classOf[javax.persistence.spi.PersistenceProviderResolverHolder].getClassLoader()
cl.getResources( "META-INF/services/javax.persistence.spi.PersistenceProvider").hasMoreElements
I get "true"
This happens both when using mvn:scala or when using scala directly:
scala -cp "target/dependency/*":target/classes
My dependencies are
[INFO] --- maven-dependency-plugin:2.3:tree (default-cli) # java.jpa.basics ---
[INFO] com.edc4it:java.jpa.basics:jar:1.0
[INFO] +- org.slf4j:slf4j-log4j12:jar:1.6.2:compile
[INFO] | +- org.slf4j:slf4j-api:jar:1.6.2:compile
[INFO] | \- log4j:log4j:jar:1.2.16:compile
[INFO] +- mysql:mysql-connector-java:jar:5.1.6:compile
[INFO] +- javassist:javassist:jar:3.9.0.GA:compile
[INFO] +- org.scala-lang:scala-library:jar:2.9.1:compile
[INFO] \- org.hibernate:hibernate-entitymanager:jar:3.6.7.Final:compile
[INFO] +- org.hibernate:hibernate-core:jar:3.6.7.Final:compile
[INFO] | +- antlr:antlr:jar:2.7.6:compile
[INFO] | +- commons-collections:commons-collections:jar:3.1:compile
[INFO] | +- dom4j:dom4j:jar:1.6.1:compile
[INFO] | +- org.hibernate:hibernate-commons-annotations:jar:3.2.0.Final:compile
[INFO] | \- javax.transaction:jta:jar:1.1:compile
[INFO] +- cglib:cglib:jar:2.2:compile
[INFO] | \- asm:asm:jar:3.1:compile
[INFO] \- org.hibernate.javax.persistence:hibernate-jpa-2.0-api:jar:1.0.1.Final:compile
The only JPA releated dependency is "org.hibernate:hibernate-entitymanager:3.6.7.Final"
It looks like a classloading problem, but could it be something different?
After some more digging and debugging, I found out that the JPA implementation uses the current tread's contextual classloader (which in my case is the sun.misc.Launcher$AppClassLoader). That classloader indeed does not include the JPA and Hibernate JARs. (see javax.persistence.spi.PersistenceProviderResolverHolder.PersistenceProviderResolverPerClassLoader#getContextualClassLoader)
Changing the contextual classloader prior to getting the EntityManagerFactory therefore does the trick:
Thread.currentThread().setContextClassLoader(JPAUtil.class.getClassLoader());
emf = Persistence.createEntityManagerFactory("manager");
In REPL setting the contextual classloader does not work, it is reset to the application classloader after setting it.
I dkn't know what the consequences are yet (not sure if all the JPA code will actually work, just did a few tests and seems to work so far).
Also i don't understand why hibernate would use the contextual classloader and not just the current classloader.