Shell+java error - shell

I want to run either editor.sh or snippetCollector.sh under modules/editor/scripts in Sentrick. So I got it by git clone git://sentrick.git.sourceforge.net/gitroot/sentrick/sentrick. That is not a problem. I read the documentation under the doc folder. It says to run either editor.sh or snippetCollector.sh. I go and I do: ./editor.sh and it doesn't work. So I see online that you can also use sh editor.sh which also doesn't work. It says
Exception in thread "main" java.lang.NoClassDefFoundError: de/denkselbst/sentrick/sbeditor/SbEditor
Caused by: java.lang.ClassNotFoundException: de.denkselbst.sentrick.sbeditor.SbEditor
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: de.denkselbst.sentrick.sbeditor.SbEditor. Program will exit.
I have not edited anything so I think that it should work, but it doesn't!!
Inside editor.sh (the one I want to run but can't) it says only this:
java -cp #CP.UNIX# de.denkselbst.sentrick.sbeditor.SbEditor
The problem with snippetCollector.sh is the same

-cp is configuring the CLASSPATH, which should contain a reference to the directory containing your classes. I suspect that's not been set correctly, and this is a useful reference for setting it.

It seems that you are missing some class files while running your code..please check whether you follow all the steps mentioned in your doc..make sure to set the CLASSPATH and try to rerun the program..

It is clear that you are having class path issue. Normaly when I run application in linux envirenment my sh is look like bellow.
#!/bin/sh
THE_CLASSPATH=/home/pathto/lib
java -cp ${THE_CLASSPATH}/required.jar de.denkselbst.sentrick.sbeditor.SbEditor

Related

Unable to run basic example for hadoop

Hadoop version 2.9.0, Java - 1.8.0_162
When trying to run the example given here: https://hadoop.apache.org/docs/stable/hadoop-project-dist/hadoop-common/SingleCluster.html, under standalone operation, I get the following error:
$ bin/hadoop jar share/hadoop/mapreduce/hadoop-mapreduce-examples-2.9.0.jar grep input output 'dfs[a-z.]+'
java.lang.NoSuchMethodError: org.apache.hadoop.util.ProgramDriver.run([Ljava/lang/String;)I
at org.apache.hadoop.examples.ExampleDriver.main(ExampleDriver.java:74)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:498)
at org.apache.hadoop.util.RunJar.main(RunJar.java:156)
I am new to hadoop and not sure how to fix this. I have set the JAVA_HOME in hadoop-env.sh. I am pretty sure that I am using the correct compatible versions of java and hadoop.
Any help will be useful.
Nish,
The error message means that while the runtime was able to find the class ProgramDriver, the function run() is not present.
The most likely reason for this is that you're running an old version of Hadoop that exposed a difference interface in ProgramDriver. About a year ago this method was renamed to run() after being called driver().
The fix for that would be making sure you're running a recent version of Hadoop.
For your reference please check following links they have asked same question.
Error while executing hadoop-mapreduce-examples-2.2.0.jar
Can the hadoop programm which write under the hadoop-2.2.0 run in hadoop-1.2.1?

IntelliJ IDEA - Cannot inject value for option 'onRedeploy'

While trying out Automatic redeployment in IntelliJ IDEA, I'm stuck with onRedeploy, My bash script file has the following code:
#!/usr/bin/env bash
mvn package
java -jar target/Test-1.0-SNAPSHOT-fat.jar \
--redeploy="src/**/*.js,src/**/*.java,src/**/*.html,src/**/*.jade" \
--onRedeploy="./run.sh"
So, whenever I run this bash script, I got an error:
Error while executing command run: Cannot inject value for option 'onRedeploy'
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at io.vertx.core.cli.annotations.CLIConfigurator.inject(CLIConfigurator.java:237)
at io.vertx.core.spi.launcher.DefaultCommandFactory.create(DefaultCommandFactory.java:50)
at io.vertx.core.impl.launcher.VertxCommandLauncher.getNewCommandInstance(VertxCommandLauncher.java:162)
at io.vertx.core.impl.launcher.VertxCommandLauncher.execute(VertxCommandLauncher.java:217)
at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:383)
at io.vertx.core.impl.launcher.VertxCommandLauncher.dispatch(VertxCommandLauncher.java:328)
at io.vertx.core.Launcher.main(Launcher.java:48)
Caused by: java.lang.NullPointerException
at io.vertx.core.impl.launcher.commands.RunCommand.setOnRedeployCommandOld(RunCommand.java:154)
... 11 more
I followed up a tutorial from youtube by Clement Escoffier & Paulo Lopes
demonstrating how to develop a realtime web application using vert.x 3
It looks like the Output Stream of yours is null. Obvs a Bug in vertx3 but not really worth fixxing because:
You would see this message: "[WARNING] the 'onRedeploy' option is deprecated, and will be removed in vert.x 3.3. Use " +
"'on-redeploy' instead."
so try "--on-redeploy" instead and tell me if it works.
Jeerze

