openjdk-1.7.0_55 on ubuntu: Could not load the property file 'output_xml.properties' for output method 'xml' - classpath

On openjdk-1.7.0_55 on ubuntu I am getting exception:
com.sun.org.apache.xml.internal.serializer.utils.WrappedRuntimeException: Could not load the property file 'output_xml.properties' for output method 'xml'
Can this be classpath issue?
I can find "output_xml.properties" in /usr/lib/jvm/java-1.7.0-openjdk-amd64/jre/lib/resources.jar.
Any help is appreciated.
Thanks!

The issue might have been caused by a recent Java update and incomplete services restart per this page.

you need to include the xalan JARs in the ../jre/lib/endorsed folder
from http://xml.apache.org/xalan-j/faq.html#jdk14:
Place the xalan.jar, serializer.jar, xercesImpl.jar and xml-apis.jar
in the \lib\endorsed directory, where is where
the runtime software is installed.

Try ensuring that your system is consistently using the same Java version - sometimes these get out of sync.
First do echo $JAVA_HOME and verify that it points to /usr/lib/jvm/java-1.7.0-openjdk-amd64/.
Now run sudo update-alternatives --config java and select the correct number for /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java
Now do the same for javac: sudo update-alternatives --config javac.

If you're using SYS V init scripts and running in a container such a Tomcat, DON'T start the script directly with:
sudo /etc/init.d/tomcat7 start
That will start it without a clean environment.
Instead, use the service command:
sudo /sbin/service tomcat7 start

Related

I am trying to set up Kafka in my local mac

I have unzipped the kafka_2.12-2.5.0 version and started zookeeper and when I am trying to start kafka using the command
"bin/zookeeper-server-start.sh config/zookeeper.properties" i am getting the following eror:
/Users/manig/Desktop/kafka_2.12-2.5.0/bin/kafka-run-class.sh: line 317: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home#/bin/java: No such file or directory
/Users/manig/Desktop/kafka_2.12-2.5.0/bin/kafka-run-class.sh: line 317: exec: /Library/Java/JavaVirtualMachines/jdk1.8.0_191.jdk/Contents/Home#/bin/java: cannot execute: No such file or directory.
I tried adding double quotes around the JAVA term like this: "$JAVA" and also changing the classpath to cygpath -wp $CLASSPATH but still getting the same above error
can someone please help me with this..!
Try to set your Java ClassPath properly using the below commands. It was not able to recognize you JDK.
export JAVA_HOME="$(/usr/libexec/java_home)"
or
export JAVA_HOME=`/usr/libexec/java_home`
cygpath is for Cygwin, not Mac.
If you want to install on a Mac, just use brew install kafka
Or use Docker

Installation of protoc-gen-grpc-web

I am currently working on using grpc-web to write a simple client for my service. I have created a service.proto file which was successfully compiled using protoc. The problem arose when I tried to generate the gRPC-Web service client stub using the plugin protoc-gen-grpc-web which doesnt work despite having installed the latter.
Got the following error :
protoc -I=./ service.proto --grpc-web_out=import_style=commonjs,mode=grpcwebtext:./
protoc-gen-grpc-web: program not found or is not executable
--grpc-web_out: protoc-gen-grpc-web: Plugin failed with status code 1.
Any suggestions on how to solve this issue? Thank you!
You'll need to make the protoc-gen-grpc-web plugin executable and move it to a directory that is discoverable from your PATH environment variable.
From grpc-web/README:
For example, in MacOS, you can do:
$ sudo mv ~/Downloads/protoc-gen-grpc-web-1.2.1-darwin-x86_64 \
/usr/local/bin/protoc-gen-grpc-web
$ chmod +x /usr/local/bin/protoc-gen-grpc-web
You don't even have to install the plugin globally and make it discoverable from your PATH:
protoc accepts --plugin arguments to point to a required plugin. For protoc-gen-grpc-web (as for many others) there's even npm support, so you can get it with npm i --save-dev protoc-gen-grpc-web and then run protoc with --plugin=protoc-gen-grpc-web=./node_modules/.bin/protoc-gen-grpc-web
I'm using MacOS. You need to install this first with brew
$ brew install protoc-gen-grpc-web
The best solution that I could use for Linux based system was globally installing protoc-gen-grpc-web. This directly takes the files from the /bin of the node_modules files created globally across your system
sudo npm install -g protoc-gen-grpc-web

