According to the Osmosis Github site I've installed Osmosis and I am trying to put an osm package to Elasticsearch by typing:
$ osmosis --read-pbf ~/osm/extract/azores-latest.osm.pbf --write-elasticsearch cluster.hosts="localhost"
The execution fails with:
SEVERE: Execution aborted.
java.lang.NullPointerException at org.openstreetmap.osmosis.plugin.elasticsearch.utils.Parameters$Builder.loadResource(Parameters.java:57)
at org.openstreetmap.osmosis.plugin.elasticsearch.ElasticSearchWriterFactory.buildPluginParameters(ElasticSearchWriterFactory.java:49)
at org.openstreetmap.osmosis.plugin.elasticsearch.ElasticSearchWriterFactory.createTaskManagerImpl(ElasticSearchWriterFactory.java:27)
at org.openstreetmap.osmosis.core.pipeline.common.TaskManagerFactory.createTaskManager(TaskManagerFactory.java:60)
The ElasticSearchWriterFactory handles "plugin.properties" to the Parameters$Builder.loadResource() method. I've tried to figure the problem out by adding some log lines into the /elasticsearch-osmosis-plugin-1.3.0.jar. So I get:
resource: plugin.properties
getClass() : class org.openstreetmap.osmosis.plugin.elasticsearch.utils.Parameters$Builder
getClass().getClassLoader() : ClassRealm[osmosis.core, parent: null]
getClass().getName() : org.openstreetmap.osmosis.plugin.elasticsearch.utils.Parameters$Builder
getClass().getPackage() : package org.openstreetmap.osmosis.plugin.elasticsearch.utils
getClass().getClassLoader().getResource(resource) : null
getClass().getClassLoader().getResource("/opt/osmosis-0.43/" + resource) : null
(The last line in order to test if the relative path was the problem but that does not seem to be the problem.)
I'va also copied plugin.properties to any location / path that I could imagine to be part of interest, i.e. package root etc. ... with no success.
Anybody an idea how to solve that? Thanks very much!
Related
I'm trying to connect to Teradata through RStudio, but for some reason JDBC function has problems recognizing the path where Java drivers sit. See the code below:
library(RODBC)
library(RJDBC)
library(rJava)
# both Java drivers definitely exist
file.exists('/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar')
[1] TRUE
file.exists('/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar')
[1] TRUE
But when I paste those paths in JDBC call...
# allow more elaborated error messages to appear
.jclassLoader()$setDebug(1L)
drv = JDBC("com.teradata.jdbc.TeraDriver","/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar")
... I get the following error:
RJavaClassLoader: added
'/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar'
to the URL class path loader WARNING: the path
'/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar;/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar'
does NOT exist, it will NOT be added to the internal class path!
RJavaClassLoader: added
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar'
to the URL class path loader RJavaClassLoader: adding Java archive
file
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar'
to the internal class path
RJavaClassLoader#3d4eac69.findClass(com.teradata.jdbc.TeraDriver)
- URL loader did not find it: java.lang.ClassNotFoundException: com.teradata.jdbc.TeraDriver
RJavaClassLoader.findClass("com.teradata.jdbc.TeraDriver")
- trying class path "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/java"
Directory, can get
'/Library/Frameworks/R.framework/Versions/3.4/Resources/library/rJava/java/com/teradata/jdbc/TeraDriver.class'?
NO
- trying class path "/Library/Frameworks/R.framework/Versions/3.4/Resources/library/RJDBC/java/RJDBC.jar"
JAR file, can get 'com/teradata/jdbc/TeraDriver'? NO
ClassNotFoundException Error in .jfindClass(as.character(driverClass)[1]) : class not found
Running the same code in R, rather than RStudio, returns the same error.
Also, re-installing RJDBC package (as suggested here) didn't solve the issue.
Can anyone explain why this is happening? Thanks for help.
Here's my session info:
> sessionInfo()
R version 3.4.1 (2017-06-30)
Platform: x86_64-apple-darwin15.6.0 (64-bit)
Running under: macOS High Sierra 10.13.3
Matrix products: default
BLAS: /System/Library/Frameworks/Accelerate.framework/Versions/A/Frameworks/vecLib.framework/Versions/A/libBLAS.dylib
LAPACK: /Library/Frameworks/R.framework/Versions/3.4/Resources/lib/libRlapack.dylib
locale:
[1] en_GB.UTF-8/en_GB.UTF-8/en_GB.UTF-8/C/en_GB.UTF-8/en_GB.UTF-8
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] devtools_1.13.4 RJDBC_0.2-7 rJava_0.9-9 DBI_0.8 RODBC_1.3-15
[6] dplyr_0.7.4 readr_1.1.1
loaded via a namespace (and not attached):
[1] Rcpp_0.12.15 bindr_0.1 magrittr_1.5 hms_0.3 R6_2.2.2
[6] rlang_0.1.6 httr_1.3.1 tools_3.4.1 git2r_0.19.0 withr_2.1.1.9000
[11] yaml_2.1.16 assertthat_0.2.0 digest_0.6.15 tibble_1.4.2 bindrcpp_0.2
[16] curl_3.0 memoise_1.1.0 glue_1.2.0 compiler_3.4.1 pillar_1.1.0
[21] pkgconfig_2.0.1
That's a mistake in the path - you have inadvertently pasted two paths together (note the semicolon between the paths). You probably intended
drv <- JDBC("com.teradata.jdbc.TeraDriver",
c("/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/tdgssconfig.jar",
"/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/terajdbc4.jar"))
note that you probably can make your life easier by simply using
drv <- JDBC("com.teradata.jdbc.TeraDriver", Sys.glob("/Users/KULMAK/Documents/TeraJDBC__indep_indep.16.10.00.03/*.jar"))
This worked for me. Just make sure that both jars are located in the referenced directory.
library(RJDBC)
drv <- RJDBC::JDBC(driverClass = "com.teradata.jdbc.TeraDriver", classPath = Sys.glob("~/drivers/teradata/*"))
conn <- dbConnect(drv,'jdbc:teradata://<server>/<db>',"un","pw")
result.df<- dbGetQuery(conn,"select * from table")
There is existing code that has a call
URL resource = ClassLoader.getSystemResource("hp.obo.gz");
From my understanding, this searches the classpath for the requested file. I printed out the classpath using the code from here: https://www.mkyong.com/java/how-to-print-out-the-current-project-classpath/
and got the following:
/C:/Program%20Files/JetBrains/IntelliJ%20IDEA%202017.1.3/lib/idea_rt.jar
/C:/Program%20Files/JetBrains/IntelliJ%20IDEA%202017.1.3/plugins/junit/lib/junit-rt.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/charsets.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/deploy.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/access-bridge-64.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/cldrdata.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/dnsns.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/jaccess.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/jfxrt.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/localedata.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/nashorn.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/sunec.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/sunjce_provider.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/sunmscapi.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/sunpkcs11.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/ext/zipfs.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/javaws.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/jce.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/jfr.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/jfxswt.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/jsse.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/management-agent.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/plugin.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/resources.jar
/C:/Program%20Files/Java/jdk1.8.0_66/jre/lib/rt.jar
/C:/Users/johnp/Desktop/git_stuff/boqa/target/test-classes/
/C:/Users/johnp/Desktop/git_stuff/boqa/target/classes/
/C:/Users/johnp/.m2/repository/commons-cli/commons-cli/1.2/commons-cli-1.2.jar
/C:/Users/johnp/.m2/repository/de/charite/compbio/ontologizer-core/2.1-SNAPSHOT/ontologizer-core-2.1-20160115.222100-6.jar
/C:/Users/johnp/.m2/repository/com/att/research/grappa/1.2.1/grappa-1.2.1.jar
/C:/Users/johnp/.m2/repository/de/charite/compbio/ontologizer-benchmark/2.1-SNAPSHOT/ontologizer-benchmark-2.1-20160115.222106-6.jar
/C:/Users/johnp/.m2/repository/com/beust/jcommander/1.35/jcommander-1.35.jar
/C:/Users/johnp/.m2/repository/org/slf4j/slf4j-api/1.7.7/slf4j-api-1.7.7.jar
/C:/Users/johnp/.m2/repository/org/apache/logging/log4j/log4j-1.2-api/2.8.2/log4j-1.2-api-2.8.2.jar
/C:/Users/johnp/.m2/repository/org/apache/logging/log4j/log4j-api/2.8.2/log4j-api-2.8.2.jar
/C:/Users/johnp/.m2/repository/org/apache/logging/log4j/log4j-core/2.8.2/log4j-core-2.8.2.jar
/C:/Users/johnp/.m2/repository/junit/junit/4.12/junit-4.12.jar
/C:/Users/johnp/.m2/repository/org/hamcrest/hamcrest-core/1.3/hamcrest-core-1.3.jar
/C:/Program%20Files/JetBrains/IntelliJ%20IDEA%202017.1.3/lib/idea_rt.jar
However, where it actually is found is here (deleting hp.obo.gz causes a null pointer exception):
C:\Users\johnp\Desktop\git_stuff\boqa\src\main\resources
I don't see how it got this location given the above output (it seems similar to /C:/Users/johnp/Desktop/git_stuff/boqa/target/test-classes/
and
/C:/Users/johnp/Desktop/git_stuff/boqa/target/classes/). Any help would be appreciated. Thanks!
Right click on a folder and "mark directory as" -> "Resources Root". This will configure everything behind the scenes in IntelliJ to work
I want to use synonyms () described in 'Intro to the tm package' for R. It uses the wordnet package. The wordnet package downloaded from CRAN does not have Dict (dictionary) in its directory. I downloaded it from the Princeton site and copied it over to the directory. After using sys.setenv() and setDict() for setting paths, I still get this error:
Error in sort(unique(unlist(lapply(synsets, getWord))))
error in evaluating the argument 'x' in selecting a method for function 'sort': Error in unique(unlist(lapply(synsets, getWord))) :
error in evaluating the argument 'x' in selecting a method for function 'unique': Error in .jcall(synset, "Ljava/util/List;", "getWord") :
java.lang.NumberFormatException: For input string: "t"
when I try synonyms("company", pos = "NOUN") or another English word in place of 'company'. The problem is in getSynonyms() called from synonyms(). Any idea on how to fix this problem?
Different combinations lead to different input string NumberFormatException. My Java is version 1.8. I tried all the online resources. I added two paths to PATH for R's bin and RJava's jri. Discussion on the exception indicates it is a string to numeric conversion issue. I have made sure that Java to R linkage (via rJava) works (URL: https://www.rforge.net/rJava/ ).
I have two property files:
#environment.properties
env = production
and second file is:
#commons.properties
production.port = 123
test.port = 567
Also,I have resource file which need be filtered by environment.properties file and commons.properties file and copied.
The resource-file contains:
${${env}.port}
So,I want to filter my resource file with first file and get:
${production.port}
and then I want to filter it with second filter file and get:
123
I use maven 3.2.5 and the resource-file isn't filtered at all.
I know that there's issue related with this problem:
https://jira.codehaus.org/browse/MRESOURCES-70 But it still unresolved.
So,my question is - is there any solution to resolve this problem? (actually,I think that resource-plugin should be modified for work with nested property filtering).
And second question - does exist any way to avoid this problem by refactoring,I mean any other architecture solution. Or, what would you do if you had same problem?
I tried setting up a BigQuery project with a JAVA API to access it. But when I run the google BigQueryInstalledAuthDemo class which is here, I get this error :
java.lang.NullPointerException
at com.google.common.base.Preconditions.checkNotNull(Preconditions.java:191)
at com.google.api.client.json.jackson.JacksonFactory.createJsonParser(JacksonFactory.java:70)
at com.google.api.client.json.JsonFactory.fromInputStream(JsonFactory.java:223)
at com.google.api.client.googleapis.auth.oauth2.GoogleClientSecrets.load(GoogleClientSecrets.java:167)
at BigQueryLocal.loadClientSecrets(BigQueryLocal.java:99)
at BigQueryLocal.<clinit>(BigQueryLocal.java:31)
Exception in thread "main" java.lang.NullPointerException
at com.google.api.client.googleapis.auth.oauth2.GoogleAuthorizationCodeRequestUrl. <init>(GoogleAuthorizationCodeRequestUrl.java:111)
at BigQueryLocal.main(BigQueryLocal.java:47)
Which I don't understand, my JSON file is in the same folder than the class (I tried both relative and absolute paths)
My JSON file is like this :
{
"installed": {
"client_id": "XXXXXXXXXXXXXXXXXXXX.apps.googleusercontent.com",
"client_secret": "XXXXXXXXXXXXXXXXX",
"redirect_uris": ["urn:ietf:oauth:2.0:oob"],
"auth_uri": "https://accounts.google.com/o/oauth2/auth",
"token_uri": "https://accounts.google.com/o/oauth2/token"
}
}
I use the google API library 1.12-beta and java 1.6.
So, I don't understand why I have this error right there :(, so if anyone has an idea...
Thank you :)
Which IDE are you using? This tends to happen when your code can't locate the resource, because it is in the wrong directory, or is in a directory that your app doesn't consider a resource.
There's a lot of info on Stack Overflow about handling this, for example:
Where to put a textfile I want to use in eclipse?