You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Ian Warner <iw...@openfox.com> on 2003/05/15 21:11:41 UTC

java.lang.UnsatisfiedLinkError: no c in java.library.path

Hi group:

Any help with the follwoing error would be greatly appreciated

2003-05-15 12:50:15 StandardContext[/hello-jaxrpc]: Exception sending context initialized event to listener instance of class com.sun.xml.rpc.server.http.JAXRPCContextListener
java.lang.UnsatisfiedLinkError: no testc in java.library.path

starting the application but can't find "testc.dll" is the problem but where should i put it under the tomcat directory structure? i have run out of places to try - i've tried WEB-INF, WEB-INF/classes, shared/classes and even tried puttin it jar format under WEB-INF/lib and shared/lib but to no avail. Here's the xml that starts the app if it helps, it is called hello-jaxrpc and resides in webapps (there's no entry in the server.xml)

<Context path="/hello-jaxrpc" docBase="../webapps/hello-jaxrpc" debug="3" privileged="true">

  <Logger className="org.apache.catalina.logger.FileLogger"
          prefix="hello-jaxrpc_log." suffix=".txt" timestamp="true"/>

</Context>

Here's what i'm trying to do. I have a client that is sending a msg to a simpe tomcat server app called hello.
 
package hello;
public class HelloImpl implements HelloIF {

 public String message = "Hello ";

    public String sayHello(String s) {
    return message + si;
    }
}
The above server code works fine, the client sends a string, this server sends back hello + string to the client, so far so good.

Now the trouble comes -  i'm trying to call a "c" class in testc.dll from the above java class (modified below) but get "java.lang.UnsatisfiedLinkError: no testc in java.library.path" in the hello-jaxrpc_log i set up for the application. How do I set the java.library.path ? Or what's the default path? I thought is was webapps/WEB-INF/classes

Here the modifed code

package hello;
public class HelloImpl implements HelloIF {

 public String message = "Hello ";
 public int i=0;

    public String sayHello(String s) {
    i = new HelloImpl().gemsg(); // added call to native code
    return message + s + i;
    }
    public native int getmsg(); // getmsg() is a c routine compiled into testc.dll, all it does is return an integer.

    static {
        System.loadLibrary("testc"); // this fails when the application is being loaded by tomcat, i never even get to run the client
    }
  }



Re: java.lang.UnsatisfiedLinkError: no c in java.library.path

Posted by Ian Warner <iw...@openfox.com>.
Thanks guys, that worked.

I was only trying standard Tomcat class loader directories as I had had put
the dll in the same directory as the class that loaded it. I assumed that if
tomcat could run the class then surely the dll could be found in the same
directory. Not so, anyway adding the directory to the windows path did the
trick. Thanks again

----- Original Message -----
From: "Bill Barker" <wb...@wilshire.com>
To: <to...@jakarta.apache.org>
Sent: Thursday, May 15, 2003 10:28 PM
Subject: Re: java.lang.UnsatisfiedLinkError: no c in java.library.path