Error Installing ruby runtime in Jenkins

I try to install ruby runtime, rvm, cucumber plugins in Jenkins,
When I am installing ruby runtime plugin, I meet this error:
java.io.IOException: Failed to dynamically deploy this plugin
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1328)
at hudson.model.UpdateCenter$DownloadJob.run(UpdateCenter.java:1126)
at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source)
at java.util.concurrent.FutureTask.run(Unknown Source)
at hudson.remoting.AtmostOneThreadExecutor$Worker.run(AtmostOneThreadExecutor.java:110)
at java.lang.Thread.run(Unknown Source)
Caused by: java.io.IOException: Failed to install ruby-runtime plugin
at hudson.PluginManager.dynamicLoad(PluginManager.java:487)
at hudson.model.UpdateCenter$InstallationJob._run(UpdateCenter.java:1324)
... 5 more
Caused by: java.io.IOException: Failed to initialize
at hudson.ClassicPluginStrategy.load(ClassicPluginStrategy.java:441)
at hudson.PluginManager.dynamicLoad(PluginManager.java:478)
... 6 more
Caused by: java.lang.ClassCircularityError: org/jruby/RubyClass
at java.lang.Class.forName0(Native Method)
...
How to fix it? Thanks in advance
It's a known bug.
There is a workaround:
in /etc/default/jenkins
-Dhudson.ClassicPluginStrategy.noBytecodeTransformer=true
JAVA_ARGS="$JAVA_ARGS -Dhudson.ClassicPluginStrategy.noBytecodeTransformer=true"
At the moment there is no definitive solution as you can see.
On Windows,
Adding argument
-Dhudson.ClassicPluginStrategy.noBytecodeTransformer=true
in jenkins.xml file worked for me as #lvthillo stated.
<arguments>-Xrs -Xmx256m -Dhudson.lifecycle=hudson.lifecycle.WindowsServiceLifecycle -Dhudson.ClassicPluginStrategy.noBytecodeTransformer=true -jar "%BASE%\jenkins.war" --httpPort=8081 --webroot="%BASE%\war"</arguments>
On OSX I had to edit /Library/Application Support/Jenkins/jenkins-runner.sh
to add these lines at a point after javaArgs was defined
# workaround for ruby runtime install issue
# per http://stackoverflow.com/questions/33883551/error-installing-ruby-runtime-in-jenkins
javaArgs="$javaArgs -Dhudson.ClassicPluginStrategy.noBytecodeTransformer=true"
There is probably a more mac-ish way to do this.
Upon rebooting Jenkins, the ruby runtime plugin, which was already downloaded, started working, as did the also-downloaded rvm plugin, which is the one I was after.
I solved it by changing java version to 8th.
Maybe there is a problem with java 11 compatibility issues.
1- https://www.liquidweb.com/kb/install-java-8-on-centos-7/
2- On Centos delete all ruby plugin in /var/lib/jenkins/plugins
3- download ruby-runtime.hpi plugin from https://updates.jenkins-ci.org/download/plugins/ruby-runtime/
4- Upload Plugin in jenkins /pluginManager/advanced.
Adding -Dhudson.ClassicPluginStrategy.noBytecodeTransformer=true in jenkins.xml file doesn't work for me (Windows, Jenkins 2.277.1).
So I just deleted all files for ruby-runtime from Plugins folder (you need to shutdown Jenkins service) and start Jenkins again.
For me, installing java 8 solved the problem. After that I was able to install the ruby-runtime plugin.
Environment: Debian 10

