I am trying to understand the usage of java web tokens so I wanted to made a simple web application. I just create a simple login system which uses jwt but I got java.lang.NoClassDefFoundError: io/jsonwebtoken/Jwts in some point. Here is my related codes:
Connect.java:
#WebServlet("/Connect")
public class Connect extends HttpServlet {
#Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
String username = req.getParameter("username");
String password = req.getParameter("password");
Jjwt jjwt = new Jjwt();
jjwt.authorize(username, password);
if(jjwt.flag == true){
DatabaseInteractions databaseInteractions = new DatabaseInteractions();
JsonOutput output = databaseInteractions.getAccountDetails(databaseInteractions.getID(username));
ServletContext context = getServletContext();
req.setAttribute("username", username);
req.setAttribute("btcAmount", output.getBtcAmount());
req.setAttribute("ethAmount", output.getEthAmount());
req.setAttribute("xrpAmount", output.getXrpAmount());
req.setAttribute("trxAmount", output.getTrxAmount());
req.setAttribute("adaAmount", output.getAdaAmount());
context.getRequestDispatcher("/Home.jsp").forward(req, resp);
}
}
#Override
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException{
}
}
Jjwt.java:
public class Jjwt{
public boolean flag;
public Jjwt(){
flag = false;
}
#POST
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.APPLICATION_JSON)
public Response authorize(String username, String password){
DatabaseInteractions databaseInteractions = new DatabaseInteractions();
if(databaseInteractions.connectToDatabase() == false){
System.out.println("Error: Could not connect to database. Please try later ...");
return Response.status(Response.Status.UNAUTHORIZED).build();
}
if(databaseInteractions.login(username, password)){
String key = "key";
long time = System.currentTimeMillis();
String jwt = Jwts.builder()
.signWith(SignatureAlgorithm.HS256, key)
.setSubject(username)
.setIssuedAt(new Date(time))
.setExpiration(new Date(time+9000))
.claim("password",password)
.compact();
JsonObject jsonObject = Json.createObjectBuilder().add("JWT", jwt).build();
flag = true;
return Response.status(Response.Status.CREATED).entity(jsonObject).build();
}else{
return Response.status(Response.Status.UNAUTHORIZED).build();
}
}
}
In String jwt = Jwts.builder() point at Jjwt.java class, I got the error that I mentioned above. I added all the necessary dependencies I guess, here is my pom.xml(By the way, this is a Maven project):
<repositories>
<repository>
<id>maven2-repository.java.net</id>
<name>Java.net Repository for Maven</name>
<url>http://download.java.net/maven/2/</url>
<layout>default</layout>
</repository>
<repository>
<id>maven-repository.java.net</id>
<name>Java.net Maven 1 Repository (legacy)</name>
<url>http://download.java.net/maven/1</url>
<layout>legacy</layout>
</repository>
</repositories>
<dependencies>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-json</artifactId>
<version>1.6</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>8.5.27</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.ws.rs</groupId>
<artifactId>javax.ws.rs-api</artifactId>
<version>2.1-m09</version>
</dependency>
<dependency>
<groupId>javax.json</groupId>
<artifactId>javax.json-api</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
</dependencies>
Where am I doing wrong?
Edit: When I add the below dependencies:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.8.9</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>2.8.9</version>
</dependency>
Now it gives java.lang.NoClassDefFoundError: com/fasterxml/jackson/core/JsonProcessingException at the same point.
Related
I'm trying change version for spring-cloud-function-adapter-aws from 3.0.7.RELEASE to either 3.1.7 or 3.2.3 (as Spring Cloud Function Vulnerability CVE-2022-22963) but getting error as it is not able to find the class
java.lang.NoClassDefFoundError: org/spring framework/boot/ApplicationContextFactory
at org.springframework.cloud.function.context.FunctionalSpringApplication.(FunctionalSpringApplication.java:67)
at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.springApplication(AbstractSpringFunctionAdapterInitializer.java:378)
at org.springframework.cloud.function.context.AbstractSpringFunctionAdapterInitializer.initialize(AbstractSpringFunctionAdapterInitializer.java:121)
at org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler.initialize(SpringBootStreamHandler.java:61)
at org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler.handleRequest(SpringBootStreamHandler.java:53)
Caused by: java.lang.ClassNotFoundException:
My Application.java
#ComponentScan
#SpringBootApplication
public class Application {
public static void main(String[] args) {
SpringApplication.run(Application.class, args);
}
}
FunctionConfiguration.java
#Configuration
public class FunctionConfiguration {
private static Logger logger = LoggerFactory.getLogger(FunctionConfiguration.class);
#Autowired
ActionService service;
#Bean
public Function<APIGatewayProxyRequestEvent, APIGatewayProxyResponseEvent> containerService() {
return value -> {
try {
APIGatewayProxyResponseEvent responseEvent = checkHttpMethod(value);
if (responseEvent != null) {
responseEvent.setBody("Option Method");
return responseEvent;
} else {
return createResponseEvent(value);
}
} catch (Exception e) {
return new APIGatewayProxyResponseEvent().withBody(e.getMessage()).withStatusCode(500)
.withHeaders(createResultHeader(value));
}
};
}
private APIGatewayProxyResponseEvent checkHttpMethod(APIGatewayProxyRequestEvent event) {
APIGatewayProxyResponseEvent responseEvent = new APIGatewayProxyResponseEvent();
if (event.getHttpMethod() != null && event.getHttpMethod().equalsIgnoreCase("options")) {
responseEvent.setHeaders(createResultHeader(event));
responseEvent.setStatusCode(200);
return responseEvent;
} else
return null;
}
private APIGatewayProxyResponseEvent createResponseEvent(APIGatewayProxyRequestEvent event) {
APIGatewayProxyResponseEvent responseEvent = new APIGatewayProxyResponseEvent();
try {
responseEvent = service.actionMethod(event);
responseEvent.setHeaders(createResultHeader(event));
return responseEvent;
} catch (Exception e) {
logger.error("Error executing method", e);
responseEvent.setHeaders(createResultHeader(event));
responseEvent.setBody(e.getMessage());
responseEvent.setStatusCode(500);
return responseEvent;
}
}
private Map<String, String> createResultHeader(APIGatewayProxyRequestEvent event) {
Map<String, String> resultHeader = new HashMap<>();
resultHeader.put("Content-Type", "application/json");
resultHeader.put("Access-Control-Allow-Headers", "Content-Type");
resultHeader.put("Vary", "Origin");
try {
String origin = event.getHeaders().get("origin");
resultHeader.put("Access-Control-Allow-Origin", origin);
} catch (Exception e) {
logger.error("origin not exist to add");
}
resultHeader.put("Access-Control-Allow-Credentials", "true");
logger.info(" Headers added ");
return resultHeader;
}
}
pom.xml
4.0.0
com.app.lambda
springBootLambda
1.0.3
springBootLambda
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>2.3.0.RELEASE</version>
<relativePath /> <!-- lookup parent from repository -->
</parent>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<aws-lambda-java-core.version>1.2.1</aws-lambda-java-core.version>
<spring-cloud-function.version>3.0.7.RELEASE
</spring-cloud-function.version>
<wrapper.version>1.0.17.RELEASE</wrapper.version>
<aws-lambda-java-events.version>2.2.7</aws-lambda-java-events.version>
<aws-java-sdk-s3.version>1.11.792</aws-java-sdk-s3.version>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-json</artifactId>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
<dependency>
<groupId>javax.validation</groupId>
<artifactId>validation-api</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-support</artifactId>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context-indexer</artifactId>
<scope>optional</scope>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-function-adapter-aws</artifactId>
<version>${spring-cloud-function.version}</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-core</artifactId>
<version>${aws-lambda-java-core.version}</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk</artifactId>
<version>1.11.672</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-java-sdk-core</artifactId>
<version>1.11.672</version>
</dependency>
<dependency>
<groupId>com.amazonaws</groupId>
<artifactId>aws-lambda-java-events</artifactId>
<version>${aws-lambda-java-events.version}</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<dependencies>
<dependency>
<groupId>org.springframework.boot.experimental</groupId>
<artifactId>spring-boot-thin-layout</artifactId>
<version>${wrapper.version}</version>
</dependency>
</dependencies>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<configuration>
<finalName>${project.artifactId}-${project.version}</finalName>
<createDependencyReducedPom>false</createDependencyReducedPom>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>shaded</shadedClassifierName>
</configuration>
</plugin>
</plugins>
</build>
serverless.yml
service: SpringBoot-Lambda
provider:
name: aws
runtime: java8
region: us-east-1
memory: 2048
timeout: 40
spring:
jpa:
hibernate.ddl-auto: update
generate-ddl: true
show-sql: true
jar file that will be uploaded and executed on AWS
package:
artifact: target/{project.artifactId}-${project.version}.jar
#define Lambda function
functions:
createMethod:
handler: org.springframework.cloud.function.adapter.aws.SpringBootStreamHandler
events: # api gateway
- http:
path: pass
method: post
cors: true
environment: # environment variables
FUNCTION_NAME: SpringBoot-Lambda
You need to upgrade Spring Boot as well. You are using 2.3.0 and ApplicationContextFactory was added in 2.4, but 2.4.x is no longer supported.
You should upgrade to Spring Boot 2.5.12 or 2.6.6.
This is my resource class: with repository injection.
#Path("/posts")
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.APPLICATION_JSON)
public class PostsResource {
#Context
UriInfo uriInfo;
#Inject
PostRepository posts;
#GET
public Response getAllPosts(
#QueryParam("q") String q,
#QueryParam("limit") #DefaultValue("10") int limit,
#QueryParam("offset") #DefaultValue("0") int offset
) {
return Response.ok(this.posts.findByKeyword(q, limit, offset)).build();
}
#GET
#Path("/count")
public Response getAllPosts(#QueryParam("q") String q) {
return Response.ok(
Count.builder().count(this.posts.countByKeyword(q))
).build();
}
#POST
public Response savePost(PostForm post) {
Post entity = Post.builder()
.title(post.getTitle())
.content(post.getContent())
.build();
Post saved = this.posts.save(entity);
return Response.created(uriInfo.getBaseUriBuilder().path("/posts/{slug}").build(saved.getSlug())).build();
}
}
and repository class
public class PostRepository extends AbstractRepository<Post, Long> {
#Inject
private EntityManager em;
#Transactional
public List<Post> findByKeyword(String keyword, long limit, long offset) {
return this.stream()
.filter(p -> Optional.ofNullable(keyword)
.map(k -> p.getTitle().contains(k) || p.getContent().contains(k)).orElse(true))
.limit(limit).skip(offset).collect(toList());
}
#Transactional
public long countByKeyword(String keyword) {
return this.stream().filter(p -> Optional.ofNullable(keyword)
.map(k -> p.getTitle().contains(k) || p.getContent().contains(k)).orElse(true)).count();
}
#Transactional
public List<Post> findByCreatedBy(String username) {
Objects.requireNonNull(username, "username can not be null");
return this.stream().filter(p -> username.equals(p.getCreatedBy().getUsername()))
.sorted(Post.DEFAULT_COMPARATOR).collect(toList());
}
#Transactional
public Optional<Post> findBySlug(String slug) {
Objects.requireNonNull(slug, "Slug can not be null");
return this.stream().filter(p -> p.getSlug().equals(slug)).findFirst();
}
public List<Post> findAll() {
return em.createNamedQuery("Post.findAll", Post.class).getResultList();
}
public Post findPostById(Long id) {
Post post = em.find(Post.class, id);
if (post == null) {
throw new WebApplicationException("Post with id of " + id + " does not exist.", 404);
}
return post;
}
#Transactional
public void updatePost(Post post) {
Post postToUpdate = findPostById(post.getId());
postToUpdate.setTitle(post.getTitle());
postToUpdate.setContent(post.getContent());
}
#Transactional
public void createPost(Post post) {
em.persist(post);
}
#Transactional
public void deletePost(Long postId) {
Post p = findPostById(postId);
em.remove(p);
}
#Override
protected EntityManager entityManager() {
return this.em;
}
}
My pm.xml conatin these dependencies:
<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-bom</artifactId>
<version>${quarkus.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<!-- <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-arc</artifactId>
<scope>provided</scope>
</dependency> -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-resteasy-jsonb</artifactId>
</dependency>
<dependency>
<groupId>io.rest-assured</groupId>
<artifactId>rest-assured</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-rest-client</artifactId>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-api</artifactId>
<version>0.10.7</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-impl</artifactId>
<version>0.10.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt-jackson</artifactId>
<version>0.10.7</version>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>com.nimbusds</groupId>
<artifactId>nimbus-jose-jwt</artifactId>
<version>${nimbus-jose.version}</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-junit5</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
</dependency>
<!-- <dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
</dependency> -->
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-junit-jupiter</artifactId>
<version>${mockito.version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.assertj</groupId>
<artifactId>assertj-core</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-postgresql</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.quarkus/quarkus-jdbc-h2 -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-jdbc-h2</artifactId>
</dependency>
<!-- https://mvnrepository.com/artifact/io.quarkus/quarkus-jdbc-h2 -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-test-h2</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm-panache</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-hibernate-orm</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-security</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-openapi</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-metrics</artifactId>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-smallrye-health</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.4</version>
</dependency>
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-spring-web</artifactId>
</dependency>
<!-- <dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-undertow</artifactId>
</dependency> -->
<dependency>
<groupId>io.quarkus</groupId>
<artifactId>quarkus-spring-di</artifactId>
</dependency>
<!-- <dependency>
<groupId>io.vertx</groupId>
<artifactId>vertx-web-client</artifactId>
</dependency> -->
</dependencies>
I cannot build this beacause the build return :
Unsatisfied dependency for type com.ciwara.kalanSowApp.repository.PostRepository and qualifiers [#Default]
- java member: com.ciwara.kalanSowApp.rest.post.PostsResource#posts
- declared on CLASS bean [types=[com.ciwara.kalanSowApp.rest.post.PostsResource], qualifiers=[#Default, #Any], target=com.ciwara.kalanSowApp.rest.post.PostsResource]
In order to make PostRepository injectable, it must be a bean. The most common way to declare a class as bean is to add a Bean-Scope annotation to the class.
In the given class, adding #ApplicationScoped seems sensible.
Above the Injected client also add #RestClient and to client class #RegisterRestClient, #ApplicationScoped. Like this
#Path("/posts")
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.APPLICATION_JSON)
#RegisterRestClient
#ApplicationScoped
public class PostsResource {}
//Where you inject.
#Inject
#RestClient
PostRepository posts;
This question already has answers here:
Resolving dependency problems in Apache Spark
(7 answers)
Closed 4 years ago.
I have this small piece of java code to get apache spark recommendations:
public class Main {
public static class Rating implements Serializable {
private int userId;
private int movieId;
private float rating;
private long timestamp;
public Rating() {}
public Rating(int userId, int movieId, float rating, long timestamp) {
this.userId = userId;
this.movieId = movieId;
this.rating = rating;
this.timestamp = timestamp;
}
public int getUserId() {
return userId;
}
public int getMovieId() {
return movieId;
}
public float getRating() {
return rating;
}
public long getTimestamp() {
return timestamp;
}
public static Rating parseRating(String str) {
String[] fields = str.split(",");
if (fields.length != 4) {
throw new IllegalArgumentException("Each line must contain 4 fields");
}
int userId = Integer.parseInt(fields[0]);
int movieId = Integer.parseInt(fields[1]);
float rating = Float.parseFloat(fields[2]);
long timestamp = Long.parseLong(fields[3]);
return new Rating(userId, movieId, rating, timestamp);
}
}
static String parse(String str) {
Pattern pat = Pattern.compile("\\[[0-9.]*,[0-9.]*]");
Matcher matcher = pat.matcher(str);
int count = 0;
StringBuilder sb = new StringBuilder();
while (matcher.find()) {
count++;
String substring = str.substring(matcher.start(), matcher.end());
String itstr = substring.split(",")[0].substring(1);
sb.append(itstr + " ");
}
return sb.toString().trim();
}
static TreeMap<Long, String> res = new TreeMap<>();
public static void add(long k, String v) {
res.put(k, v);
}
public static void main(String[] args) throws IOException {
Logger.getLogger("org").setLevel(Level.OFF);
Logger.getLogger("akka").setLevel(Level.OFF);
SparkSession spark = SparkSession
.builder()
.appName("SomeAppName")
.config("spark.master", "local")
.getOrCreate();
JavaRDD<Rating> ratingsRDD = spark
.read().textFile(args[0]).javaRDD()
.map(Rating::parseRating);
Dataset<Row> ratings = spark.createDataFrame(ratingsRDD, Rating.class);
ALS als = new ALS()
.setMaxIter(1)
.setRegParam(0.01)
.setUserCol("userId")
.setItemCol("movieId")
.setRatingCol("rating");
ALSModel model = als.fit(ratings);
model.setColdStartStrategy("drop");
Dataset<Row> rowDataset = model.recommendForAllUsers(50);
rowDataset.foreach((ForeachFunction<Row>) row -> {
String str = row.toString();
long l = Long.parseLong(str.substring(1).split(",")[0]);
add(l, parse(str));
});
BufferedWriter bw = new BufferedWriter(new FileWriter(args[1]));
for (long l = 0; l < res.lastKey(); l++) {
if (!res.containsKey(l)) {
bw.write("\n");
continue;
}
String str = res.get(l);
bw.write(str);
}
bw.close();
}
}
I am trying different dependencies in my pom.xml to get it running, but all variants fail. This one:
<dependency>
<groupId>com.sparkjava</groupId>
<artifactId>spark-core</artifactId>
<version>2.8.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.12</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.6.4</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.6.4</version>
</dependency>
fails with java.lang.ClassNotFoundException: text.DefaultSource, to fix it I add
org.apache.spark
spark-sql-kafka-0-10_2.10
2.0.2
now it crashes with ClassNotFoundException: org.apache.spark.internal.Logging$class, to fix it I add another ones:
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.10</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.10</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-8_2.11</artifactId>
<version>2.2.2</version>
</dependency>
now it fails with java.lang.NoClassDefFoundError: scala/collection/GenTraversableOnce to fix it I tried dozen of other combinations, all of them failed, the last one is
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.2.2</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming-kafka-0-8_2.11</artifactId>
<version>2.2.2</version>
</dependency>
which again gives me ClassNotFoundException: text.DefaultSource, how can I fix it? Was there any logic behind implementing runtime linking in spark?
UPD: also tried
<dependencies>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.0.1</version>
</dependency>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.0.1</version>
</dependency>
<dependency> <!-- Spark dependency -->
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-streaming_2.11</artifactId>
<version>2.0.1</version>
</dependency>
<dependency>
<groupId>org.apache.bahir</groupId>
<artifactId>spark-streaming-twitter_2.11</artifactId>
<version>2.0.1</version>
</dependency>
</dependencies>
(this still gives me java.lang.ClassNotFoundException: text.DefaultSource))
I also tried dependencies published in this question, but they also fail: Resolving dependency problems in Apache Spark
Source code is available here, so you can try various maven settings yourself: https://github.com/stiv-yakovenko/sparkrec
Finally I was able to make it work:
<dependencies>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-core_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sql_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-mllib_2.11</artifactId>
<version>2.4.0</version>
</dependency>
<dependency>
<groupId>org.scala-lang</groupId>
<artifactId>scala-library</artifactId>
<version>2.11.8</version>
</dependency>
</dependencies>
You have to use these exact versions otherwise it will crash in multiple various ways.
EDIT: Being more specific now i noticed a conflict i want to use BOTH dependencies below:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
<version>2.27</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.3.1</version>
</dependency>
Basically, I am trying to ignore a property (#JsonIgnore), but none of my Jackson annotations are working. Even the #JsonProperty. I tried to add the #JsonIgnore in getters and setters methods, but same behavior.
I also tried to follow official documentation, and tried different libraries
import org.codehaus.jackson.annotate.JsonIgnore; (Same Behavior)
import com.fasterxml.jackson.annotation.JsonIgnore; (Same Behavior)
I see similar posts like #12595351
My Response from the Controller, should not display the Revoked. Attribute, but i got this response:
Actual Response
{
"accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqb2huLmRvZUBleGFtcGxlLmNvbSIsImlzcyI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiaWF0IjoxNTI1MzI1Nzk1LCJleHAiOjE1MjUzMzI5OTV9.uri3pRwXQHHG09F-wM40qfuRMRVu_WBK3HlfquGvwYc",
"expiresAt": "2018-05-03T07:36:35.087Z[UTC]",
"expiresIn": 7199,
"issuedAt": "2018-05-03T05:36:35.087Z[UTC]",
"refreshToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqb2huLmRvZUBleGFtcGxlLmNvbSIsImlzcyI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiaWF0IjoxNTI1MzI1Nzk1LCJleHAiOjE1MjU5MzA1OTV9.xj2oytAVwiAIR8U2upJkPH_BdORuJUNbiicvuvGFz0w",
"revoked": false,
"type": "Bearer"
}
Expected Response
{
"accessToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqb2huLmRvZUBleGFtcGxlLmNvbSIsImlzcyI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiaWF0IjoxNTI1MzI1Nzk1LCJleHAiOjE1MjUzMzI5OTV9.uri3pRwXQHHG09F-wM40qfuRMRVu_WBK3HlfquGvwYc",
"expiresAt": "2018-05-03T07:36:35.087Z[UTC]",
"expiresIn": 7199,
"issuedAt": "2018-05-03T05:36:35.087Z[UTC]",
"refreshToken": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJqb2huLmRvZUBleGFtcGxlLmNvbSIsImlzcyI6ImpvaG4uZG9lQGV4YW1wbGUuY29tIiwiaWF0IjoxNTI1MzI1Nzk1LCJleHAiOjE1MjU5MzA1OTV9.xj2oytAVwiAIR8U2upJkPH_BdORuJUNbiicvuvGFz0w",
"type": "Bearer"
}
pom.xml (Using Maven)
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.wedhany.fimper</groupId>
<artifactId>fimper</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>fimper</name>
<build>
<finalName>fimper</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<inherited>true</inherited>
<configuration>
<source>8</source>
<target>8</target>
</configuration>
</plugin>
</plugins>
</build>
<repositories>
<repository>
<id>jitpack.io</id>
<url>https://jitpack.io</url>
</repository>
</repositories>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.glassfish.jersey</groupId>
<artifactId>jersey-bom</artifactId>
<version>${jersey.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.8.2</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>de.mkammerer</groupId>
<artifactId>argon2-jvm</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>io.jsonwebtoken</groupId>
<artifactId>jjwt</artifactId>
<version>0.9.0</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>8.0.11</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.7</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>9.0.1</version>
</dependency>
<dependency>
<groupId>org.flywaydb</groupId>
<artifactId>flyway-core</artifactId>
<version>5.0.7</version>
</dependency>
<dependency>
<groupId>org.modelmapper</groupId>
<artifactId>modelmapper</artifactId>
<version>1.1.0</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.containers</groupId>
<artifactId>jersey-container-servlet</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.inject</groupId>
<artifactId>jersey-hk2</artifactId>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
<version>2.27</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.3.1</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.ext</groupId>
<artifactId>jersey-spring4</artifactId>
<version>2.27</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.test-framework.providers</groupId>
<artifactId>jersey-test-framework-provider-jdk-http</artifactId>
<version>${jersey.version}</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>5.2.17.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>6.0.9.Final</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${springframework.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${springframework.version}</version>
</dependency>
</dependencies>
<profiles>
<profile>
<id>Development</id>
<dependencies>
<dependency>
<groupId>com.github.blocoio</groupId>
<artifactId>faker</artifactId>
<version>1.2.7</version>
</dependency>
</dependencies>
</profile>
</profiles>
<properties>
<jersey.version>2.27</jersey.version>
<springframework.version>4.3.16.RELEASE</springframework.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
Token.java (My Model)
package com.wedhany.models;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.wedhany.models.enums.token.GrantType;
import com.wedhany.models.enums.token.Type;
import java.util.Date;
public class Token {
/**
* Attributes
*/
private String accessToken;
private String refreshToken;
#JsonIgnore
private boolean revoked;
#JsonProperty("expires_at")
private Date expiresAt;
private Date issuedAt;
private GrantType grantType;
private Type type;
private User user;
/**
* #return Token TTL in seconds.
*/
public long getExpiresIn() {
return this.expiresAt.getTime() < new Date().getTime()
? 0
: (this.expiresAt.getTime() - new Date().getTime()) / 1000;
}
/**
* #return Token that will grant authentication and authorization.
*/
public String getAccessToken() {
return accessToken;
}
/**
* #param accessToken Token string.
*/
public void setAccessToken(String accessToken) {
this.accessToken = accessToken;
}
/**
* #return Token used to request a new token.
*/
public String getRefreshToken() {
return refreshToken;
}
/**
* #return Invalid token if true.
*/
public boolean isRevoked() {
return revoked;
}
/**
* #param revoked True for invalid.
*/
public void setRevoked(boolean revoked) {
this.revoked = revoked;
}
/**
* #param refreshToken Refresh token.
*/
public void setRefreshToken(String refreshToken) {
this.refreshToken = refreshToken;
}
/**
* #return Token's expiration date.
*/
public Date getExpiresAt() {
return expiresAt;
}
/**
* #param expiresAt Token's expiration date.
*/
public void setExpiresAt(Date expiresAt) {
this.expiresAt = expiresAt;
}
/**
* #return Date where the token was requested.
*/
public Date getIssuedAt() {
return issuedAt;
}
/**
* #param issuedAt Date where the token was requested.
*/
public void setIssuedAt(Date issuedAt) {
this.issuedAt = issuedAt;
}
/**
* #return Type of the token.
*/
public Type getType() {
return type;
}
/**
* #param type Type of the token.
*/
public void setType(Type type) {
this.type = type;
}
/**
* #return How the token was claimed.
*/
public GrantType getGrantType() {
return grantType;
}
/**
* #param grantType Set token type of grant.
*/
public void setGrantType(GrantType grantType) {
this.grantType = grantType;
}
/**
* #return Owner of the token
*/
public User getUser() {
return user;
}
/**
* #param user Token's owner.
*/
public void setUser(User user) {
this.user = user;
}
}
AuthenticationController
package com.wedhany.controllers;
import com.wedhany.exceptions.AuthorizationException;
import com.wedhany.models.Token;
import com.wedhany.models.User;
import com.wedhany.services.AuthenticationService;
import org.springframework.beans.factory.annotation.Autowired;
import javax.security.sasl.AuthenticationException;
import javax.ws.rs.*;
import javax.ws.rs.core.MediaType;
import javax.ws.rs.core.Response;
#Path("auth")
public class AuthenticationController {
#Autowired
private AuthenticationService authenticationService;
#POST
#Path("login")
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.APPLICATION_JSON)
public Response login(User user, #HeaderParam("user-agent") String userAgent) throws Exception {
try {
// Authenticate the user using the credentials provided
this.authenticationService.authenticate(user.getEmail(), user.getPassword());
// Issue a token for the user
Token token = this.authenticationService.issueToken(user.getEmail(), userAgent);
// Return the token on the response
return Response.ok(token).build();
} catch (AuthorizationException e) {
return Response.status(Response.Status.UNAUTHORIZED).build();
} catch (AuthenticationException e) {
return Response.status(Response.Status.FORBIDDEN).build();
}
}
#POST
#Path("refresh")
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.APPLICATION_JSON)
public Response refresh(Token token, #HeaderParam("user-agent") String userAgent) throws AuthenticationException {
return Response.status(Response.Status.CREATED)
.entity(this.authenticationService.refresh(token.getRefreshToken(), userAgent))
.build();
}
#POST
#Path("register")
#Produces(MediaType.APPLICATION_JSON)
#Consumes(MediaType.APPLICATION_JSON)
public Response register(User user) {
user = authenticationService.save(user);
return Response.status(Response.Status.CREATED)
.entity(user)
.build();
}
}
Choose either one of the following but not both:
<!-- JSON-B (JSR-347) support -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
<version>2.27</version>
</dependency>
<!-- Jackson 2.x support -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>2.27</version>
</dependency>
Both Jackson and JSON-B provide JSON from/to Java binding:
Jackson is a quite mature library for JSON processing. It's flexible and has a fair number of extensions modules.
JSON-B is also referenced as JSR-347. It's an specification for JSON binding. The actual implementation will be provided by Eclipse Yasson, which is the reference implementation of the JSR-347.
If you want go for jersey-media-json-jackson, you are supposed to use Jackson annotations. To ignore a property, for instance, use #JsonIgnore.
If you want to go for jersey-media-json-binding, you are supposed to use JSON-B annotations. To ignore a property, for instance, use #JsonbTransient.
You are using jersey-bom, a dependency management artifact that consolidate and centralize the management of dependency versions (without actually adding the dependencies to the project).
So you don't need to specify the version of the org.glassfish.jersey artifacts. Use one of the following (without version):
<!-- JSON-B (JSR-347) support -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-binding</artifactId>
</dependency>
<!-- Jackson 2.x support -->
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
</dependency>
See more details here and here.
The following code works for me with jackson version 2.8.10
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.ObjectMapper;
public class JsonIgnoreExample {
private static class BeanWithIgnore {
#JsonIgnore
public int id;
public String name;
public BeanWithIgnore(int id, String name) {
this.id = id;
this.name = name;
}
}
public static void main(String[] args) throws JsonProcessingException {
BeanWithIgnore bean = new BeanWithIgnore(1, "My bean");
String result = new ObjectMapper().writeValueAsString(bean);
System.out.println(result); // {"name":"My bean"}
}
}
Basically the jersey-media-json-binding and jersey-media-json-jackson have similar behavior. You can't use both at the same time. The reason the jersey-media-json-jackson was not working it is because the provider which have more priority is the jersey-media-json-binding.
I don't know the whole configuration of your project so one think you can do that is, create manually JSON and then send to response like:
ObjectMapper maper = new ObjectMapper();
return Response.ok(maper.writer().withDefaultPrettyPrinter().writeValueAsString(tokenObject));
It will work like manual conversion without using auto serialization by Jersey.
Note: This thing is not recommendable but it should work.
You need this dependency for conversion:
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>2.2.3</version>
</dependency>
This works for me, I have these libs in my pom.xml:
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-json-jackson</artifactId>
<version>${org.glassfish.jersey.core.version}</version>
<scope>provided</scope>
</dependency>
<!-- ************** Jackson XML and JSON API ************************* -->
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson-version}</version>
</dependency>
<dependency>
<groupId>org.glassfish.jersey.media</groupId>
<artifactId>jersey-media-moxy</artifactId>
<version>${org.glassfish.jersey.core.version}</version>
<scope>provided</scope>
</dependency>
Just remove that property from your class and add this annotation:
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
#JsonIgnoreProperties(ignoreUnknown=true)
public class Token {
// ... keep only the properties you want to map
this will tell Jackson to only bind the properties which you actually have in your class ignoring all the rest that might be present in the JSON output.
I am relatively new to Lucene and playing with the latest version 6.4.0.
I have written a cutom analyzer class for doing synonyms,
public class MySynonymAnalyzer extends Analyzer {
#Override
protected TokenStreamComponents createComponents(String fieldName) {
Tokenizer source = new ClassicTokenizer();
TokenStream filter = new StandardFilter(source);
filter = new LowerCaseFilter(filter);
filter = new SynonymGraphFilter(filter, getSynonymsMap(), false);
filter = new FlattenGraphFilter(filter);
return new TokenStreamComponents(source, filter);
}
private SynonymMap getSynonymsMap() {
try {
SynonymMap.Builder builder = new SynonymMap.Builder(true);
builder.add(new CharsRef("work"), new CharsRef("labor"), true);
builder.add(new CharsRef("work"), new CharsRef("effort"), true);
SynonymMap mySynonymMap = builder.build();
return mySynonymMap;
} catch (Exception ex) {
return null;
}
}
In the line where I call getSynonymsMap(), I get the following exception:
Exception in thread "main" java.lang.NoSuchMethodError: org.apache.lucene.util.UnicodeUtil.UTF16toUTF8WithHash([CIILorg/apache/lucene/util/BytesRef;)I
at org.apache.lucene.analysis.synonym.SynonymMap$Builder.add(SynonymMap.java:192)
at org.apache.lucene.analysis.synonym.SynonymMap$Builder.add(SynonymMap.java:239)
at m2_lab4.MySynonymAnalyzer.getSynonymsMap(MySynonymAnalyzer.java:37)
at m2_lab4.MySynonymAnalyzer.createComponents(MySynonymAnalyzer.java:28)
at org.apache.lucene.analysis.Analyzer.tokenStream(Analyzer.java:162)
at org.apache.lucene.document.Field.tokenStream(Field.java:568)
Version 6.4.0 doesn't seem to have method UTF16toUTF8WithHash in class UnicodeUtil. I am using everything from lucene 6.4.0 and there doesn't seem to be any old versioned jar in my classpath. This is how my maven dependendies look like:
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<lucene.version>6.4.0</lucene.version>
</properties>
<dependencies>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-core</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers-common</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queryparser</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-queries</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-analyzers</artifactId>
<version>3.6.2</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-facet</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>org.apache.lucene</groupId>
<artifactId>lucene-spatial</artifactId>
<version>${lucene.version}</version>
</dependency>
<dependency>
<groupId>com.spatial4j</groupId>
<artifactId>spatial4j</artifactId>
<version>0.4.1</version>
</dependency>
<dependency>
<groupId>org.json</groupId>
<artifactId>json</artifactId>
<version>20090211</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-io</artifactId>
<version>1.3.2</version>
</dependency>
</dependencies>
Any idea what's going on? I am specially puzzled by the [CIILorg/apache/lucene/util/BytesRef text inside the exception description.