• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Cannot find jni_md.h in /usr/bin/java/ when installing APR Native Library in Tomcat 6

 
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi folk,

Anyone ran into

when running trying to install APR native Library in tomcat?

I followed this instruction when attempting the installation. Its from Professional Apache Tomcat by Vivek Chopra, Sing Li.


For Linux/Unix, you need to install this from source.
❑ If you don’t have APR installed on your machine, download the source from http://apr
.apache.org . Install APR using the following steps as the root user to install the APR in its
default location ( /usr/local/apr ). If running as a non-root user, use the --prefix option
with configure to specify another install location.
$ tar zxvf apr-x.y.z.tar.gz
$ cd apr-x.y.z
$ ./buildconf
$ ./configure
$ make install



The APR JNI wrapper sources are packaged, along with the Tomcat distribution, as the tomcat- native
.tar.gz file in <TOMCAT_HOME>/bin . The installation steps are provided in the code that follows. In
the steps shown, the default apr_install_location is /usr/local/apr as shown in the earlier
step. If you don’t need OpenSSL support, you can use the --without-ssl option with configure to
disable it. If you need OpenSSL, you can download it from www.openssl.org . The JNI wrapper gets
installed under /usr/local/apr/lib , and as before, a --prefix option for configure can install it
elsewhere.
$ cd /path/to/tomcat/bin
$ tar zxvf tomcat-native.tar.gz
$ cd tomcat-native-x.y.z-src/jni/native
The APR JNI wrapper sources are packaged, along with the Tomcat distribution, as the tomcat- native
.tar.gz file in <TOMCAT_HOME>/bin . The installation steps are provided in the code that follows. In
the steps shown, the default apr_install_location is /usr/local/apr as shown in the earlier
step. If you don’t need OpenSSL support, you can use the --without-ssl option with configure to
disable it. If you need OpenSSL, you can download it from www.openssl.org . The JNI wrapper gets
installed under /usr/local/apr/lib , and as before, a --prefix option for configure can install it
elsewhere.
$ cd /path/to/tomcat/bin
$ tar zxvf tomcat-native.tar.gz
$ cd tomcat-native-x.y.z-src/jni/native
$ ./configure --with-apr=apr_install_location --with-ssl=openssl_install_location
$ make install




The line highlighted bold threw this error. I tried googling the problem, but there is hardly anything online with jni_md.h let alone to do with Tomcat's APR installation.

Would be appreciate if anyone can shed some light on this. Many thank.



OS: Fedora 16
JDK: 1.6
JAVA_HOME set to /usr/lib/java
Tomcat Version: 6
 
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If fedora package manager already provides prebuilt APR and tcnative binaries, just have to install them - no need to build from source.
If it doesn't provide or provides an incompatible version, then try these steps:

1. First, check whether the JVM includes (jni.h, jni_md.h, etc) are installed.
With some OSes and package managers, it's not necessary that installing just the JDK will also install the include files.

For example, in CentOS (which is a kind of step sibling of Fedora), installing just the OpenJDK 1.6 does not install the includes; the associated "devel" package (named something like java-1.6.0-openjdk-devel.x86_64) should also be installed.

Start by checking in /usr/lib/java (which is hopefully the right JDK directory) whether there's an /include subdirectory under it.
Also, it's possible /usr/lib/java is not the right JDK directory in the first place; so also look for directories like /usr/lib/jvm and /include subdirectories under those.

If they're not present, do a "find / -name jni" just to be sure.
If it doesn't give any matches, then you're just missing the "devel" package. Find the right package name (using "yum list | grep" or "yum search") and install that.

2. Even if the includes have been installed, it's important to give the right hints about your particular installation to "configure" so that it can prepare the makefile correctly.
So, provide the following additional hints to configure:


 
Ulrich Von Litchtenstein
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks.

Yes there is a jvm directory in /usr/lib which has

$less /usr/bin

drwxr-xr-x 2 root root 4096 Sep 15 23:28 java/
drwxr-xr-x 2 root root 4096 Sep 15 23:28 java-1.5.0/
drwxr-xr-x 2 root root 4096 Sep 15 23:28 java-1.6.0/
drwxr-xr-x 2 root root 4096 Sep 15 23:28 java-1.7.0/
drwxr-xr-x 2 root root 4096 Sep 15 23:28 java-ext/
drwxr-xr-x 4 root root 4096 Jan 26 23:43 jvm/
drwxr-xr-x 2 root root 4096 Sep 15 23:28 jvm-commmon/

Inside jvm directory I got:

drwxr-xr-x 3 root root 4096 Jan 26 23:43 java-1.5.0-gcj-1.5.0.0/
drwxr-xr-x 3 root root 4096 Jan 26 23:43 java-1.6.0-openjdk-1.6.0.0/
lrwxrwxrwx 1 root root 21 Jan 26 23:43 jre -> /etc/alternatives/jre/
lrwxrwxrwx 1 root root 27 Jan 26 23:43 jre-1.5.0 -> /etc/alternatives/jre_1.5.0/
lrwxrwxrwx 1 root root 26 Jan 26 23:43 jre-1.5.0-gcj -> java-1.5.0-gcj-1.5.0.0/jre/
lrwxrwxrwx 1 root root 27 Jan 26 23:43 jre-1.6.0 -> /etc/alternatives/jre_1.6.0/
lrwxrwxrwx 1 root root 30 Jan 26 23:43 jre-1.6.0-openjdk -> java-1.6.0-openjdk-1.6.0.0/jre/
lrwxrwxrwx 1 root root 25 Jan 26 23:43 jre-gcj -> /etc/alternatives/jre_gcj/
lrwxrwxrwx 1 root root 29 Jan 26 23:43 jre-openjdk -> /etc/alternatives/jre_openjdk/


When I did java -version i get 1.6 so those 1.5s are obsolete. But I got Java directories with java executable everywhere so not sure which one is called when I run

$java

And the jni doesn't exist. Only jni I have is the directory in tomcat native library.

 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
$java will execute the first "java" found in $PATH (usually in /usr/bin). java -version will also give the vendor name. Anyway, configure does not really require java executable; it's more interested in where to find JDK home and /include under that. My guess, just based on my installation, would be that the active JDK here is /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/

It seems the openJDK "devel" package is missing. Find the openjdk devel package using yum and install it. I'm not sure what its exact name is in fedora, but it's possible to find out using something like "yum list | grep jdk | grep devel".

 
Ulrich Von Litchtenstein
Greenhorn
Posts: 8
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Karthik Shiraly wrote:$java will execute the first "java" found in $PATH (usually in /usr/bin). java -version will also give the vendor name. Anyway, configure does not really require java executable; it's more interested in where to find JDK home and /include under that. My guess, just based on my installation, would be that the active JDK here is /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/

It seems the openJDK "devel" package is missing. Find the openjdk devel package using yum and install it. I'm not sure what its exact name is in fedora, but it's possible to find out using something like "yum list | grep jdk | grep devel".



Thank Karthikh. I have changed the JDK home to /usr/lib/jvm/java-1.6.0-openjdk-1.6.0.0/ and installed the "devel".

jni_md.h error went away. But APR wasn't stalled as per catalina log. But thanks for your help and suggestions.
 
Karthik Shiraly
Bartender
Posts: 1210
25
Android Python PHP C++ Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm not sure what the issue is, but looking through that article from the book, it seems odd to me that a 'make' has not been done before 'make install'. That's the usual sequence - I'm not sure why it's not been included there. Retry the steps, but this time do a 'make' (plain make without any arguments) and only after that do a 'make install'.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic