Tomcat help

Jean-Henry Berevoescu bjh at GLOBEXPLORER.COM
Fri Aug 4 19:05:48 EDT 2006


But your error is not related at all to the fact that the JAR file or
classes
archived in it is/are not found.
The error is not ClassNotFound, but UnsatisfiedLinkError and that's
pointing to the fact that one or more the native libraries and/or functions
exported by them are not found (the same error you can get if you use
an old library with a call that is not implemented by it - but we digress
already).

The fact that you set:

export LD_LIBRARY_PATH=/etc/tomcat5/common/lib

and not at least

export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/etc/tomcat5/common/lib

means that you actually expect to have all the necessary libraries in that
directory - which is not normally the case for a UNIX platform.

Moreover, as I said, newer approach that considers platform independence
specifically asks for <-Djava.library.path=...> to be set - and it acts, in
principle as LD_LIBRARY_PATH does on UNIX platforms - and that,
in turn, means that you need all the native libraries to have their
paths in that property, not only one of them.

An in a normal case, one would have, say, GDAL in one place,
GD probably in another and so on... It's a bit extreme, I agree,
since the usual scenario is that you will have to add a few dirs
to the search path: /usr/lib, usr/local/lib, some platforms have
/opt/lib, others also /usr/shared/lib and/or /usr/local/shared/lib
and so on.
You will have to check all the dependencies, where they are
located and add the corresponding directories in the search
path.

Jean


Ryan Ollerenshaw wrote:
> Jean-Henry Berevoescu wrote:
>> Making sure libmapscript.so is in the path is good but not enough.
>> All the libraries it depends on (depending on what set of dependencies
>> you configured for before you compiled MapServer - stuff flike GD,
>> GDAL,  PROJ.4, PostgreSQL/PostGIS support, cURL etc) should
>> be accessible too. In the cases you present here the only dir you have
>> pointed to is your common lib of Tomcat's tree.
>>
>> Jean
>>   
> I do not think that is the case because i can compile from the command
> line just fine using:
>
> javac -classpath
> ./mapscript.jar:/etc/tomcat5/common/lib/servlet-api.jar
> MapServerTest.java
>
> it is just Tomcat cannot seem to find mapscript.jar for some reason. 
> i have the the permissions to 755 and i have the file located in:
>
> /etc/java/j2sdk1.4.2_12/jre/lib/ext/mapscript.jar
> /etc/java/j2sdk1.4.2_12/lib/mapscript.jar
> /etc/tomcat5/bin/mapscript.jar
> /etc/tomcat5/common/lib/mapscript.jar
> /etc/tomcat5/shared/lib/mapscript.jar
> /etc/tomcat5/shared/mapscript/mapscript.jar
> /etc/tomcat5/webapps/my_test/WEB-INF/classes/mapscript.jar
> /etc/tomcat5/webapps/my_test/WEB-INF/lib/mapscript.jar
> /etc/tomcat5/webapps/my_test/WEB-INF/src/mapscript.jar
> /usr/java/j2sdk1.4.2_12/lib/mapscript.jar
> /usr/local/mapserver/htdocs/testJavaApp/build/WEB-INF/lib/mapscript.jar
>
>
>>
>> Ryan Ollerenshaw wrote:
>>  
>>> Umberto Nicoletti wrote:
>>>    
>>>> There are a few docs scattered around that explain how to deal with
>>>> this issue:
>>>>
>>>> http://www.unicolet.org/mapserver/tomcat.html
>>>> http://mapserver.gis.umn.edu/docs/howto/javamapscript
>>>> http://mapserver.gis.umn.edu/docs/howto/java_mapscript_Tomcat_55
>>>>
>>>> HTH,
>>>>
>>>> Umberto
>>>>
>>>>       
>>> Still no luck, and i have tried everything:
>>>
>>> I copied libmapscript.so to /usr/local/lib and set //etc/ld.so.conf/
>>> //
>>> added
>>> export LD_LIBRARY_PATH=/etc/tomcat5/common/lib
>>> and
>>> export CLASSPATH=$CLASSPATH:/etc/tomcat/common/lib/mapscript.jar
>>> and
>>> JAVA_OPTS=" -Djava.library.path=/etc/tomcat5/common/lib/ "
>>> to catalina.sh
>>>
>>> Nothing seems to be working, when i print out my classpath through
>>> code using:
>>> Get the System Classloader
>>> ClassLoader sysClassLoader = ClassLoader.getSystemClassLoader();
>>> //Get the URLs
>>> URL[] urls = ((URLClassLoader)sysClassLoader).getURLs();
>>> for(int i=0; i< urls.length; i++)
>>> {
>>>    out.println(urls[i].getFile());
>>>    out.println("<br>");
>>> }
>>>
>>> I get:
>>>
>>> /usr/java/j2sdk1.4.2_12/lib/tools.jar
>>> /etc/tomcat5/bin/dist/commons-daemon.jar
>>> /etc/tomcat5/bin/bootstrap.jar
>>>
>>> why isnt mapserver.jar showing up?
>>>
>>> I am using the eclipse w/ the tomcat plug
>>>    
>>>> On 8/4/06, Ryan Ollerenshaw <ollerery at engr.orst.edu> wrote:
>>>>      
>>>>> I am able to compile a java mapscript file from the command line
>>>>> using:
>>>>>
>>>>> javac -classpath ./mapscript.jar MapServerTest.java
>>>>>
>>>>> But when i try to turn my code into a servelt and run it over
>>>>> Tomcat i
>>>>> keep getting:
>>>>>
>>>>> java.lang.UnsatisfiedLinkError: no mapscript in java.library.path
>>>>>
>>>>> I have tried adding:
>>>>> export CLASSPATH=./mapscript.jar
>>>>> to my ./startup.sh file but that does not seem to help.  Am i
>>>>> missing a
>>>>> setting somewhere, why cant Tomcat find the .jar file?  I have it in
>>>>> the
>>>>> same directory as my .java file and also in /common/lib and
>>>>> /shared/lib
>>>>>
>>>>> Thank you for any help that you can provide
>>>>>
>>>>>         
>>>
>>>
>>>
>>>     
>>
>>
>>   
>
>
> !DSPAM:44d3d015289671800216252!
>


-- 
Please avoid sending me Word, Excel or PowerPoint attachments.
See http://www.gnu.org/philosophy/no-word-attachments.html



More information about the mapserver-users mailing list