> It looks like you are running on some version of Windows, so I'll answer
for
> that.  The answer for *nix systems is slightly different.
>
> The "testc.dll" file can be anyplace that you want, as long as the
directory
> is included in the PATH environment variable when the JVM is started.  As
> someone else mentioned, dropping it into c:\windows\system32 is almost
> guaranteed to work (as distasteful as it is :).  You could also launch
> Tomcat with an explicit:
>    -Djava.library.path="%PATH%;c:\path\to\testc.dll"
>
> "Ian Warner" <iw...@openfox.com> wrote in message
> news:00e601c31b15$d18b8230$5301010a@IANPC...
> Hi group:
>
> Any help with the follwoing error would be greatly appreciated
>
> 2003-05-15 12:50:15 StandardContext[/hello-jaxrpc]: Exception sending
> context initialized event to listener instance of class
> com.sun.xml.rpc.server.http.JAXRPCContextListener
> java.lang.UnsatisfiedLinkError: no testc in java.library.path
>
> starting the application but can't find "testc.dll" is the problem but
where
> should i put it under the tomcat directory structure? i have run out of
> places to try - i've tried WEB-INF, WEB-INF/classes, shared/classes and
even
> tried puttin it jar format under WEB-INF/lib and shared/lib but to no
avail.
> Here's the xml that starts the app if it helps, it is called hello-jaxrpc
> and resides in webapps (there's no entry in the server.xml)
>
> <Context path="/hello-jaxrpc" docBase="../webapps/hello-jaxrpc" debug="3"
> privileged="true">
>
>   <Logger className="org.apache.catalina.logger.FileLogger"
>           prefix="hello-jaxrpc_log." suffix=".txt" timestamp="true"/>
>
> </Context>
>
> Here's what i'm trying to do. I have a client that is sending a msg to a
> simpe tomcat server app called hello.
>
> package hello;
> public class HelloImpl implements HelloIF {
>
>  public String message = "Hello ";
>
>     public String sayHello(String s) {
>     return message + si;
>     }
> }
> The above server code works fine, the client sends a string, this server
> sends back hello + string to the client, so far so good.
>
> Now the trouble comes -  i'm trying to call a "c" class in testc.dll from
> the above java class (modified below) but get
> "java.lang.UnsatisfiedLinkError: no testc in java.library.path" in the
> hello-jaxrpc_log i set up for the application. How do I set the
> java.library.path ? Or what's the default path? I thought is was
> webapps/WEB-INF/classes
>
> Here the modifed code
>
> package hello;
> public class HelloImpl implements HelloIF {
>
>  public String message = "Hello ";
>  public int i=0;
>
>     public String sayHello(String s) {
>     i = new HelloImpl().gemsg(); // added call to native code
>     return message + s + i;
>     }
>     public native int getmsg(); // getmsg() is a c routine compiled into
> testc.dll, all it does is return an integer.
>
>     static {
>         System.loadLibrary("testc"); // this fails when the application is
> being loaded by tomcat, i never even get to run the client
>     }
>   }
>
>
>
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: java.lang.UnsatisfiedLinkError: no c in java.library.path

Posted by Bill Barker <wb...@wilshire.com>.
It looks like you are running on some version of Windows, so I'll answer for
that.  The answer for *nix systems is slightly different.

The "testc.dll" file can be anyplace that you want, as long as the directory
is included in the PATH environment variable when the JVM is started.  As
someone else mentioned, dropping it into c:\windows\system32 is almost
guaranteed to work (as distasteful as it is :).  You could also launch
Tomcat with an explicit:
   -Djava.library.path="%PATH%;c:\path\to\testc.dll"

"Ian Warner" <iw...@openfox.com> wrote in message
news:00e601c31b15$d18b8230$5301010a@IANPC...
Hi group:

Any help with the follwoing error would be greatly appreciated

2003-05-15 12:50:15 StandardContext[/hello-jaxrpc]: Exception sending
context initialized event to listener instance of class
com.sun.xml.rpc.server.http.JAXRPCContextListener
java.lang.UnsatisfiedLinkError: no testc in java.library.path

starting the application but can't find "testc.dll" is the problem but where
should i put it under the tomcat directory structure? i have run out of
places to try - i've tried WEB-INF, WEB-INF/classes, shared/classes and even
tried puttin it jar format under WEB-INF/lib and shared/lib but to no avail.
Here's the xml that starts the app if it helps, it is called hello-jaxrpc
and resides in webapps (there's no entry in the server.xml)

<Context path="/hello-jaxrpc" docBase="../webapps/hello-jaxrpc" debug="3"
privileged="true">

  <Logger className="org.apache.catalina.logger.FileLogger"
          prefix="hello-jaxrpc_log." suffix=".txt" timestamp="true"/>

</Context>

Here's what i'm trying to do. I have a client that is sending a msg to a
simpe tomcat server app called hello.

package hello;
public class HelloImpl implements HelloIF {

 public String message = "Hello ";

    public String sayHello(String s) {
    return message + si;
    }
}
The above server code works fine, the client sends a string, this server
sends back hello + string to the client, so far so good.

Now the trouble comes -  i'm trying to call a "c" class in testc.dll from
the above java class (modified below) but get
"java.lang.UnsatisfiedLinkError: no testc in java.library.path" in the
hello-jaxrpc_log i set up for the application. How do I set the
java.library.path ? Or what's the default path? I thought is was
webapps/WEB-INF/classes

Here the modifed code

package hello;
public class HelloImpl implements HelloIF {

 public String message = "Hello ";
 public int i=0;

    public String sayHello(String s) {
    i = new HelloImpl().gemsg(); // added call to native code
    return message + s + i;
    }
    public native int getmsg(); // getmsg() is a c routine compiled into
testc.dll, all it does is return an integer.

    static {
        System.loadLibrary("testc"); // this fails when the application is
being loaded by tomcat, i never even get to run the client
    }
  }







---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org


Re: java.lang.UnsatisfiedLinkError: no c in java.library.path

Posted by Jason Bainbridge <ja...@jblinux.org>.
Uhm wouldn't a DLL need to go into C:\WINDOWS\System32? I know the ghastly 
JDBC- ADO bridge JDBC driver we used to use had a supporting dll that had to 
either go in a hard coded location or in the windows system directory.

J.


On Fri, 16 May 2003 03:11 am, Ian Warner wrote:
> Hi group:
>
> Any help with the follwoing error would be greatly appreciated
>
> 2003-05-15 12:50:15 StandardContext[/hello-jaxrpc]: Exception sending
> context initialized event to listener instance of class
> com.sun.xml.rpc.server.http.JAXRPCContextListener
> java.lang.UnsatisfiedLinkError: no testc in java.library.path
>
> starting the application but can't find "testc.dll" is the problem but
> where should i put it under the tomcat directory structure? i have run out
> of places to try - i've tried WEB-INF, WEB-INF/classes, shared/classes and
> even tried puttin it jar format under WEB-INF/lib and shared/lib but to no
> avail. Here's the xml that starts the app if it helps, it is called
> hello-jaxrpc and resides in webapps (there's no entry in the server.xml)
>
> <Context path="/hello-jaxrpc" docBase="../webapps/hello-jaxrpc" debug="3"
> privileged="true">
>
>   <Logger className="org.apache.catalina.logger.FileLogger"
>           prefix="hello-jaxrpc_log." suffix=".txt" timestamp="true"/>
>
> </Context>
>
> Here's what i'm trying to do. I have a client that is sending a msg to a
> simpe tomcat server app called hello.
>
> package hello;
> public class HelloImpl implements HelloIF {
>
>  public String message = "Hello ";
>
>     public String sayHello(String s) {
>     return message + si;
>     }
> }
> The above server code works fine, the client sends a string, this server
> sends back hello + string to the client, so far so good.
>
> Now the trouble comes -  i'm trying to call a "c" class in testc.dll from
> the above java class (modified below) but get
> "java.lang.UnsatisfiedLinkError: no testc in java.library.path" in the
> hello-jaxrpc_log i set up for the application. How do I set the
> java.library.path ? Or what's the default path? I thought is was
> webapps/WEB-INF/classes
>
> Here the modifed code
>
> package hello;
> public class HelloImpl implements HelloIF {
>
>  public String message = "Hello ";
>  public int i=0;
>
>     public String sayHello(String s) {
>     i = new HelloImpl().gemsg(); // added call to native code
>     return message + s + i;
>     }
>     public native int getmsg(); // getmsg() is a c routine compiled into
> testc.dll, all it does is return an integer.
>
>     static {
>         System.loadLibrary("testc"); // this fails when the application is
> being loaded by tomcat, i never even get to run the client }
>   }

-- 
Jason Bainbridge
KDE Web Team - http://kde.org 
webmaster@kde.org 

---------------------------------------------------------------------
To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: tomcat-user-help@jakarta.apache.org