Could not find or load main class org.scalatest.tools.Runner - scala

Created the maven scala project.
I had correctly specified all the configuration . But still facing this error.
any help appreciated.

I solved this error.
Its coming because I had make the entry for org.scalatest plugin and there is no src/test/scala dir and no test cases.After removing org.scalatest plugin entry from pom file everything work fine.

For anyone that comes across this issue in the future, make sure you have the following dependency in your pom.xml.
<dependency>
<groupId>org.scalatest</groupId>
<artifactId>scalatest_2.11</artifactId>
<version>3.0.0</version>
<scope>test</scope>
</dependency>

Related

com.day.cq.dam.commons.util,version=[1.50,2) -- Cannot be resolved

I'm trying to run AEM 6.5 however i'm running into an issue below:
com.day.cq.dam.commons.util,version=[1.50,2) -- Cannot be resolved
It can boot up Author, but there is no content and it looks like that's the only source of the error I can see.
You can add the maven dependency in your pom.xml and build and install the code in AEM and check if this issue still exists.
<dependency>
<groupId>com.day.cq.dam</groupId>
<artifactId>cq-dam-commons</artifactId>
<version>5.6.6</version>
<scope>provided</scope>
</dependency>

Missing artifact "sun.jdk:jconsole:jar:jdk"

When adding Arquillian to a Maven build I get the above exception in Eclipse:
Missing artifact sun.jdk:jconsole:jar:jdk
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<version>1.1.7.Final</version>
</dependency>
<dependency>
<groupId>org.jboss.arquillian.extension</groupId>
<artifactId>arquillian-persistence-dbunit</artifactId>
<version>1.0.0.Alpha7</version>
</dependency>
(The message is not the problem, but that Eclipse refuses to compile the project because of it. Maven works, though.)
Naturally the first thing I did was trying to exclude it from the Maven dependencies (wildfly-arquillian-container-managed is where the dependency tree states the dependency comes from):
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-managed</artifactId>
<exclusions>
<exclusion>
<artifactId>jconsole</artifactId>
<groupId>sun.jdk</groupId>
</exclusion>
</exclusions>
</dependency>
There was no change. I tried to start Eclipse with -vm C:\Program Files\Java\jdk1.8.0_60\bin. And tried to edit the JDK in "Preferences -> Installed JREs" to contain the JAR in the tools directory. But nothing works.
What can I do?
I put my dependencies like this and it works fine:
<dependency>
<groupId>org.jboss.arquillian.junit</groupId>
<artifactId>arquillian-junit-container</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-arquillian-container-embedded</artifactId>
<version>8.1.0.CR1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-simple</artifactId>
<version>1.7.15</version>
<scope>test</scope>
</dependency>
<!-- Arquillian -->
<dependency>
<groupId>org.wildfly</groupId>
<artifactId>wildfly-embedded</artifactId>
<version>8.1.0.CR1</version>
<exclusions>
<exclusion>
<groupId>sun.jdk</groupId>
<artifactId>jconsole</artifactId>
</exclusion>
</exclusions>
<scope>test</scope>
</dependency>
See that the exclusion tag is in the "wildfly-embedded" dependency...
Don't forget to command "mvn install" and click right button at project and "Maven Update", if it doesn't work try delete folder "~/.m2/repository" and download all the dependencies again.
Alastair, thanks for solving the problem. The cause lies in the the pom of the transient dependency org.wildfly:wildfly-cli (8.2.0.Final). There you can find the following dependency declaration:
<dependency>
<groupId>sun.jdk</groupId>
<artifactId>jconsole</artifactId>
<version>jdk</version>
<scope>system</scope>
<systemPath>${java.home}/../lib/jconsole.jar</systemPath>
</dependency>
Actually, the jar is located in ${java.home}/lib/jconsole.jar.
P.S.: The version is also insufficient. So, I deleted this version from my local maven repository.
I faced this while working in a Windows machine. The project itself worked perfectly fine in my Ubuntu machine. However the project's build failed with exactly that message, induced by a transient org.wildfly:wildfly-ejb dependency.
Missing artifact sun.jdk:jconsole:jar:jdk
I didn't feel the project configuration needed to be changed as it's supposed to just work fine across all environments and thus the Windows environment itself must have been wrong. My first thought was that Eclipse itself is in some way using JRE instead of JDK.
So I checked java -version in CMD and it appears to point to a JRE installed somewhere in /Program Files folder while I've always been manually installing JDKs in /Java folder. Then I inspected the %PATH% environment variable in Windows settings. It appears to include a /ProgramData/Oracle/Java/javapath. That folder contained a few symlinks to the JRE in /Program Files folder. That was thus actually being used to start Eclipse and run all its tasks. When I removed it (there was already a JDK/bin further down in %PATH% setting) and restarted Eclipse and re-executed Maven build, the error went away.
No changes needed to pom.xml or Eclipse configuration. Just watch out with what's Windows all installing and updating for you in the background and check your %PATH% if it still has JDK in top.
The reason of the problem is that the jconsole.jar is part of the jdk, thus it is not distributed as an ordinary maven package.
Typically, project pom.xmls insert this jconsole.jar as a system package, i.e. it doesn't even try to download them from the central maven repo. Although it would be possible to distribute it also on this way.
The simplest solution of the problem is to use a jdk which contains this jconsole.jar.
Alternatively, you can download this jar from anywhere, only you have to make it reachable in the compilation classpath.
Or, you can also modify the pom.xml, or install the package manually into your local maven repo, as the other answers state.
I spent the best part of a day fighting this problem. Simple solution is to manually install the missing jar from your jdk using maven, something like:
c:\workspace\prism>mvn install:install-file -Dfile=C:\java\jdk\lib\jconsole.jar -DgroupId=sun.jdk -DartifactId=jconsole -Dversion=1.8 -Dpackaging=war.
Who knows why eclipse cannot do this ...
Maybe is more of a workaround than a proper solution, anyway I solved this issue by removing the profile "activebydefault" in the pom. This way, Eclipse won't complain for the "Missing artifact sun.jdk:jconsole:jar:jdk" but the JUnit test won't run in Eclipse - as I use testing only from maven test, and not the Eclipse embedded JUnit runner, it just need to specify which profile ID you want to run against.
I was facing the same issue, but none of this was a perfect solution for me. Steps to solve :
Check if you are pointing to the JDK location correctly :
echo $JAVA_HOME
Open pom.xml from IDE (mine is eclipse), select Dependency Hierarchy, and search for jconsole. If you see jconsole, it is because sometimes jconsole would be given as an interdependency and the path given could not be recognized. Excluding that jar will solve the issue.
Dependency Hierarchy
Interdependent jconsole
Exclusing jconsole
i was searched jdk full name.
(cos i was used when startethe 1.8.0_191 but after change laptop. its also changed to 1.8.0_282)
so i was searched at STS.
there is a string(java path) at the .factorypath.
so i change that.
its fixed now.
guys try this way~

