Maven dependency for java.lang.NoClassDefFoundError: org/apache/spark/streaming/util/Clock - maven

I tried a lot but still not able to see the maven dependency for
java.lang.NoClassDefFoundError: org/apache/spark/streaming/util/Clock
Could somebody please let me know the best way to find the dependency if we have some good practice. Thanks

I found the dependency I was looking for:
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.10</artifactId>
<version>1.1.0</version>
<scope>compile</scope>
</dependency>

Related

Get JAXBException with hibernate-jpamodelgen 6.1.5.Final

When i install 6.1.5.Final and run maven compile, i got this error.
java: java.lang.NoClassDefFoundError: jakarta/xml/bind/JAXBException
jakarta.xml.bind.JAXBException
java: java.lang.NoClassDefFoundError: jakarta/xml/bind/JAXBException
I had downgrade to lower version of hibernate and jpamodelgen but problem not be resolved.
My dependency setup.
<dependency>
<groupId>org.hibernate.orm</groupId>
<artifactId>hibernate-jpamodelgen</artifactId>
<version>6.1.5.Final</version>
</dependency>
Please help me to fix this. Thanks in advance.
Please add the dependency to your pom.xml:
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>4.0.0</version>
</dependency>
and try
mvn clean package -DskipTest

Find all dependencies that include a given package

I excluded an artifact because it causes conflicts, namely the jsr311-api given below. Yet when I run the generated jar I'm still getting the java.lang.NoSuchMethodError error. I suspect that another dependency is also including this artifact. How can I find out which one? My dependency list is quite large. Which dependencies include the package javax.ws.rs.core?
<dependency>
<groupId>org.apache.axis2</groupId>
<artifactId>axis2-kernel</artifactId>
<version>1.7.3</version>
<exclusions>
<!-- Causes java.lang.NoSuchMethodError: javax.ws.rs.core.Response$Status$Family.familyOf(I)Ljavax/ws/rs/core/Response$Status$Family; -->
<exclusion>
<artifactId>jsr311-api</artifactId>
<groupId>javax.ws.rs</groupId>
</exclusion>
</exclusions>
</dependency>
Go to
http://search.maven.org/#advancedsearch%7Cgav
and use classname search to find
javax.ws.rs.core.Response
If you use a Nexus 2.x in your company, you can use classname search there as well.
If you want to find out where a given artifact (that you e.g. found by classnmae search) comes from, use dependency:tree in Maven.
In my case the mistake was that I had to manually add the javaee api and I set <scope>provided</scope> which was a mistake, fixing this solved the problem.
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope><!-- remove this -->
</dependency>

Maven Guava Dependency "Cannot resolve symbol 'google'" in IntelliJ IDEA

IntelliJ says Cannot resolve symbol 'google'. about this import:
import com.google.common.cache.LoadingCache;
Even though I have added the dependency correctly and it doesn't complain about it:
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
I have updated my Maven repository. I have Maven auto-import enabled in IntelliJ IDEA. My project is using SDK version 1.8. Based on numerous examples on the web, this should work, but it doesn't.
I found this about a similar (although not the same issue, as my code doesn't compile). I tried invalidating the cache and restarting, but it didn't help. The top answer also suggests deleting the IDEA system directory. I don't know if this is a good idea and how much stuff breaks if I do that.
I had the same problem and was trying all solutions to import Guava cache manager.
But the mistake I made was, did not add dependencies properly. Please do check pom.xml before trying any solution.
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>25.0-jre</version>
</dependency>
<!-- these are the dependencies i missed -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-beans</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
<version>4.3.10.RELEASE</version>
</dependency>`
If anyone else has a similar issue, reading through pom.xml may be helpful. Turns out I had <properties> defined twice. For some reason it was not causing problems before adding the Guava dependency. After removing the duplicate definition, everything started working again.

SolrJ with Maven

I am a newbie in Solr and maven and i want to make a small application that index all my database tables via SolrJ .
For that i looked up at this tutorial where they are using MAVEN .
I installed the librairies and jars (except maven) but i had this exception:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/HttpRequestInterceptor
I looked into the tutorial and i saw that for resolving this problem we need to add this to my maven configuration:
org.slf4j
slf4j-simple
1.5.6
Is there anyway to do that without maven?
Thank you
Use maven. Even with it, it took me a fairly considerable amount of time to get the dependencies right. The tutorials were all a bit lacking. Below is my pom.xml with the relevant dependencies that I had maven bring in. Perhaps it will help you.
<dependency>
<groupId>org.apache.solr</groupId>
<artifactId>solr-core</artifactId>
<version>4.3.0</version>
</dependency>
<dependency>
<artifactId>solr-solrj</artifactId>
<groupId>org.apache.solr</groupId>
<version>4.3.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
Maven is the suggested build technology for the Solrj, because it automates the management of 3rd party dependencies. Without dependency management it's a royal pain to decipher these relationships (Jar hell).
What I could suggest is to use ivy, which has a command-line mode.
First download the ivy jar
http://search.maven.org/remotecontent?filepath=org/apache/ivy/ivy/2.3.0/ivy-2.3.0.jar
To retrieve the following Maven module and all it's dependencies:
<dependency>
<artifactId>solr-solrj</artifactId>
<groupId>org.apache.solr</groupId>
<version>1.4.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
Then run it as follows:
java -jar ivy.jar \
-dependency org.apache.solr solr-solrj 1.4.0 \
-retrieve "lib/[artifact]-[revision](-[classifier]).[ext]" \
-confs default
Retrieves into the lib directory:
lib/commons-httpclient-3.1.jar
lib/wstx-asl-3.2.7.jar
lib/slf4j-api-1.5.5.jar
lib/commons-codec-1.3.jar
lib/stax-api-1.0.1.jar
lib/geronimo-stax-api_1.0_spec-1.0.1.jar
lib/commons-logging-1.0.4.jar
lib/solr-solrj-1.4.0.jar
lib/commons-io-1.4.jar
lib/commons-fileupload-1.2.1.jar
Update
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/http/HttpRequestInterceptor
This is due to a missing httpcore.jar file. I found this out by browsing Maven Central:
http://search.maven.org/#search|ga|1|fc%3A%22org.apache.http.HttpRequestInterceptor%22
The recommendation on using the "slf4j-simple" is to provide a logging implementation in case your application doesn't have one.
Finally... This demonstrates what I've tried to say. In the absence of a dependency management tool (ivy, groovy, Maven) you're on your own in deciphering the 3rd party jar dependencies.

MyFaces Commons Validator maven dependency repository

Seems like i am having a hard time finding the repository manager for this dependency:
<dependency>
<groupId>org.apache.myfaces.commons</groupId>
<artifactId>myfaces-commons</artifactId>
<version>1.1.2</version>
</dependency>
Can someone give me a hand on this :P
Found the problem.
The correct dependency should be:
<dependency>
<groupId>org.apache.myfaces.commons</groupId>
<artifactId>myfaces-validators20</artifactId>
<version>1.0.2</version>
</dependency>
This dependency can be found in Maven Central public repository:
http://search.maven.org/#artifactdetails%7Corg.apache.myfaces.commons%7Cmyfaces-validators20%7C1.0.2%7Cjar

Resources