So far here are the things I've checked from the server:
DB2 JDBC Driver - check
DB2 License (db2jcc_license_cu.jar) included in class path - check
DB2 db2java.zip included in class path - check
DB2 db2jcc.jar included in class path - check
Here's the current class path:
CLASSPATH=/home/db2cae/sqllib/java/db2java.zip:/home/db2cae/sqllib/java/sqlj.zip:/home/db2cae/sqllib/function:/home/db2cae/sqllib/java/db2jcc_license_cu.jar:/home/db2cae/sqllib/tools/clpplus.jar:/home/db2cae/sqllib/tools/antlr-3.2.jar:/home/db2cae/sqllib/tools/jline-0.9.93.jar:/home/db2cae/sqllib/java/db2jcc.jar:.
JAVA_BINDIR=/usr/lib64/jvm/jre/bin
JAVA_HOME=/usr/lib64/jvm/jre
JAVA_ROOT=/usr/lib64/jvm/jre
The command that was executed was:
java -cp ./db2jcc.jar com.ibm.db2.jcc.DB2Jcc -version
However it returned
What could be the possible problem for this?
i assume your classpath environment is not considered.
You could try someting like:
Windows:
java -cp %CLASSPATH%;./db2jcc4.jar com.ibm.db2.jcc.DB2Jcc -version
Linux:
java -cp $CLASSPATH:./db2jcc4.jar com.ibm.db2.jcc.DB2Jcc -version
Related
We can able to configure -Dweblogic.Stdout and -Dweblogic.StdErr params in weblogic configuration to print logs
Windows platform :
set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Xms8192m -Xmx10240m
-XX:MaxPermSize=4096m -Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl
-Dweblogic.Stdout="D:\ims_ecs\bea10_36\user_projects\domains\Domainname\logs\SystemOut.txt"
-Dweblogic.Stderr="D:\ims_ecs\bea10_36\user_projects\domains\Domainname\logs\SystemErr.txt"
-Dweblogic.slc=true -Dweblogic.debug.DebugServerLifeCycle=true
Logs are printed in declared location .
Linux platform :
set SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Xms512m -Xmx1024m
-XX:MaxPermSize=512m -Djava.net.preferIPv4Stack=true -Djava.net.preferIPv6Addresses=false -Djavax.xml.parsers.SAXParserFactory=com.sun.org.apache.xerces.internal.jaxp.SAXParserFactoryImpl
-Dweblogic.Stdout=/u01/app/oracle/product/ofm12.1.2/user_projects/domains/Domainname/logs/SystemOut.txt
-Dweblogic.Stderr=/u01/app/oracle/product/ofm12.1.2/user_projects/domains/Domainname/logs/SystemErr.txt
Able to start weblogic but logs not printed in Required location
Can you please suggest how to get weblogic domain logs in linux
Windows and Linux have different nomenclature for their scripts.
Check startWebLogic.sh from WLS installation:
${VARIABLE_NAME} instead %VARIABLE_NAME%
: instead ;
etc.
Snippet code from it:
JAVA_OPTIONS="${JAVA_OPTIONS} -Dweblogic.management.password=${WLS_PW}"
...
...
${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} -Dweblogic.Name=${SERVER_NAME} -Djava.security.policy=${WLS_POLICY_FILE} ${JAVA_OPTIONS} ${PROXY_SETTINGS} ${SERVER_CLASS}
Thanks Devwebcl. Instead of % symbol need to use {} in linux
then logs get printed .
used command in linux :
SAVE_JAVA_OPTIONS=%JAVA_OPTIONS% -Djavax.xml.soap.MessageFactory=com.sun.xml.internal.messaging.saaj.soap.ver1_1.SOAPMessageFactory1_1Impl -Dweblogic.Stdout="/u01/app/oracle/product/ofm12.1.2/user_projects/domains/domainname/logs/SystemOut.txt" -Dweblogic.Stderr="/u01/app/oracle/product/ofm12.1.2/user_projects/domains/domainname/logs/SystemErr.txt"-Dweblogic.slc=true -Dweblogic.debug.DebugServerLifeCycle=true -Dweblogic.log.RedirectstdoutToServerLogEnabled=true
Hello I get this error when I try the simple esample of the tutorial:
"grun Hello -r tree
Warning: TestRig moved to org.antlr.v4.gui.TestRig; calling automatically
Problems calling org.antlr.v4.gui.TestRig.main(args)
"
I cannot figure out what is going on.
Can you help me please.
It sounds like you have setup your 'grun' alias to use :
org.antlrv4.runtime.misc.TestRig
//and from antlr4 onwards they deprecated that and use this instead.
org.antlrv4.gui.TestRig
So you should try resetting your 'grun' alias either from terminal or batch file depending on how you set it up. If there are still errors comment here and i will try and help:
alias grun='java org.antlr.v4.gui.TestRig'
if you still have any errors after updating your setup alias then leave a comment and i will try to help further.
Setup TestRig - Added here so content is not lost after the documentation section is shut down.
ANTLR contains a testing tool in its runtime library, this tool can be used to display information detailing how the parsing is performed to match input against defined rules in your grammar file.
To use this tool contained within the ANTLR jar file you should setup your systems classpath to allow access to both the ANTLR tool and the runtime library :
export CLASSPATH=".:/usr/local/lib/antlr-4.5.3-complete.jar:$CLASSPATH"
Note: Ensure the Dot precedes any path to ensure the java virtual machine wont see classes in your current working directory.
Alises can be used on Linux/MAC/Unix to simplify commands used:
alias antlr4='java -jar /usr/local/lib/antlr-4.5.3-complete.jar'
//or any directory where your jar is located
Note setup on windows for aliases and classpath setup may be more complicated, see here for more comprehensive details.
Accessing TestRig
Once you have setup your alias you can setup TestRig in the following way, again using an alias is recommended as reduces the amount of time required to perform the action:
alias grun='java org.v4.runtime.misc.TestRig'
If you do not wish to setup an alias on windows you can access TestRig by running the following command in the same location as your ANTLR jar directory:
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.runtime.misc.TestRig
//or
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig
To run TestRig on your grammar you can pass the parameters in for your grammar like this :
grun yourGrammar yourRule -tree //using the setup alias java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar YourRule -tree //on windows with no alias java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar Hello r -tree //Windows with the grammar Hello.g4 starting from the rule 'r'.
grun yourGrammar yourRule -tree //using the setup alias
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar YourRule -tree //on windows with no alias
java -cp .;antlr.4.5.3-complete.jar org.antlrv4.gui.TestRig yourGrammar Hello r -tree
//Windows with the grammar Hello.g4 starting from the rule 'r'.
I am trying to run the below java code on a hadoop server.
javac -classpath ${HADOOP_HOME}/hadoop-${HADOOP_VERSION}-core.jar -d wordcount_classes WordCount.java
but I am not able to locate {HADOOP_HOME}. I tried with hadoop -classpath but it is giving output as below:
/etc/hadoop/conf:/usr/lib/hadoop/lib/*:/usr/lib/hadoop/.//*:/usr/lib/hadoop-hdfs/./:/usr/lib/hadoop-hdfs/lib/*:/usr/lib/hadoop-hdfs/.//*:/usr/lib/hadoop-yarn/.//*:/usr/lib/hadoop-0.20-mapreduce/./:/usr/lib/hadoop-0.20-mapreduce/lib/*:/usr/lib/hadoop-0.20-mapreduce/.//*
Anyone has any idea about this?
Navigate to the path where hadoop is installed. locate ${HADOOP_HOME}/etc/hadoop, e.g.
/usr/lib/hadoop-2.2.0/etc/hadoop
When you type the ls for this folder you should see all these files.
capacity-scheduler.xml httpfs-site.xml
configuration.xsl log4j.properties
container-executor.cfg mapred-env.cmd
core-site.xml mapred-env.sh
core-site.xml~ mapred-queues.xml.template
hadoop-env.cmd mapred-site.xml
hadoop-env.sh mapred-site.xml~
hadoop-env.sh~ mapred-site.xml.template
hadoop-metrics2.properties slaves
hadoop-metrics.properties ssl-client.xml.example
hadoop-policy.xml ssl-server.xml.example
hdfs-site.xml yarn-env.cmd
hdfs-site.xml~ yarn-env.sh
httpfs-env.sh yarn-site.xml
httpfs-log4j.properties yarn-site.xml~
httpfs-signature.secret
Core configuration settings are available in hadoop-env.sh.
You can see classpath settings in this file and I copied some sample here for your reference.
# The java implementation to use.
export JAVA_HOME=/usr/lib/jvm/jdk1.7.0_67
# The jsvc implementation to use. Jsvc is required to run secure datanodes.
#export JSVC_HOME=${JSVC_HOME}
export HADOOP_CONF_DIR=${HADOOP_CONF_DIR}
# Extra Java CLASSPATH elements. Automatically insert capacity-scheduler.
for f in $HADOOP_HOME/contrib/capacity-scheduler/*.jar; do
export HADOOP_CLASSPATH=${HADOOP_CLASSPATH+$HADOOP_CLASSPATH:}$f
done
Hope this helps!
hadoop-core jar file is in ${HADOOP_HOME}/share/hadoop/common directory, not in ${HADOOP_HOME} directory.
You can set the environment variable in your .bashrc file.
vim ~/.bashrc
Then add the following line to the end of .bashrc file.
export HADOOP_HOME=/your/hadoop/installation/directory
Just replace the path with your hadoop installation path.
I'm trying to convert JSCover to cobertura xml.
Based on what i've read the command is as follows:
java -cp JSCover-all.jar jscover.report.Main --format=COBERTURAXML REPORT-DIR SRC-DIRECTORY
But I get an error
"Error: Could not find or load main class jscover.report.Main"
Even if I set the fully qualified path of there the JSCover-all.jar is located.
So I tried including the JSCover-al.jar into the classpath and run the following command instead:
java -cp jscover.report.Main --format=COBERTURAXML target/local-storage-proxy target/local-storage-proxy/original-src
I no longer get the first error but i'm now getting the following error:
Unrecognized option: --format=COBERTURAXML
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.
I hope someone could help me with it. Many thanks!
The first attempt is the correct approach. The error means that JSCover-all.jar is not in the same directory that you are executing the command from. An absolute path to is not needed - a relative one will do.
In the second approach, you have passed 'jscover.report.Main' as the class-path to the JVM and '--format=COBERTURAXML' as parameter to the 'java' command.
I have a JRuby project that requires a Java jar. The Java jar is instrumented for logging using log4j. I don't need to use log4j in my JRuby code, but I want to run the JRuby code so that when the instrumented Java classes are called they respect the log4j settings I've specified.
I'm using Trinidad and had hoped that just passing in the 'normal' log4j JVM arguments would do the trick. Here's the process information when I just run Trinidad:
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -Xmx500m -Xss2048k -Djffi.boot.library.path=/Users/eebbesen/.rvm/rubies/jruby-1.7.5/lib/jni -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Xbootclasspath/a:/Users/eebbesen/.rvm/rubies/jruby-1.7.5/lib/jruby.jar -classpath : -Djruby.home=/Users/eebbesen/.rvm/rubies/jruby-1.7.5 -Djruby.lib=/Users/eebbesen/.rvm/rubies/jruby-1.7.5/lib -Djruby.script=jruby -Djruby.shell=/bin/sh org.jruby.Main script/trinidad
and here's what I tried to get log4j working:
/Library/Java/JavaVirtualMachines/jdk1.8.0.jdk/Contents/Home/bin/java -Xmx500m -Xss2048k -Djffi.boot.library.path=/Users/eebbesen/.rvm/rubies/jruby-1.7.5/lib/jni -Dfile.encoding=UTF-8 -Djava.net.preferIPv4Stack=true -Xbootclasspath/a:/Users/eebbesen/.rvm/rubies/jruby-1.7.5/lib/jruby.jar -classpath : -Djruby.home=/Users/eebbesen/.rvm/rubies/jruby-1.7.5 -Djruby.lib=/Users/eebbesen/.rvm/rubies/jruby-1.7.5/lib -Djruby.script=jruby -Dlog4j.debug=true -Dlog4j.configuration=file:log4j.properties -Djruby.shell=/bin/sh org.jruby.Main script/trinidad
so I'm just adding
-Dlog4j.debug=true -Dlog4j.configuration=file:log4j.properties
to what Trinidad is already doing.
What I'm not seeing is any of the log4j logging happening when I run Trinidad. However, when I use Rails console my logging statements are appearing.
The posts I've seen cover how to use log4j from within JRuby, but I would like to accomplish this via JVM arguments if possible.
I got this to work by setting JVM options JRuby-style:
export JRUBY_OPTS="-J-Dlog4j.debug=true -J-Dlog4j.configuration=file:/absolute/path/to/log4j.properties"
trinidad
This overwrote log4j.properties specified in my Java jar and I was able to manipulate log levels of Java classes in (and called by classes explicitly in) the jar file.