Please, don't top-post. It makes a total mess of the thread.
I've moved your reply to the bottom.
Sorry about that. I hope this one does'nt show up like that.
Impossible to say. There are configuration errors which could easily make it
work with one version and not with another. The libraries used by the JVM are
not linked in such a way that they can be found at runtime without additional
help. The JVM normally knows where the libraries are located, but if something
has got messed up with the libraries or the installation directories they won't
be found.
I tried adding the library path explicity in catalina.sh in the
CATALINA_OPTS using -Djava.library.path. Also, I moved all the shared
libraries to $jre-home/lib/ext/. But, none of these seems to have an
effect :-(
Just to be sure that there has been no mix and match of the libraries,
I downloaded and used the the latest Jre that I could find from Sun's
site, ie,
/usr/java/j2re1.4.2_12/bin/java -version
java version "1.4.2_12"
Java(TM) 2 Runtime Environment, Standard Edition (build 1.4.2_12-b03)
Java HotSpot(TM) Client VM (build 1.4.2_12-b03, mixed mode)
and I problem still persits... :-(
OS: 2.6.9-22.EL #1 Mon Sep 19 17:49:49 EDT 2005 x86_64 x86_64 x86_64
GNU/Linux
However, there is one thing which I have just remembered. I use the 32bit 1.4
SDK rather than the 64bit one. This might have some bearing on the issue. Which
version do you run?
readelf -h /usr/java/j2re1.4.2_12/bin/java
ELF Header:
Magic: 7f 45 4c 46 01 01 01 00 00 00 00 00 00 00 00 00
Class: ELF32
Data: 2's complement, little endian
Version: 1 (current)
OS/ABI: UNIX - System V
ABI Version: 0
Type: EXEC (Executable file)
Machine: Intel 80386
Version: 0x1
Entry point address: 0x8049180
Start of program headers: 52 (bytes into file)
Start of section headers: 50152 (bytes into file)
Flags: 0x0
Size of this header: 52 (bytes)
Size of program headers: 32 (bytes)
Number of program headers: 6
Size of section headers: 40 (bytes)
Number of section headers: 26
Section header string table index: 25
Its 32-bit version. So, still no luck.
Following is the sample program I was using to test
1) Application: SockTest.java
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.Iterator;
import java.util.List;
import java.util.logging.Level;
import java.nio.channels.SocketChannel;
class SockTest {
public static void main(String[] args) {
System.out.println("shr> BEGIN sock test...");
try {
SocketChannel.open().close();
System.out.println("shr> SUCCESS!!");
} catch (Exception e) {
System.out.println("shr> FAILED :-(");
e.printStackTrace();
}
System.out.println("shr> END sock test...");
}
}
2) Servlet version of the same: SockServletTest.java
import java.io.*;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.net.InetAddress;
import java.nio.channels.SocketChannel;
public class SockServletTest extends HttpServlet
{
protected void service(HttpServletRequest request,
HttpServletResponse response)
throws ServletException, IOException
{
System.out.println("shr> BEGIN sock test...");
try {
SocketChannel.open().close();
System.out.println("shr> SUCCESS!!");
} catch (Exception e) {
System.out.println("shr> FAILED :-(");
e.printStackTrace();
}
System.out.println("shr> END sock test...");
}
}
One interesting observation is that when I first invoke the above
servlet, I get the following UnsatisfiedLink error. But, after
subsequent calls, I get NoClassDefFound exception.
Exception during first time call:
2006-09-25 13:34:22 StandardWrapperValve[sockTest]: Servlet.service()
for servlet sockTest threw exception
java.lang.UnsatisfiedLinkError:
/opt/OV/nonOV/jre/1.4/lib/i386/libnio.so: libnet.so: cannot open shared
object file: No such file or directory
at java.lang.ClassLoader$NativeLibrary.load(Native Method)
at java.lang.ClassLoader.loadLibrary0(Unknown Source)
at java.lang.ClassLoader.loadLibrary(Unknown Source)
at java.lang.Runtime.loadLibrary0(Unknown Source)
at java.lang.System.loadLibrary(Unknown Source)
at sun.security.action.LoadLibraryAction.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at sun.nio.ch.Util.load(Unknown Source)
at sun.nio.ch.SocketChannelImpl.<clinit>(Unknown Source)
at sun.nio.ch.SelectorProviderImpl.openSocketChannel(Unknown
Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
at SockServletTest.service(SockServletTest.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
Exception during subsequent calls:
2006-09-25 13:35:28 StandardWrapperValve[sockTest]: Servlet.service()
for servlet sockTest threw exception
java.lang.NoClassDefFoundError
at sun.nio.ch.SelectorProviderImpl.openSocketChannel(Unknown
Source)
at java.nio.channels.SocketChannel.open(Unknown Source)
at SockServletTest.service(SockServletTest.java:18)
at javax.servlet.http.HttpServlet.service(HttpServlet.java:802)
at
org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:237)
at
org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:157)
at
org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:214)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardContextValve.invokeInternal(StandardContextValve.java:198)
at
org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:152)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:462)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:137)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:118)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:102)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
at
org.apache.catalina.core.StandardValveContext.invokeNext(StandardValveContext.java:104)
at
org.apache.catalina.core.StandardPipeline.invoke(StandardPipeline.java:520)
at
org.apache.catalina.core.ContainerBase.invoke(ContainerBase.java:929)
at
org.apache.coyote.tomcat5.CoyoteAdapter.service(CoyoteAdapter.java:160)
at
org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:799)
at
org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.processConnection(Http11Protocol.java:705)
at
org.apache.tomcat.util.net.TcpWorkerThread.runIt(PoolTcpEndpoint.java:577)
at
org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:683)
at java.lang.Thread.run(Unknown Source)
Any leads would be really helpful.
Thanks,
Suresh R