Library paths and environment variables

Hello,
I am using 10g AS 9.0.4 on a Unix system.
I am trying to convert an old JSP web application to work with 10g. It is not an EAR/WAR file so I am manually trying to set it up under the "default-web-app" folder. It uses a number of java class files which currently reside in $J2EE_HOME/default-web-app/WEB-INF/classes/mystuff.
These class files require access to a number of libraries. I foolishly believed that they would be accessible if I were to place them in the $J2EE_HOME/default-web-app/WEB-INF/lib folder, but that did not work.
I read that OC4J uses a "catch all" lib directory at $J2EE_HOME/applib. I copied the library files there and they still did not work.
Frustrated, I tried to print out the environment variables for the server - only to find that this function is not supported.
I managed to print out the library path by creating a Java class files which returns the following as a string:
System.getProperty("java.library.path");
This (when called from a JSP) prints a number of different library paths, none of which match those found listed in the $J2EE_HOME/config/application.xml file. I placed the library files in one of the paths listed by the "java.library.path" and it worked!
3 questions:
1. How do you print the server's environment variables using a JSP? This strikes me as a very useful function for sorting out library and path issues. Do a search on Google for "print environment variables OC4J" or something similar and there are no useful pages suggesting how this can be done.
2. Why are the default library paths different on the server than to those specified in application.xml?
3. How do I change the LD_LIBRARY_PATH (or any environment variable for that matter)? I have tried adding the following line to $ORACLE_HOME/Apache/Jserv/etc/jserv.properties without success:
wrapper.env=LD_LIBRARY_PATH=/my/custom/library/path
Any help you can offer would be most appreciated.

>
Thanks very much for a such a comprehensive response
- it has helped answer a lot of questions, especially
being able to print out the system properties. That
will be really useful!
No worries at all Rob.
The main hurdle is that the libraries are indeed
native (*.so) libraries. I hadn't considered that
until you pointed it out in your message. Can I
assume, then, that $J2EE_HOME/applib and
$J2EE_HOME/default-web-app/WEB-INF/lib are only
designed to handle Java's .JAR librares? That would
explain why placing the native libraries in there
didn't work, but is there a way of getting such
native libraries recognised and bundled up in a
WAR/EAR file?
Yep, that's it.
Our proprietary applib and the servlet specs web-inf/lib are only dealing with Java archives.
The J2EE specs don't cover how to deal with native libs like this.
Now I've NEVER EVER tried it, but it's worth a shot of at least trying -- for simplified packaging purposes, what you may be able to do is to distribute the .so's within the web-inf/lib -- and then just set that directory (where's its realized on the server after the app is deployed) to be referenced witihn the LD_LIBRARY_PATH. I'd expect our deployment manager will just ignore files it doesn't know about, so arguably you should be able to at least distribute them with the standard archive.
You'll need to specifically set the LD_LIBRARY_PATH as a separate task outside of the deployment operation though.
>
This is where things get a bit weird, and is partly
my fault during the installation of 10g AS.
We already had an existing installation of Oracle 10g
Database (10.1.0) at $ORACLE_HOME under the user
"oracle". I logged in as the user "oracle" to install
the Application Server into a different location (In
this case, "$ORACLE_HOME/../ias10g_9.0.4" - let's
call this $IAS_HOME). So there is no separate user
account for Oracle Database and Application Server
(and hence no separate $LD_LIBRARY_PATH).
If I log into UNIX as the user "oracle" and echo the
LD_LIBRARY_PATH, I get the following directories:
$ORACLE_HOME/lib
/usr/openv/netbackup/bin
/usr/dt/lib
/usr/lib
I use this user to do "opmnctl stopall" and "opmnctl
startall". If I then print out the library path from
a JSP using
"System.getProperty("java.library.path");", I get the
following paths:
$IAS_HOME/jdk/jre/lib/sparc/server
$IAS_HOME/jdk/jre/lib/sparc
$IAS_HOME/jdk/jre/../lib/sparc
$IAS_HOME/opmn/lib
$IAS_HOME/lib
$IAS_HOME/usr/lib
Which is totally different to those listed by
$LD_LIBRARY_PATH at the command line, which means
they must be coming from somewhere else.
It gets worse - my application is trying to call a
native library that is only present in the
$ORACLE_HOME/lib32 directory (libclntsh.so.10.1), so
unless I can include this path in the
"java.library.path" on the Applicaiton Server, then
my program will not work.
So, how do I change the "java.library.path" when the
values aren't coming from $LD_LIBRARY_PATH in the
first place?
The utility $IAS_HOME/opmn/bin/opmnctl is actually a shell script.
It has this section which sets the LD_LIBRARY_PATH:
if [ -z "$LD_LIBRARY_PATH" ]
then
LD_LIBRARY_PATH=$ORACLE_HOME/opmn/lib:$ORACLE_HOME/lib ; export LD_LIBRARY_PATH
else LD_LIBRARY_PATH=$ORACLE_HOME/opmn/lib:$ORACLE_HOME/lib:${LD_LIBRARY_PATH} ; export LD_LIBRARY_PATH
fi
So if you have an existing LD_LIBRARY_PATH env var set, it should just be putting its paths onto the front of it.
What you could try as a quick test is to edit the opmnctl script (after taking a backup of course) and either appending the path you need to it, or just add some debug statements to output the LD_LIBRARY_PATH value it ends up setting so you can try and work out what's causing it.
I expect these other entries:
$IAS_HOME/jdk/jre/lib/sparc/server
$IAS_HOME/jdk/jre/lib/sparc
$IAS_HOME/jdk/jre/../lib/sparc
are coming from the JRE when it is launched, in probably a similar manner to our opmn entries.
I really appreciate your help, and I bet if anyone
can answer these questions, you can! ;-)
You're very welcome.
cheers
-steve-