Error from Zookeper 3.4.6 version

I downloaded zookeeper-3.4.6.tar.gz and while executing zkServer.sh start , I am getting below error.I did google but couldn't find a solution, Please let me kno if you see similar issues.
CLASSPATH=/home/spanda20/zookeeper/bin/../src/java/lib/*.jar:/home/spanda20/zookeeper/bin/../conf:
zkServer.sh: 81: /home/spanda20/zookeeper/bin/zkEnv.sh: Syntax error: "(" unexpected (expecting "fi")
Finally I am able to see storm UI and its running.
Below changes I did in the .bashrc file. Please make sure that You add bin path in the PATH VARIABLE.
I did add the below variables in the .bashrc file.
export JAVA_HOME =JDK Path
export ZOOKEPER_HOME =Zookeper install path
Then add them in the variable path.
PATH= $PATH:$JAVA_HOME/bin:$ZOOKEPER_HOME/bin
Thanks
Sanjeeb
I'm using zookeeper version 3.4.9 on ubuntu 14.04 and installed openjdk 7. I have added below lines to ~/.bashrc
export JAVA_HOME="/usr/lib/jvm/java-7-openjdk-amd64"
export ZOOKEEPER_HOME ="/path/to/zookeeper"
PATH=$PATH:$JAVA_HOME/bin:$ZOOKEEPER_HOME/bin.
First I ran sh /path-to-zookeeper/bin/zkServer.sh start but didn't not work I got the same error.
I ran it with sudo /bin/bash /path-to-zookeeper/bin/zkServer.sh start it worked.
./zkServer.sh start
This should work.
Edit /etc/environment, and paste the following:
JAVA_HOME="/usr/lib/jvm/java-8-openjdk-amd64/jre"
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:$JAVA_HOME/bin"
modify the JAVA_HOME as per your local Java version.

pg_ctl: error while loading shared libraries: libpq.so.5

I'm trying to get postgres server status with:
sudo /etc/init.d/postgres status -u postgres
But getting following error:
/home/alex/olddisk/usr/local/pgsql/bin/pg_ctl: error while loading shared libraries: libpq.so.5: cannot open shared object file: No such file or directory
I added:
export LD_LIBRARY_PATH=""
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib/"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/home/alex/olddisk/usr/local/pgsql/lib/"
to my .bashrc, but it didn't help.
Thank you.
I ran into this error when I built postgresql from source using the --prefix flag. Building from source installs the necessary shared libs to the libs folder under the prefix directory you specified, instead of the usual place installations put shared libs. To solve the problem I just added the [prefix].libs folder to the LD_LIBRARY_PATH environment variable. For example, after building postgres using --prefix /mike/sandbox/postgres, the below command solved the issue:
export LD_LIBRARY_PATH=/mike/sandbox/postgres/lib:$LD_LIBRARY_PATH
I think this issue is duplicated, I faced the same problem and posted a solution here.
try this:
1: Know the path of "libpq.so.5"
find / -name libpq.so.5
Output example: "/usr/pgsql-9.4/lib/libpq.so.5" If found nothing, check if you have already installed the suitable postgresql-libs for your postgresql version and your OS platform
2: Symbolic link that library in a "well known" library path like "/usr/lib":
ln -s /usr/pgsql-9.4/lib/libpq.so.5 /usr/lib/libpq.so.5
Attention: If your platform is 64 bit, you MUST also symbolic link to 64 bit libraries path:
ln -s /usr/pgsql-9.4/lib/libpq.so.5 /usr/lib64/libpq.so.5
3: Be happy !
Please ensure you have 'postgresql94' package installed as well (in addition to postgresql94-server, postgresql94-lib, postgresql94-devel and whatever other PG related package you already have). These libraries get installed along with that package.
Some ideas:
Your modified ~/.bashrc only takes effect when you start a new (interactive) shell. Though catching up on that will not help you because:
/etc/sudoers, your configuration file of sudo, probably specifies env_reset. This means, that /etc/init.d/postgres will not see the content of $LD_LIBRARY_PATH of your shell.
Insert debug statements in /etc/init.d/postgres to verify what I told you: echo "LDPATH: $LD_LIBRARY_PATH" >&2
Check /etc/init.d/postgres. Probably you will have to insert the third one of your export statements near the start of this script. Or you will have to update an existing export LD_LIBRARY_PATH= statement.
Have you installed the necessary libraries?
If you are using ubuntu try:
sudo apt-get install libpq libpq-dev

What does "The APR based Apache Tomcat Native library was not found" mean?

I am using Tomcat 7 in Eclipse on Windows. When starting Tomcat, I am getting the following info message:
The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path
What does this mean and how can I provide the APR library?
It means exactly what it says: "The APR based Apache Tomcat Native library which allows optimal performance in production environments was not found on the java.library.path"
The library referred to is bundled into an OS specific dll (tcnative-1.dll) loaded via JNI. It allows tomcat to use OS functionalities not provided in the Java Runtime (such as sendfile, epoll, OpenSSL, system status, etc.). Tomcat will run just fine without it, but for some use cases, it will be faster with the native libraries.
If you really want it, download the tcnative-1.dll (or libtcnative.so for Linux) and put it in the bin folder, and add a system property to the launch configuration of the tomcat server in eclipse.
-Djava.library.path=c:\dev\tomcat\bin
Unless you're running a production server, don't worry about this message. This is a library which is used to improve performance (on production systems). From Apache Portable Runtime (APR) based Native library for Tomcat:
Tomcat can use the Apache Portable Runtime to provide superior
scalability, performance, and better integration with native server
technologies. The Apache Portable Runtime is a highly portable library
that is at the heart of Apache HTTP Server 2.x. APR has many uses,
including access to advanced IO functionality (such as sendfile, epoll
and OpenSSL), OS level functionality (random number generation, system
status, etc), and native process handling (shared memory, NT pipes and
Unix sockets).
On RHEL Linux just issue:
yum install tomcat-native.x86_64
/Note:depending on Your architecture 64bit or 32bit package may have different extension/
That is all. After that You will find in the log file next informational message:
INFO: APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true].
All operations will be noticeably faster than before.
Installation the native library on Ubuntu server with:
sudo apt-get install libtcnative-1
If that does not work tomcat-native needs to be installed
Install Oracle java7:
sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update
sudo apt-get install oracle-java7-installer
sudo apt-get install oracle-java7-set-default
Install tomcat apr:
wget http://apache.mirror.anlx.net//apr/apr-1.5.0.tar.gz
tar zxvf apr-1.5.0.tar.gz
rm apr-1.5.0.tar.gz
cd apr-1.5.0
sudo ./configure
sudo make
sudo make install
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
Install tomcat tomcat-native:
wget http://mirrors.ukfast.co.uk/sites/ftp.apache.org//tomcat/tomcat-connectors/native/1.1.29/source/tomcat-native-1.1.29-src.tar.gz
tar zxvf tomcat-native-1.1.29-src.tar.gz
rm tomcat-native-1.1.29-src.tar.gz
cd tomcat-native-1.1.29-src/jni/native
JAVA_HOME=/usr/lib/jvm/java-7-oracle
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install
I just went through this and configured it with the following:
Ubuntu 16.04
Tomcat 8.5.9
Apache2.4.25
APR 1.5.2
Tomcat-native 1.2.10
Java 8
These are the steps i used based on the older posts here:
Install package
sudo apt-get update
sudo apt-get install libtcnative-1
Verify these packages are installed
sudo apt-get install make
sudo apt-get install gcc
sudo apt-get install openssl
Install package
sudo apt-get install libssl-dev
Install and compile Apache APR
cd /opt/tomcat/bin
sudo wget http://apache.mirror.anlx.net//apr/apr-1.5.2.tar.gz
sudo tar -xzvf apr-1.5.2.tar.gz
cd apr-1.5.2
sudo ./configure
sudo make
sudo make install
verify installation
cd /usr/local/apr/lib/
ls
you should see the compiled file as
libapr-1.la
Download and install Tomcat Native source package
cd /opt/tomcat/bin
sudo wget https://archive.apache.org/dist/tomcat/tomcat-connectors/native/1.2.10/source/tomcat-native-1.2.10-src.tar.gz
sudo tar -xzvf tomcat-native-1.2.10-src.tar.gz
cd tomcat-native-1.2.10-src/native
verify JAVA_HOME
sudo pico ~/.bashrc
export JAVA_HOME=/usr/lib/jvm/java-8-openjdk-amd64
source ~/.bashrc
sudo ./configure --with-apr=/usr/local/apr --with-java-home=$JAVA_HOME
sudo make
sudo make install
Edit the /opt/tomcat/bin/setenv.sh file with following line:
sudo pico /opt/tomcat/bin/setenv.sh
export LD_LIBRARY_PATH='$LD_LIBRARY_PATH:/usr/local/apr/lib'
restart tomcat
sudo service tomcat restart
On Mac OS X:
$ brew install tomcat-native
==> tomcat-native
In order for tomcat's APR lifecycle listener to find this library, you'll
need to add it to java.library.path. This can be done by adding this line
to $CATALINA_HOME/bin/setenv.sh
CATALINA_OPTS="$CATALINA_OPTS -Djava.library.path=/usr/local/opt/tomcat-native/lib"
If $CATALINA_HOME/bin/setenv.sh doesn't exist, create it and make it executable.
Then add it to the eclipse's tomcat arguments (double-click Server > Open Launch Configuration > Arguments tab > VM arguments)
-Djava.library.path=/usr/local/opt/tomcat-native/lib
on debian 8 I fix it with installing libapr1-dev:
apt-get install libtcnative-1 libapr1-dev
Had this problem as well. If you do have the libraries, but still have this error, it may be a configuration error. Your server.xml may be missing the following line:
<Listener className="org.apache.catalina.core.AprLifecycleListener" SSLEngine="on" />
(Alternatively, it may be commented out). This <Listener>, like other listeners is a child of the top-level <Server>.
Without the <Listener> line, there's no attempt to load the APR library, so LD_LIBRARY_PATH and -Djava.library.path= settings are ignored.
I had this issue upgrading from Java 8 to 11. After adding this dependency, my app launched without issue:
<dependency>
<groupId>org.javassist</groupId>
<artifactId>javassist</artifactId>
<version>3.25.0-GA</version>
</dependency>
I had the same problem when tomсat could not find the class. Try to view other log files. Sometimes No class def found error appears in different log files:
tomcat8-stdout
tomcat8-stderr
localhost
If you don't have Tomcat Native library install it with:
sudo apt-get install libtcnative-1
and if it's still there an old version upgrade it with:
sudo apt-get upgrade libtcnative-1
My problem was in add some library from tomcat to eclipse class path i just going to
eclipse click right to project and going to debug configuration -> classpath -> Add External JARs add all jars files from apache-tomcat-7.0.35\bin this was my problem and it's worked for me .
For future readers:
I had faced this issue myself when trying to run a Spring Boot application in Spring STS. This issue didn't resurface initially. I was able to work on my project without any issues for quite some time until one fine day I started getting this particular error.
From what I am able to recall I had not made any configuration changes to my project and neither changed the Java/Tomcat version being used.
None of the discussions/suggestions regarding installing the tomcat native library made any sense to me since the project was already working fine before.
SOLUTION that worked for me:
So lastly I though of trying to delete and reimport my project.
I deleted my project from Spring STS, restarted the Spring STS and then reimported the project. It worked like a charm and never faced the issue ever since.
You may also try deleting any IDE generated files/folders(if there are any) in your project, before restarting the IDE and reimporting the project.
I still happen to work on this project from time to time and haven't faced the issue as of now. My current development IDE is IntelliJ.
I'm not sure if the error was IDE specific.