ClassNotFoundException despite adding to classpath and pom.xml

I'm trying to use one of the Apache Commons Math3 classes in Eclipse.
Downloaded the jar, and used these instructions for adding to the build path: ClassNotFoundException in eclipse.
In addition, since the project uses Maven, I added this to the pom.xml file:
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-math3</artifactId>
<version>3.0</version>
</dependency>
Here is where I'm using the class:
import org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization;
...
MixtureMultivariateNormalDistribution mmnd = MultivariateNormalMixtureExpectationMaximization.estimate(data, 2);
There are no errors at compile time, but at runtime:
Error text:java.lang.ClassNotFoundException: org.apache.commons.math3.distribution.fitting.MultivariateNormalMixtureExpectationMaximization
I know there are a couple of stackoverflow answers regarding adding jar files, I've followed several of them and they don't seem to solve the issue.
Thanks in advance!

java.lang.NoClassDefFoundError: scala/reflect/ClassManifest

I am getting an error when trying to run an example on spark. Can anybody please let me know what changes do i need to do to my pom.xml to run programs with spark.
Currently Spark only works with Scala 2.9.3. It does not work with later versions of Scala. I saw the error you describe when I tried to run the SparkPi example with SCALA_HOME pointing to a 2.10.2 installation. When I pointed SCALA_HOME at a 2.9.3 installation instead, things worked for me. Details here.
You should add dependecy for scala-reflect to your maven build:
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-reflect</artifactId>
<version>2.10.2</version>
</dependency>
Ran into the same issue using the Scala-Redis 2.9 client (incompatible with Scala 2.10) and including a dependency to scala-reflect does not help. Indeed, scala-reflect is packaged as its own jar but does not include the Class missing which is deprecated since Scala 2.10.0 (see this thread).
The correct answer is to point to an installation of Scala which includes this class (In my case using the Scala-Redis client, the answer of McNeill helped. I pointed to Scala 2.9.3 using SBT and everything worked as expected)
In my case, the error is raised in Kafka's api. I change the dependency from
<dependency>
<groupId>org.apache.kafka</groupId>
<artifactId>kafka_2.9.2</artifactId>
<version>0.8.1.1</version>
</dependency>
to
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka_2.10</artifactId>
<version>1.6.1</version>
</dependency>
fixed the problem.

How to use LDAP in Lift Framework

Does anyone have a good example showing how to incorporate LDAP to a Lift Scala Project? I have problems adding the dependency in my pom.xml file
<dependency>
<groupId>net.liftweb</groupId>
<artifactId>lift-ldap</artifactId>
<version>2.0</version>
</dependency>
In the project tag throws me an error saying it couldnt find the version in [1.4.5-rc1,1.4.5] to match range [1.4,1.4.3) javax.mail:mail:jar:null
Any ideas?? Thank u