Similar Messages

  • Open module for managing property file and environment variables

    Looking for an open module for managing property files and environment variables (like CLASSPATH) set in a shell script. For handeling properties (preserving comments, supporting includes, appending new entries, and more) I have looked at SuperProperties from openadaptor but find certain functionality lacking. As for interfacing with common shell scripts/files containing setting for CLASSPATH, JAVA_HOME, other system/application variables another type of object editor is needed. Maybe JFIG?
    Any ideas are greatly welcomed.

    You seem wright, you hit a brick wall here with Air to find the location
    of the command console on windows...
    So in fact I never build an exe tool, but this little problem was a nice
    case to test it and I tried it.:
    I downloaded monodevelop
    -GTK# for .NET 2.12.10*
    -MonoDevelop 2.4.2*
       from http://monodevelop.com/Download
    created a console project and had an exe in 5 minutes !
    You can download the findconsole tool and the projectfiles here:
       http://greencollective.nl/temp/dump/findconsole_monoproject.zip
    findconsole.exe will reveal the path/location of cmd.exe on a windows system.
    Cheers,
    Latcho

  • Which Oracle folders into "PATH" system Environment Variable

    Which Oracle folders must exist into "PATH" system Environment Variable in Windows OS?
    The folders must contain Oracle command line utilities, like "sql * plus", "exp" and so on.

    The path to your bin folder ...
    for eg :
    D:\oracle\product\10.2.0\db_1\bin;Cheers :)
    Renjith Madhavan

  • [svn] 3037: Update flex-config. xml files used by the team and qa webapps to use the {targetPlayerMajorVersion} token instead of a hardcoded player version in the library-path and external-library-path .

    Revision: 3037
    Author: [email protected]
    Date: 2008-08-29 06:54:15 -0700 (Fri, 29 Aug 2008)
    Log Message:
    Update flex-config.xml files used by the team and qa webapps to use the {targetPlayerMajorVersion} token instead of a hardcoded player version in the library-path and external-library-path. This will allow the correct playerglobal.swc to be located when the target player version is set in the flex-config.xml or passed to mxmlc or compc.
    Modified Paths:
    blazeds/trunk/apps/team/WEB-INF/flex/flex-config.xml
    blazeds/trunk/qa/resources/config/flex-config.xml

    Unfortunately I don't have the
    "org.eclipse.swt.win32.win32.x86_3.1.2.jar" file. On my computer
    the folder is not set up the same way (C:\Program Files\Adobe\Flex
    Builder 2\plugins) instead it is set up as (C:\Program
    Files\Adobe\Flex Builder 2\metadata\plugins) but I've looked in
    everything and that file just isn't in there. I've re downloaded it
    twice. Still not there. Is there anything else i can do.

  • Meaning of java.library.path and UnsatisfiedLinkError

    I'm trying to compile and run a simple program that uses a jar extension called "*jnetpcap*". I compile it (with classpath), then run it with:
    java -classpath /usr/share/java/jnetpcap.jar:./ <ClassFileName>
    When I do this I get :
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no jnetpcap in java.library.path
    *...What's that all about ?*

    Some Java libraries are written partly in native code (usually written in C++). The native code is placed in a shared library, which is a .dll on Windows, or a .so on unix. java.library.path is the system property which tells the JVM which directories to search for these shared libraries. I suggest you look for a jnetpcap.so. If you find it try the command line option -Djava.library.path=/netpcap/lib (giving the directory containing the .so file).

  • Help: java.library.path and javah

    Hello,
    I have a little problem with my java.library.path!
    I am working on a program which loads a dll in c++ that I have compiled
    and will be used by a java program.
    My java program consists of 2 Classes:
    -- MonitorContainer.class creates an object; this object has an attribute which is a String type and it should be communicating with my dll: Diskid32.dll
    -- This dll is loaded by another class : Diskid32.class with a known
    and documented method: System.loadLibrary("Diskid32").
    When all the following files(MonitorContainer.class, Diskid32.class, Diskid32.dll) are in the same folder, the program works fine
    I need to put the Diskid32.dll and the Diskid32.class into a package! (package myutil.Disk)
    I have two questions concerning the javah tool:
    -- when I when I create the signatures with javah should I run:
    ------ javah Diskid32 or something else like
    ------ javah util.Disk.Diskid32 or ...
    I have tried both of these and they produce header files which are different and both produce the same result in execution error
    when I run my program and it's package
    -- I tried to configure the java.library.path but still no go! When I launch java MonitorContainer I receive the following wrong message :
    Exception in thread "main" java.lang.UnsatisfiedLinkError: no Diskid32 in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1344)
    at java.lang.Runtime.loadLibrary0(Runtime.java:744)
    at java.lang.System.loadLibrary(System.java:815)
    at myutil.Disk.Diskid32.<clinit>(Diskid32.java:52)
    at MonitorContainer.main(MonitorContainer.java:21)
    My conclusion is that library path is not well configured
    and the JVM is not finding my library diskid32.dll.
    Thank for all...
    Stephane

    Hello,
    I 've solve my problem: to set the library path You must write :
    java -Djava.library.path=c:/xxx/yyy/zzz ; c:/xxx/yyy/zzz is the path to locate the Dll!
    But the really problem was a forgetting in the c++ code, I have write a mistake in the line that references � class!
    (jclass cls = env->FindClass(".../.../...");)
    Thank for all

  • Load Plan logging and environment variables

    Hi all.
    Do think it is possible to log in an external table each load plan step details (such as step name, step duration, etc..) ?
    I'm wondering if there are some environment variables that contain all typical step information.
    Thanks

    thank you for the answer..
    but why I have to use a when case step?
    I just need to set a string in a variable before to execute a serial step within exception step.
    I do this in a normal load plan step. So Why I cannot do the same in the exception one ?

  • ProcessBuilder and Environment variables

    There is any way to use environment variables, like in dos, with %% through java programming?
    For example :
    ProcessBuilder pb = new ProcessBuilder("c:/winnt/notepad.exe", "%TTT%");
    // Would be even better :) ... But the previous line is Ok ;)
    // ProcessBuilder pb = new ProcessBuilder("c:/winnt/notepad.exe %TTT%");
    Map<String,String> env = pb.environment();
    env.put("TTT", "M:/temp/testTTT.txt");
    try{
    Process process = pb.start();
    catch(Exception e){
    e.printStackTrace();
    }

    Cool, it worked, Thanks sabre150 :)
    The strange thing is that with echo works, with dir no!!! :)
    //     String[] command = { "cmd.exe", "/C", "echo %TTT%", };
         String[] command = { "cmd.exe", "/C", "dir %TTT%", };
    final ProcessBuilder pb = new ProcessBuilder(command);
    Map<String,String> env = pb.environment();
    env.put("TTT", "M:/temp");
    try{
    Process process = pb.start();
    InputStream is = process.getInputStream();
    InputStreamReader isr = new InputStreamReader(is);
    BufferedReader br = new BufferedReader(isr);
    String line;
    while ((line = br.readLine()) != null) {
    System.out.println(line);
    catch(Exception e){
    e.printStackTrace();
    }

  • Jdev 10.1.2: Using environment variable in library path?

    Hi,
    I'm trying to use Maven2 for my build process besides JDeveloper for maintaining the code. MAven puts all necessary jars in a local repository, in my case in the folder: 'C:\Documents and Settings\PAlma\.m2\repository'. Now if I want to compile the code in JDeveloper I add libraries to my projects that are refering to the jars in the Maven local repository. In that way I am sure they use the same jars.
    The problem arises if another developer on another machine wants to use this Jdeveloper configuration. Because his Maven repository will not be in the folder 'c:\...\palma\..' but in 'c:\...\HIS_NAME\...'.
    So it would be great if I could use some variable like M2_REPOSITORY_HOME in my library path and each machine can have it's own value for that variable. I tried to use an enviroment-variable but that isn't working.
    Does anyone have an idea for this?
    Kind regards,
    Paskal

    Refer to
    http://www.oracle.com/technology/products/jdev/htdocs/10.1.2.0.0/install.html#migrating

  • SQL Developer Not Working "no ocijdbc11 in java.library.path"

    Hi,
    I have Oracle 10g with SQL Developer 3.0 on Windows XP, they worked well untill I just installed Oracle ODBC (ODAC101040.exe). I started to receive error message "no ocijdbc11 in java.library.path" and I am no longer able to use SQL Developer.
    Any solution?

    Check on the envirnment variables on the windows. Once you installed the "Oracle ODBC" it might have replaced the Old env. variables that can found in XP "System Properties> advance tab> environment Variables". Make sure you have the right environment variables that point to right directory locations. Update us with your findings.

  • Windows too - java.lang.UnsatisfiedLinkError: no cis in java.library.path

    There have been many posts of people who get the following exception:
    java.lang.UnsatisfiedLinkError: no cis in java.library.path
    And it is always on solaris only, they don't seem to get it on windows. However, I AM using windows and am getting this error trying to run a simple stand alone java app to connect to a jms topic. I'm trying to connect like so:
    Hashtable env = new Hashtable();
    env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.cosnaming.CNCtxFactory");     
    env.put(Context.PROVIDER_URL, "iiop://localhost:3700");
    jndiContext = new InitialContext(env);
    Thus far I have been COMPLETELY unable to get a simple little standalone java app to connect to a jms topic on the sun server. Why is this so @#%$#@ hard? Anyway, even though it compiles file, I get the above exception when I try. I imagine it's a environment varaible/classpath issue. Soooo, can someone please give me the complete list of all required jar/dll files which must be in the classpath, as well as all environment variables which must be set in order to get a simple java app to connect to a jms topic? Please? Thank you.
    Tony

    Sorry, but I have those .dll files in my classpath. Here is the batch file I'm using to try to run my simple standalone app (called SimpleTopicPublisher):
    cls
    setlocal
    set JAVA_HOME=C:\sun\AppServer7\jdk
    set ANT_HOME=C:\prog\java\BOABackOffice\3rdparty\ant
    set IMQ_HOME=C:\sun\AppServer7\imq
    set classpath=.;
    set classpath=%classpath%;C:\prog\java\BOABackOffice\3rdparty\junit\junit.jar
    set classpath=%classpath%;C:\sun\AppServer7\imq\lib\jms.jar;C:\sun\AppServer7\imq\lib\imq.jar;C:\sun\AppServer7\imq\lib\fscontext.jar
    set classpath=%classpath%;C:\sun\AppServer7\lib\appserv-ext.jar;C:\sun\AppServer7\lib\appserv-rt.jar;C:\sun\AppServer7\lib\appserv-admin.jar
    set classpath=%classpath%;C:\sun\AppServer7\bin\cis.dll;C:\sun\AppServer7\bin\libnspr4.dll;C:\sun\AppServer7\bin\libplc4.dll
    set classpath=%classpath%;C:\sun\AppServer7\bin\libplds4.dll;C:\sun\AppServer7\bin\nss3.dll;C:\sun\AppServer7\bin\ssl3.dll
    set path=%path%;%JAVA_HOME%\bin;%ANT_HOME%\bin
    java SimpleTopicPublisher com.ecc.utils.LoggerTopic 1
    endlocal
    I have all the .dll's in my classpath, as well as .jar files that I can think of. Still no luck.
    - Tony

  • UnsatisfiedLinkError: no something in Java.library.path

    Hi everybody,
    This error seem to be common with many ppl, but i couldnt solve it after go through couple of available solutions. My java program using native C++ code to control the hardware input like mouse click or keyboard under Linux. I've also used jdic for system tray. So basislly i have some external jar files and .so shared-files. When i ran the project, i got this error. I have tried to add the missing .jar file to project external jar file and the required library files in the java.library.path using add variables in project setting. It doesnt work
    Can anybody have some advices, thank you?

    Hi,
    Please check out this thread http://forums.sun.com/thread.jspa?threadID=627890

  • How to set java.library.path form code

    I'm new to JNI. I see there are several ways to set JVM to look for libraries dll, so, etc.
         System.setProperty("java.library.path", ".");
         System.loadLibrary("hello");That's when UnsatisfiedLinkError
    java.lang.UnsatisfiedLinkError: no hello in java.library.path
         at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1682)
         at java.lang.Runtime.loadLibrary0(Runtime.java:822)
         at java.lang.System.loadLibrary(System.java:992)
         at HelloWorld.main(HelloWorld.java:17)But if I comment the line that sets the java.library.path and call the program with the command java -Djava.library.path=. HelloWorld works.
    The question is: Why is not working? How should it be the property setup? I rather don't set Variables, or use -D option.
    Thanks in advance.
    PD: If it helps I'm using JDK 1.5.0_01 on Linux kernel 2.6.8

    well i wrote the script and everything is fine! i can run the blackbox example on the commapi.
    But i am writing another program using netbeans to send some data to a PIC microcontroller using the serial port (that is why i installed the commapi), and when i'm trying to build it or run it on netbeans throws this error:
    Error loading LinuxSerialParallel: java.lang.UnsatisfiedLinkError: no LinuxSerialParallel in java.library.path
    Exception in thread "main" java.lang.UnsatisfiedLinkError: isDevLink
    at com.sun.comm.Unix.isDevLink(Native Method)
    at com.sun.comm.PathBundle.add(PathBundle.java:108)
    at com.sun.comm.PlatformPortBundle.<init>(PlatformPortBundle.java:44)
    at javax.comm.CommPortIdentifier.<clinit>(CommPortIdentifier.java:138)
    as far as i know it seems to be missing a library (LinuxSerialParallel), if this is right, adding the library would solve the error?how can i add the library? is there another way to solve this?
    thanks in advance!!

  • Siginificance of the user and system variables

    What is the significance of user variable and system variable in
    windows 2000 environment?
    Because I usually set user variable(classpath and path) and system
    variable(classpath,path and javahome) after installing j2sdk and
    weblogic. But I find out one of my friend just set the user variable and
    running the same. I like to know that what the system doing with user variable and
    system variable? In system view, what is the difference between the user var
    and system var?

    Not sure what this has to do with Java, but: The system variables apply to all users. The user variables apply to only the user that set them. Sign on as a different user and see what happens.

  • Where do PATH and MANPATH definitions go for OSS12.4 in Solaris 11.2?

    ** Newbie alert **
    Hello,
    This link says what to add to PATH and MANPATH for a new Solaris Studio 12.4 installation
    but not where to put the PATH and MANPATH entries (preferably for all users).
    Setting Up Access to the Developer Tools and Man Pages - Oracle® Solaris Studio 12.4: InstallationGuide
    Note that my "installation" consisted of downloading the appropriate Tarfile and then unpacking it - so this comment is confusing:
    "If you did not enable the installer to create symbolic links in /usr/bin and /usr/share/man, you might    need to change your PATH   and MANPATH  environment variables to enable use of the Oracle Solaris Studio 12.4 software."
    Another confusing entry in the Solaris 11.2 documentation says "the MANPATH definition is no longer required in Solaris 11".
    Sincerely,
    Kent

    Hi Kent,
    If you installed from the tar file you will need to add the directory to your PATH and MANPATH variables.   The steps are platform specific and are listed below:
    On Oracle Solaris platforms
    Add the path /install-dir/solarisstudio12.4/bin to your PATH environment variable.
    Add the path /install-dir/solarisstudio12.4/man to your MANPATH environment variable.
    On Linux platforms
    Add the path /install-dir/oracle/solarisstudio12.4/bin to your PATH environment variable.
    Add the path /install-dir/oracle/solarisstudio12.4/man to your MANPATH environment variable.
    For a more detailed discussion PATH and MANPATH you can review the Solaris documentation on "Setting Environment Variables".  The location to that information is located here:
    https://docs.oracle.com/cd/E19683-01/806-7612/customize-8/index.html
    You might find this link helpful too:
    https://docs.oracle.com/cd/E36784_01/html/E36818/userconcept-39855.html#scrolltoc
    Note - When you install from a tar file you cannot get support or patches for the product from Oracle. If you want such support you must use a package installer. See Chapter 2, Installing Oracle Solaris Studio 12.4 on Oracle Solaris 10 and Linux or Chapter 3, Installing Oracle Solaris Studio 12.4 On Oracle Solaris 11.
    Also, if you haven't installed the latest Solaris 11.2 SRU then you will also need to install the required system libraries.   Here's a link to the instructions:
    https://docs.oracle.com/cd/E37069_01/html/E37072/gouaw.html#scrolltoc
    HTH

Maybe you are looking for

  • Default calender stamp in infoview ( webi/deki)

    I am facing a problem related to date formats when picked from calender. I have noticed this in almost all ful client reports viewed through infoview. I am using a date object in the prompt, this object is set as mm/dd/yyyy format in the universe. Wh

  • Basic tabular form with manual pk

    Hi, using oracle 11.2.0.1 and apex 3.21. I'am trying to add a new row in a table with a pk other than trigger generated or sequence generated. the pk column is a varchar2(3 char) and the user can enter any 3 letter values that does'nt already exist.

  • Oracle 9i R2 download for Linux broken?

    Hi there, i tried to download the cpio's for Linux and run into trouble with lnx_920_disk1_cpio.gz. Size: ===== ls -l lnx_920_disk1_cpio.gz shows ... 553239173 ... Checksum: ========= md5sum lnx_920_disk1_cpio.gz shows ... 4dde ... 93e8 ... Unzip: ==

  • OLE object not linking... is CR10.5 on VS2008

    Running Crystal Reports 10.5 which comes with VS2008 i have inserted an OLE object and told the Insert object to Create From File - i then browse to the location of the BMP file and click on link I do NOT have Display as Icon checked the image does n

  • Query on select stmt

    hi, below is the extraction logic 1.     Select all invoice documents from Table VBRK where Sales Organization VBRK-VKORG, Distribution Channel VBRK- VTWEG and Division VBRK-SPART matches to Sales Organization, Distribution Channel and Division speci