0% found this document useful (0 votes)
153 views

Rjava.R: .Jcall Doent Works, As Stacktrace Below: Error in .Jcall (Obj Obj, Returnsig "V", Method "Gen", "A", "B")

The documents describe steps to compile and package a Java class into a JAR file and copy the JAR and dependencies to an R project folder for use in R. The Java class scrapes sales data from a website, transforms it, and writes the output to a CSV file. When called from R, initialization and method calls on the Java class fail due to classpath issues.

Uploaded by

JoãoBoscoJares
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
153 views

Rjava.R: .Jcall Doent Works, As Stacktrace Below: Error in .Jcall (Obj Obj, Returnsig "V", Method "Gen", "A", "B")

The documents describe steps to compile and package a Java class into a JAR file and copy the JAR and dependencies to an R project folder for use in R. The Java class scrapes sales data from a website, transforms it, and writes the output to a CSV file. When called from R, initialization and method calls on the Java class fail due to classpath issues.

Uploaded by

JoãoBoscoJares
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 9

rJava.

R
Sys.setenv(JAVA_HOME="C:/Program Files/Java/jdk1.7.0_71/jre")
if(!("rJava" %in% rownames(installed.packages()))){
install.packages("rJava")
}

javaCompileAndPackageToRFolder.R
library(rJava)

compileAndPackagejavaToRFolder <- function(massgenFolder){


rProjectMainFolder <- getwd()
setwd(massgenFolder)
system("mvn clean dependency:copy-dependencies package",show.output.on.console = TRUE)

if(file.exists("MassGen-0.0.1-SNAPSHOT.jar")){
file.remove("MassGen-0.0.1-SNAPSHOT.jar")
}
file.copy(paste0(getwd(),"/","target/","MassGen-0.0.1-SNAPSHOT.jar"),
paste0(rProjectMainFolder),overwrite = TRUE)
if(!file.exists(paste0(rProjectMainFolder,"/","lib"))){
dir.create(paste0(rProjectMainFolder,"/","lib"),
showWarnings = TRUE, recursive = FALSE)
}
DirSource <- paste0(getwd(),"/","target/","dependency/*.*")
DirEnd <- paste0(rProjectMainFolder,"/","lib/")
file.copy( paste0(getwd(),"/","target/","dependency"),
paste0(rProjectMainFolder,"/","lib"), overwrite = TRUE)
system(paste("cp -r", DirSource, DirEnd))
setwd(rProjectMainFolder)
}
compileAndPackagejavaToRFolder()

TestJavaCall.R
source("rJava.R")
source("javaCompileAndPackageToRFolder.R")
library(rJava)

executeAMethod <- function(){


.jinit("MassGen-0.0.1-SNAPSHOT.jar",parameters="-Xmx512m")
obj = .jnew(class = "com/xxxxx/massgen/ITunesSalesDataGen",check = TRUE)

.jcall(obj = obj,returnSig = "V",method = "gen","a","b")

.jcall doent works, as stacktrace below:


Error in .jcall(obj = obj, returnSig = "V", method = "gen", "a", "b") :

method gen with signature (Ljava/lang/String;Ljava/lang/String;)V not found


obj$gen(paste0(gsub("\\\\", "/", getwd()),"/xxxxxinput.csv")
,paste0(gsub("\\\\", "/", getwd()),"/dependency/xxxoutput.csv"))

obj$gen doent works, as stacktrace below:


Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :
java.lang.NoClassDefFoundError: org/jsoup/Jsoup
}
executeAMethod()

Java Class
import
import
import
import
import
import
import
import

java.io.BufferedReader;
java.io.File;
java.io.FileInputStream;
java.io.InputStreamReader;
java.text.SimpleDateFormat;
java.util.ArrayList;
java.util.Date;
java.util.List;

import
import
import
import
import
import

org.apache.commons.io.FileUtils;
org.jsoup.Jsoup;
org.jsoup.nodes.Document;
org.jsoup.nodes.Element;
org.jsoup.select.Elements;
org.springframework.stereotype.Service;

