You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Catherine Jung <Ca...@NetcentricSystems.net> on 2000/12/11 12:58:27 UTC

Environment entries?

Hi, one of my servlets needs to open a connection to a database, now, if I
were accessing this database in a normal java program I'd need to have set
an environment variable LD_LIBRARY_PATH to point to it's native
librarys. How can I do something similar in a servlet?

It doesn't work just with the normal environment entries I would use for a
plain java app, and it doesn't work using the following in my web.xml
file. So can anyone enlighten me as to what I've done wrong/should be
doing?

<env-entry>
	<description>path to the objy librarys</description>
	<env-entry-name>LD_LIBRARY_PATH</env-entry-name>
	<env-entry-value>/opt/share/object5.2.3/solaris7/lib/</env-entry-value>
	<env-entry-type>java.lang.String</env-entry-type>
</env-entry>

Thanks, 

Catherine


Re: Environment entries?

Posted by Filip Hanik <fi...@filip.net>.
I think you may be confusing environment with environment.
The env-entry describes an entry for the Java environment.
But the LD_LIBRARY_PATH is a Unix environment variable similar to PATH on a
windows system.

to set this path, you will have to modify the tomcat.sh script.
on top of the script just set

 LD_LIBRARY_PATH="${LD_LIBRARY_PATH}":/opt/share/object5.2.3/solaris7/lib

so the process that looks in the path, will use the global LD_LIBRARY_PATH
variable

Filip

----- Original Message -----
From: "John Clark L. Naldoza" <nj...@ntsp.nec.co.jp>
To: <to...@jakarta.apache.org>
Sent: Monday, December 11, 2000 3:45 PM
Subject: Re: Environment entries?


Catherine Jung wrote:
>
> Hi, one of my servlets needs to open a connection to a database, now, if I
> were accessing this database in a normal java program I'd need to have set
> an environment variable LD_LIBRARY_PATH to point to it's native
> librarys. How can I do something similar in a servlet?
>
> It doesn't work just with the normal environment entries I would use for a
> plain java app, and it doesn't work using the following in my web.xml
> file. So can anyone enlighten me as to what I've done wrong/should be
> doing?
>
> <env-entry>
>         <description>path to the objy librarys</description>
>         <env-entry-name>LD_LIBRARY_PATH</env-entry-name>
>
<env-entry-value>/opt/share/object5.2.3/solaris7/lib/</env-entry-value>
>         <env-entry-type>java.lang.String</env-entry-type>
> </env-entry>
>
> Thanks,
>
> Catherine

Hello Cat,


Perhaps you can try to load the library during the init method of your
main servlet...

i.e.
----
    init()
    {
         try
         {

System.load.("/opt/share/object5.2.3/solaris7/lib/libwhatever.so");
         }
         catch( Exception e )
         {
             e.printStackTrace();
         }
    }
----

Just a suggestion...;-)


Cheers,


John Clark
--
     /) John Clark Naldoza y Lopez                           (\
    / )    Software Design Engineer II                       ( \
  _( (_    _  Web-Application Development                    _) )_
 (((\ \>  /_>    Cable Modem Network Management System <_\  </ /)))
 (\\\\ \_/ /         NEC Telecom Software Phils., Inc.  \ \_/ ////)
  \       /                                              \       /
   \    _/  phone: (+63 32) 233-9142 loc. 3112            \_    /
   /   /  cellphone: (+63 919) 813-6274                     \   \
  /   / email: njclark@ntsp.nec.co.jp                        \   \


Re: Environment entries?

Posted by "John Clark L. Naldoza" <nj...@ntsp.nec.co.jp>.
Catherine Jung wrote:
> 
> Hi, one of my servlets needs to open a connection to a database, now, if I
> were accessing this database in a normal java program I'd need to have set
> an environment variable LD_LIBRARY_PATH to point to it's native
> librarys. How can I do something similar in a servlet?
> 
> It doesn't work just with the normal environment entries I would use for a
> plain java app, and it doesn't work using the following in my web.xml
> file. So can anyone enlighten me as to what I've done wrong/should be
> doing?
> 
> <env-entry>
>         <description>path to the objy librarys</description>
>         <env-entry-name>LD_LIBRARY_PATH</env-entry-name>
>         <env-entry-value>/opt/share/object5.2.3/solaris7/lib/</env-entry-value>
>         <env-entry-type>java.lang.String</env-entry-type>
> </env-entry>
> 
> Thanks,
> 
> Catherine

Hello Cat,


Perhaps you can try to load the library during the init method of your
main servlet...

i.e.
----
    init()
    {
         try
         {
            
System.load.("/opt/share/object5.2.3/solaris7/lib/libwhatever.so");
         }
         catch( Exception e )
         {
             e.printStackTrace();
         }
    }
----

Just a suggestion...;-)


Cheers,


John Clark
-- 
     /) John Clark Naldoza y Lopez                           (\
    / )    Software Design Engineer II                       ( \
  _( (_    _  Web-Application Development                    _) )_
 (((\ \>  /_>    Cable Modem Network Management System <_\  </ /)))
 (\\\\ \_/ /         NEC Telecom Software Phils., Inc.  \ \_/ ////)
  \       /                                              \       /
   \    _/  phone: (+63 32) 233-9142 loc. 3112            \_    /
   /   /  cellphone: (+63 919) 813-6274                     \   \
  /   / email: njclark@ntsp.nec.co.jp                        \   \