ElasticSearch + Twitter river class not found

I am trying to install twitter river plugin on elastic search. I have done it before on my mac without any issues, but this time I am trying to install on a Linux server and I keep getting this class not found exception. The exception comes when I use curl -XPUT command as shown in https://github.com/elasticsearch/elasticsearch-river-twitter/blob/master/README.md
Here's the exception I get :-
[2013-11-25 15:12:00,116][WARN ][river ] [Fasaud] failed to create river [twitter][my_twitter_river2]
org.elasticsearch.common.settings.NoClassSettingsException: Failed to load class with value [twitter]
at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:87)
at org.elasticsearch.river.RiverModule.spawnModules(RiverModule.java:58)
at org.elasticsearch.common.inject.ModulesBuilder.add(ModulesBuilder.java:44)
at org.elasticsearch.river.RiversService.createRiver(RiversService.java:135)
at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:271)
at org.elasticsearch.river.RiversService$ApplyRivers$2.onResponse(RiversService.java:265)
at org.elasticsearch.action.support.TransportAction$ThreadedActionListener$1.run(TransportAction.java:93)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:724)
Caused by: java.lang.ClassNotFoundException: twitter
at java.net.URLClassLoader$1.run(URLClassLoader.java:366)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at org.elasticsearch.river.RiverModule.loadTypeModule(RiverModule.java:73)
... 9 more
I have tried restarting, installing many many times and can't get it to work anyhow. I can also see that the jar files present in the plugin directories contain the class twitter but for some reason they're not available to elasticsearch execution.
This is a configuration and install issue.
Steps:
Check to see where elasticsearch is installed by running ps aux|grep elasticsearch (on linux) and that will tell which executable is running on that machine (look for a line that looks like this: (-Des.default.path.home=/usr/share/elasticsearch) or something similar.
If several elasticsearch instances running, kill them all and start the one you care about.
Ensure that only one instance of elasticsearch is running (if that is the intent) and, from step one above, go to the home path directory.
Ensure that the plugin is installed in this directory in elasticsearch/plugins dir.
Restart elasticsearch.
confirm your classpath contain a text file es-plugin.properties with content
plugin=your.package.YourRiverPlugin
missing of such a property file shows almost the same error.
for more info, please refer http://blog.trifork.com/2013/01/10/how-to-write-an-elasticsearch-river-plugin/

my pig UDF runs in local mode but fails with "Deserialization error: could not instantiate" on my cluster

I have a pig UDF which runs perfectly in local mode, but fails with: could not instantiate 'com.bla.myFunc' with arguments 'null' when I try it on the cluster.
my mistake was not digging hard enough in the task logs.
when you dig there thru the jobTracker UI, you could see that the root cause was:
Caused by: java.lang.ClassNotFoundException: com.google.common.collect.Maps
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
so, besides the usual:
pigServer.registerFunction("myFunc", new FuncSpec("com.bla.myFunc"));
we should add:
registerJar(pigServer, Maps.class);
and so on for any jar used by the UDF.
Another option is to use build-jar-with-dependencies, but then you have to put the pig.jar before yours in the classpath, or else you'll tackle this one: embedded hadoop-pig: what's the correct way to use the automatic addContainingJar for UDFs?

Resources