import com.xxxxx.model.itunessalesdata.ITunesDigitalSalesData;
@Service
public class ITunesSalesDataGen {

/** I tried use static method, change argument into string array... **/
public void gen(String input, String output) {
try{
List<ITunesDigitalSalesData> result = new ArrayList<ITunesDigitalSalesData>();
ITunesDigitalSalesData itunesDigitalSalesData = null;
String iTunesFilePath = input;
FileInputStream fis = null;
if(iTunesFilePath==null || "".equals(iTunesFilePath)){
throw new RuntimeException("Please, input the filepath argument.");
}else{
fis = new FileInputStream(new File(iTunesFilePath));
}
BufferedReader reader = new BufferedReader(new InputStreamReader(fis));
reader.readLine();
String line;
StringBuffer sb = new StringBuffer();
sb.append("ID");
sb.append(";");
sb.append("COUNTRY");
sb.append(";");
sb.append("DATE");

sb.append(";");
sb.append("RANK");
sb.append(";");
sb.append("ARTIST");
sb.append(";");
sb.append("TITLE");
sb.append(";");
sb.append("SALES");
sb.append("\n");
while ((line = reader.readLine()) != null) {
String[] lineAttributes = line.split(";");
String countryNumber = lineAttributes[0];
String country = lineAttributes[1];

Document doc = Jsoup.connect("http://www.digitalsalesdata.com/diydsd.php?Region="+countryNumber).postDataCharset("UTF


for (Element table : doc.select("div").select("table")) {
for (Element row : table.select("tr")) {
Elements tds = row.select("td");
if (tds.size() > 0) {
if("RANK".equals(tds.get(0).text())){
continue;
}
sb.append(countryNumber);
sb.append(";");
sb.append(country);
sb.append(";");
sb.append(new SimpleDateFormat("dd/MM/yyyy").format(new Date()));
sb.append(";");
sb.append(tds.get(0).text());
sb.append(";");
sb.append(tds.get(1).text());
sb.append(";");
sb.append(tds.get(2).text());
sb.append(";");
sb.append(tds.get(3).text());
sb.append("\n");
}
}
}
}
String iTunesFilePathResult = output;
FileUtils.writeStringToFile(new File(iTunesFilePathResult),sb.toString(),"UTF-8");
}catch(Exception e){
throw new RuntimeException(e.getMessage(),e);
}
}
}

The output
source("testJavaCall.R")

[INFO] Scanning for projects... [WARNING] [WARNING] Some problems were encountered while building the effective model for
com.xxxxx:MassGen:jar:0.0.1-SNAPSHOT [WARNING] 'dependencies.dependency.(groupId:artifactId:type:classifier)' must be unique:
org.apache.httpcomponents:httpclient:jar -> version 4.3.5 vs 4.4.1 @ line 227, column 15 [WARNING] 'build.plugins.plugin.version' for
org.apache.maven.plugins:maven-jar-plugin is missing. @ line 30, column 21 [WARNING] [WARNING] It is highly recommended to fix these

problems because they threaten the stability of your build. [WARNING] [WARNING] For this reason, future Maven versions might no longer support
building such malformed projects. [WARNING] [INFO]
[INFO] ------------------------------------------------------------------------ [INFO] Building MassGen 0.0.1-SNAPSHOT [INFO] ----------------------------------------------------------------------- [INFO] [INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ MassGen --- [INFO] Deleting
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target [INFO] [INFO] --- maven-dependency-plugin:2.8:copy-dependencies (default-cli) @
MassGen --- [INFO] Copying commons-logging-1.2.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\commonslogging-1.2.jar [INFO] Copying guava-18.0.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\guava-18.0.jar [INFO]
Copying spring-expression-4.1.6.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-expression4.1.6.RELEASE.jar [INFO] Copying spring-beans-4.1.6.RELEASE.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-beans-4.1.6.RELEASE.jar [INFO] Copying jsoup-1.8.2.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\jsoup-1.8.2.jar [INFO] Copying spring-aop-4.1.6.RELEASE.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-aop-4.1.6.RELEASE.jar [INFO] Copying aspectjweaver-1.8.5.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\aspectjweaver-1.8.5.jar [INFO] Copying jcl-over-slf4j-1.7.10.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\jcl-over-slf4j-1.7.10.jar [INFO] Copying gson-2.3.1.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\gson-2.3.1.jar [INFO] Copying commons-lang3-3.3.2.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\commons-lang3-3.3.2.jar [INFO] Copying hamcrest-core-1.3.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\hamcrest-core-1.3.jar [INFO] Copying spring-context-4.1.6.RELEASE.jar
to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-context-4.1.6.RELEASE.jar [INFO] Copying httpcore-4.4.1.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\httpcore-4.4.1.jar [INFO] Copying spring-jdbc-4.1.6.RELEASE.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-jdbc-4.1.6.RELEASE.jar [INFO] Copying spring-data-commonscore-1.4.1.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-data-commons-core-1.4.1.RELEASE.jar
[INFO] Copying spring-aspects-4.1.6.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-aspects4.1.6.RELEASE.jar [INFO] Copying httpmime-4.4.1.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\httpmime4.4.1.jar [INFO] Copying spring-core-4.1.6.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-core4.1.6.RELEASE.jar [INFO] Copying json-simple-1.1.1.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\json-simple1.1.1.jar [INFO] Copying log4j-1.2.17.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\log4j-1.2.17.jar [INFO] Copying
mongo-java-driver-3.0.0.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\mongo-java-driver-3.0.0.jar [INFO] Copying
spring-orm-4.1.6.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-orm-4.1.6.RELEASE.jar [INFO]
Copying commons-codec-1.9.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\commons-codec-1.9.jar [INFO]
Copying spring-data-commons-1.10.0.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-datacommons-1.10.0.RELEASE.jar [INFO] Copying commons-io-2.4.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\commons-io-2.4.jar [INFO] Copying spring-data-mongodb1.7.0.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-data-mongodb-1.7.0.RELEASE.jar [INFO]
Copying spring-webmvc-4.1.6.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-webmvc4.1.6.RELEASE.jar [INFO] Copying httpclient-4.4.1.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\httpclient4.4.1.jar [INFO] Copying spring-tx-4.1.6.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-tx4.1.6.RELEASE.jar [INFO] Copying spring-web-4.1.6.RELEASE.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-web-4.1.6.RELEASE.jar [INFO] Copying spring-test4.1.6.RELEASE.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\spring-test-4.1.6.RELEASE.jar [INFO] Copying
aopalliance-1.0.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\aopalliance-1.0.jar [INFO] Copying slf4j-api1.7.10.jar to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\slf4j-api-1.7.10.jar [INFO] Copying junit-4.12.jar to
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\dependency\junit-4.12.jar [INFO] [INFO] --- maven-resources-plugin:2.6:resources
(default-resources) @ MassGen --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 585 resources [INFO] [INFO] --maven-compiler-plugin:3.1:compile (default-compile) @ MassGen --- [INFO] Changes detected - recompiling the module! [INFO] Compiling 31
source files to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\classes [INFO] [INFO] --- maven-resources-plugin:2.6:testResources
(default-testResources) @ MassGen --- [INFO] Using 'UTF-8' encoding to copy filtered resources. [INFO] Copying 0 resource [INFO] [INFO] --maven-compiler-plugin:3.1:testCompile (default-testCompile) @ MassGen --- [INFO] Changes detected - recompiling the module! [INFO] Compiling
1 source file to C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\test-classes [INFO] [INFO] --- maven-surefire-plugin:2.12.4:test
(default-test) @ MassGen --- [INFO] Surefire report directory: C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\surefire-reports

TESTS
Running com.xxxxx.massgen.PlayActionRandomGenTest SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder". SLF4J: Defaulting to nooperation (NOP) logger implementation SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details. May 15, 2015 10:53:18
PM com.mongodb.diagnostics.logging.JULLogger log INFO: Cluster created with settings {hosts=[localhost:27017], mode=SINGLE,
requiredClusterType=UNKNOWN, serverSelectionTimeout='30000 ms', maxWaitQueueSize=50} May 15, 2015 10:53:18 PM
com.mongodb.diagnostics.logging.JULLogger log INFO: Opened connection [connectionId{localValue:1, serverValue:201}] to localhost:27017 May

15, 2015 10:53:18 PM com.mongodb.diagnostics.logging.JULLogger log INFO: Monitor thread successfully connected to server with description
ServerDescription{address=localhost:27017, type=STANDALONE, state=CONNECTED, ok=true, version=ServerVersion{versionList=[2, 6, 4]},
minWireVersion=0, maxWireVersion=2, maxDocumentSize=16777216, roundTripTimeNanos=682327} started May 15, 2015 10:53:19 PM
com.mongodb.diagnostics.logging.JULLogger log INFO: Opened connection [connectionId{localValue:2, serverValue:202}] to localhost:27017
finished Tests run: 2, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 5.358 sec
Results :
Tests run: 2, Failures: 0, Errors: 0, Skipped: 0
[INFO] [INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ MassGen --- [INFO] Building jar:
C:\Users\JoaoBoscoJares\workspace\xxxxx\MassGen\target\MassGen-0.0.1-SNAPSHOT.jar [INFO] -----------------------------------------------------------------------

BUILD SUCCESS
[INFO] ------------------------------------------------------------------------ [INFO] Total time: 11.661 s [INFO] Finished at: 2015-05-15T22:53:21+01:00
[INFO] Final Memory: 23M/218M [INFO] ------------------------------------------------------------------------

Error in .jcall("RJavaTools", "Ljava/lang/Object;", "invokeMethod", cl, :


java.lang.NoClassDefFoundError: org/jsoup/Jsoup

The pom.xml
<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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.xxx</groupId>
<artifactId>MassGen</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<spring.version>4.1.6.RELEASE</spring.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
</properties>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<executions>
<execution>
<phase>install</phase>
<goals>
<goal>copy-dependencies</goal>
</goals>
<configuration>
<outputDirectory>${project.build.directory}/lib</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-jar-plugin</artifactId>
<configuration>
<archive>
<manifest>
<addClasspath>true</addClasspath>
<classpathPrefix>lib/</classpathPrefix>
</manifest>
</archive>
</configuration>

</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>sifem3</id>
<name>sifem</name>
<url>http://vmdeb20.deri.ie:8001/repository/sifem3/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>apache-repo-snapshots</id>
<url>https://repository.apache.org/content/repositories/releases/</url>
<releases>
<enabled>false</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
<repository>
<id>bedatadriven</id>
<name>bedatadriven public repo</name>
<url>http://nexus.bedatadriven.com/content/groups/public/</url>
</repository>
<repository>
<id>rforge</id>
<name>rforge public repo</name>
<url>http://www.rforge.net/rJava/files/</url>
</repository>
<repository>
<id>mjorm-webdav-maven-repo</id>
<name>mjorm maven repository</name>
<url>http://mongo-java-orm.googlecode.com/svn/maven/repo/</url>
<layout>default</layout>
</repository>
<repository>
<id>central</id>
<url>http://repo1.maven.org/maven2/</url>
</repository>
</repositories>
<dependencies>
<!-- Spring -->

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
<exclusions>

<exclusion>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-webmvc</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-aspects</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.3.2</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-tx</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-orm</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-test</artifactId>
<version>${spring.version}</version>
<scope>compile</scope>
</dependency>

<!-- mongo -->


<dependency>
<groupId>org.mongodb</groupId>
<artifactId>mongo-java-driver</artifactId>
<version>3.0.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-mongodb</artifactId>
<version>1.7.0.RELEASE</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>org.springframework.data</groupId>
<artifactId>spring-data-commons-core</artifactId>
<version>1.4.1.RELEASE</version>
<scope>compile</scope>
</dependency>
<!-- Test -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<!-- apache http components -->
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpcore</artifactId>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.3.5</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpmime</artifactId>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<version>4.4.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>18.0</version>
<scope>compile</scope>
</dependency>

<dependency>
<groupId>com.googlecode.json-simple</groupId>
<artifactId>json-simple</artifactId>
<version>1.1.1</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.jsoup</groupId>
<artifactId>jsoup</artifactId>
<version>1.8.2</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.4</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>com.google.code.gson</groupId>
<artifactId>gson</artifactId>
<version>2.3.1</version>
<scope>compile</scope>
</dependency>
</dependencies>
</project>

You might also like