Accessing Tomcat Global Environment Variables
Hello,
I have tried to access Tomcat 5.0 (xx) Global Environment variables.
I have the Integer simpleValue defined in the Tomcat Administrators panel under "Environment Entries"
Here's my code:
Context initContext = new InitialContext();
Context envContext = (Context)initContext.lookup("java:comp/env");
Integer i = (Integer)e.get("simpleValue");
I have also tried and infiinite variation of this with no success (Accessing the Initialcontext directly)
The Tomcat docs at: http://jakarta.apache.org/tomcat/tomcat-5.0-doc/jndi-resources-howto.html
says:
"<Environment> - Configure names and values for scalar environment entries that will be exposed to the web application through the JNDI InitialContext (equivalent to the inclusion of an <env-entry> element in the web application deployment "
PLEASE HELP !!!
Geir Ove
This is a Tomcat bug. See http://nagoya.apache.org/bugzilla/show_bug.cgi?id=14228.
Similar Messages
-
How does java access user specific environment variables ?
Hi,
I'm running a java application on a W2K o/s. My application needs to be able to access the user environment variables in Windows but I don't know how to do this. Can anyone help ?
Thanks.http://www.rgagnon.com/javadetails/java-0150.html
-
Best way to set global environment variables?
What is the best way to set global (i.e. for all users of the computer, ideally all shells as well) environment variables under Leopard?
I know that they can be set via ~/.bashrc, ~/.profile or in my case ~/.zshrc files in the terminal on a per user basis.
Also, they can be set for GUI apps as well via ~/.MacOSX/environment.plist on a per user basis.
http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Artic les/EnvironmentVars.html
The path can apparently be set globally by adding files to /etc/paths.d/*
http://blog.plotdevice.org/2008/04/global-path-in-mac-os-x-leopard/
Is there a way to set environment variables globally so that they are accessible to all users and all programs including nonstandard shells like zsh?
My inclination is to set them in /etc/rc.common but that seems like it might be a bad idea. I'd prefer something more like the /etc/paths.d/* solution that only involves adding files, not modifying existing ones. They should be less likely to be overwritten in a system update later.They may be less likely to be overwritten than you fear. A lot of things depend on modifications to the system scripts like /etc/profile. Although I'd expect these to be broken by an upgrade to Leopard, for example, they have survived all Tiger upgrades on my machine. You could always have them source scripts in /usr/local, say, so that the work involved in reconfiguring them if they are overwritten is minimal. (Or you could just install your versions in /usr/local and make the system scripts symlinks to those versions - if anything is overwritten, it would be the symlink rather than the file itself. An automated start up script could even check and recreate the symlink if necessary.)
- cfr -
Accessing a Global package variable Via Select
Hi All,
I want to access a global variable i.e package global variable through a select query. Is this possible or not possible. Please share some inputs on this.
ThanksJust to clarify that you can reference the global variable if your SQL is itself within PLSQL. It will be bound in.
CREATE OR REPLACE PACKAGE p1
AS
my_global NUMBER := 1;
FUNCTION f_get_my_global
RETURN NUMBER;
PROCEDURE p_do_something;
END;
CREATE OR REPLACE PACKAGE BODY p1
AS
FUNCTION f_get_my_global
RETURN NUMBER
AS
BEGIN
RETURN my_global;
END;
PROCEDURE p_do_something
AS
l1 NUMBER;
BEGIN
SELECT /*+ find_me */
my_global
INTO l1
FROM DUAL;
END;
END;
SQL> exec p1.p_do_something;
PL/SQL procedure successfully completed.
SQL> select sql_text from v$sql where sql_text like '%find_me%';
SQL_TEXT
SELECT /*+ find_me */ :B1 FROM DUAL
SQL> -
Global Environment Variables?
What is the best way to set global (i.e. for all users of the computer) environment variables under Leopard?
I know that they can be set via ~/.bashrc, ~/.profile or in my case ~/.zshrc files in the terminal on a per user basis.
Also, they can be set for GUI apps as well via ~/.MacOSX/environment.plist on a per user basis.
http://developer.apple.com/documentation/MacOSX/Conceptual/BPRuntimeConfig/Artic les/EnvironmentVars.html
The path can apparently be set globally by adding files to /etc/paths.d/*
http://blog.plotdevice.org/2008/04/global-path-in-mac-os-x-leopard/
Is there a way to set environment variables globally so that they are accessible to all users and all programs including nonstandard shells like zsh?
My inclination is to set them in /etc/rc.common but that seems like it might be a bad idea. I'd prefer something more like the /etc/paths.d/* solution that only involves adding files, not modifying existing ones. They should be less likely to be overwritten in a system update later.Thanks for the reminder. It has been reposted here: http://discussions.apple.com/thread.jspa?threadID=1513246
-
WebForms - Accessing Environment Variable on a Windows Client
Hi. We access a Windows Environment Variable using Client-Server Forms 6i. We do this as follows:
Tool_Env.GetVar('ALLUSERSPROFILE', myPath);
message(myPath);This returns the value 'c:\documents and settings\all users' on Windows XP.
This returns the value 'c:\programdata' on Windows 7.
We'd like to keep similar logic in this form once it's migrated to Web Forms. Is there a way to access this 'allusersprofile' environment variable (or any environment variable to determine whether the user is XP or Win7) from a web form running our UNIX server? Maybe somehow using WebUtil or something?
Any suggestions would be greatly appreciated. Thanks.WebUtil enable your form then do this:
message (CLIENT_WIN_API_ENVIRONMENT.Get_Environment_string('allusersprofile'));To get the Windows version, do this:
message(CLIENT_WIN_API_ENVIRONMENT.Get_Windows_Version);.
Edited by: Michael Ferrante on May 23, 2012 5:06 PM -
Hi,
I'm running WebLogic 5.1 sp12 with an Apache 1.3.27 web server.
Apache sets an environment variable ('REDIRECT_URL') upon occurence of
a 40x error. How do I access such an environment variable from my jsp
page? Thanks - Dave
[email protected] (D. Alvarado) wrote:
>Hi,
> I'm running WebLogic 5.1 sp12 with an Apache 1.3.27 web server.
>Apache sets an environment variable ('REDIRECT_URL') upon occurence of
>a 40x error. How do I access such an environment variable from my jsp
>page? Thanks - Dave
Hi Dave,
Hope this link will help you.
http://developer.java.sun.com/developer/JDCTechTips/2001/tt1204.html#tip1
Prema
SIP Technologies & Exports Ltd., India
-
RCP, Environment Variables, OS X, Info.plist and LSEnvironment
I've got a somewhat challenging problem here.
I've got an RCP application that relies upon some shared dynamic libraries which might not be in standard locations (as this is OS X and they are user installed).
One of the things we need to configure is DYLD_LIBRARY_PATH in order for the shared libraries be discovered. The problem here is OS X doesn't have a simple way to set environment variables that applications launched from the Finder can "see".
One of the thing that I've found, but not had any success with, is to dynamically modify the RCP's Info.plist to have an additional key LSEnvironment whose value is a dictionary to set environment variables only visible to that application - okay this seems ideal for me. But it's not working.
I also found that I could use launchctl setenv to set a user global Environment variable, however it's not persistent across launches, and each time I set, I must restart the app. I really need this persistent.
Does anyone have any solution for setting Environment variables that are visible from the RCP app (and it's children) that works in OS X without having to launch the RCP app from a terminal?
Thanks in advance!Brian de Alwis wrote on Wed, 05 August 2015 19:54Sounds like you want to use System.loadLibrary() with absolute paths?
That doesn't quite work, as we aren't using JNI. Unfortunately the use-case details get pretty complicated - so I omitted in an effort to make it simpler to understand the problem.
Basically we have built an IDE that uses the Prolog interpreter, XSB. XSB natively connects to MySQL using the shared MySQL libs. Unfortunately on OS X, MySQL can get installed into possibly one of many locations, and it certainly doesn't install it's libs in /usr/local/lib or /usr/lib. We access XSB via a Java library called Interprolog, which I believe, is just a pipe interface to the command line shell - hence when the Interprolog engine object is instantiated, it fires up a shell process for XSB - which needs to locate those MySQL libraries. Hence, DYLD_LIBRARY_PATH needs to be set to have the path for /usr/local/mysql/lib (or wherever the user installed it) defined in the parent process in order for Interprolog's sub-process to pick up the environment variable.
Right now there are only 2 reliables ways I have found to get this to work.
1. Launch Terminal, export the environment variable. Then launch our RCP app from the Terminal. - cumbersome and unintuitive; bad user experience.
2. Launch Terminal, use `launchctl setenv DYLD_LIBRARY_PATH /usr/local/mysql/lib`. And then one can lacuna our RCP app using Finder. - problem is that DYLD_LIBRARY_PATH is now global to the environment and will not persist between reboots.
I've tried added the LSEnvironment dictionary to the Info.plist within the RCP application, but that just doesn't seem to work - and I'm not sure if that is because the OS X eclipse launcher doesn't propagate the environment forward or what. For the time being I have a way for the user to click a button which runs launchctl setenv and then prompts the user to exit the app, and then launch again from finder [IWorkbench.restart() doesn't work because new process is a child of the current] - which works but is undesirable workflow as it doesn't persist across a login/reboot.
My next step is to try what is outlined here: http://stackoverflow.com/questions/829749/launch-mac-eclipse-with-environment-variables-set
However it feels even more sketchy than just modifying the Info.plist to contain the right environment variables. -
Settting environment variables
Oracle 9i AS on HP_UX.
From within the servlet application I use Runtime.Exec() to start another process but it doesn't have access to the environment variables it needs, e.g. LD_LIBARY_PATH, even though these have been set in .profile.
I have also tried adding them to jserv.properties, but still no result.
Can anyone explain how to make environment variables available within the servlet application
Thanks
DaveYes it shows up after restart of BIDS .
But during design time this is a bug I hope Microsoft fixes this bug in the future releases
Mudassar
It's not really a bug. Visual Studio loads the environment variables when starting up.
In future releases you use projects and parameters instead of environment variables, so the issue goes away ;)
MCSE SQL Server 2012 - Please mark posts as answered where appropriate. -
R12, Environment Variables on Windows, and OBIEE
Dear Experts,
I've managed to install R12 on Windows.
Now, in the global environment variable, Path, the user Oracle has a number of directories in its default PATH, starting with the Oracle apps middle tier.
C:\oapps\apps\tech_st\10.1.2\bin;
C:\oapps\apps\tech_st\10.1.2\jdk\jre\bin\classic;
C:\oapps\apps\tech_st\10.1.2\jdk\jre\bin;
C:\oapps\apps\tech_st\10.1.2\jlib;
C:\oapps\apps\tech_st\10.1.3\bin;
C:\oapps\db\tech_st\11.1.0\bin;
C:\Windows\system32;
C:\Windows;
I notice that there are .cmd scripts that set the Path.
This script sets the path to look in: c:\oapps\db
cd C:\oapps\db\tech_st\11.1.0
VIS_black.cmd
echo %PATH%
C:\oapps\db\tech_st\11.1.0\perl\5.8.3\bin\MSWin32-x86-multithread\;
C:\oapps\db\tech_st\11.1.0\bin;
This script sets the path to look in: c:\oapps\apps
set PATH=""
cd c:\oapps\apps\apps_st\appl
VIS_black.cmd
echo %PATH%
C:\oapps\apps\apps_st\appl\au\12.0.0\bin;
I'd like to install OBIEE on the same server. Obviously, I don't want any path conflicts. And, OBIEE uses a different version of java.
1)
Do all these Apps directories need to remain in the global PATH environment variable? Or, can the directories be removed from the path, and the scripts can be relied on to set the appropriate variables?
Thanks a lot!if you want global settings (always present, even after reboot), you have to edit the autoexec.bat file, e..g
SET CLASSPATH=c:\myclasses
you can set environment variables temporarility in a DOS shell using the same command.
if possible, you should avoid the CLASSPATH environment variable, and use the -cp or -classpath option for java and javac. This helps a lot to solve classpath confusions. -
Hi
I have build an Labview project with FPGA target . I have configured an FPGA VI and an host Vi to acquire data and logged the data to a file and stored the latest data in a global variable simultanously. I have configured one more VI in the same project to access the global variable. I have build a dll to access both the VI as functions in LabWindows/CVI code. My task in CVI is to update configured GUI with latest data periodically and run the host VI continously for a long time and log the data to a file. GUI should update for every one second with latest data for this I am using the second VI in which I am accessing the global varibale in which the latest data has been stored in host VI.Duplicate Post (go here)
-
Accessing environment variables in PL/SQL??
I have two oracle schemas; myenv1 and myenv2. They are both exact copies from each other except for the fact that one is my "developement" environment and the other my "production" environment.
So in each of them I have some packages with PL/SQL code.
I'd like to have an environment variable called PLATFORM (maybe not the best name) that should have the value "devel" in one schema and the value "prod" in the other schema. And I'd like to be able to access this variable in my PL/SQL code so I can slightly change some code or conditionate some code to the production environment only... or stuff like that.
Does anyone know how to do that? (where and how to configure the env. variable)
Any help will be most appreciated.
Thanks!but I'm using the same 'current_user' in both schemas... is there other values I can get with sys_context ?? maybe there's one that would do it... but i think it's not 'current_user' It should be. Consider:
SQL> show user
USER is "SCOTT"
SQL> create or replace function show_user return varchar2
2 as
3 begin
4 return sys_context('userenv','current_user');
5 end show_user;
6 /
Function created.
SQL> select show_user from dual;
SHOW_USER
SCOTT
SQL> grant execute on show_user to test;
Grant succeeded.
SQL> connect test/test
Connected.
SQL> select scott.show_user from dual;
SHOW_USER
SCOTT -
Unable to access value in System Environment Variable using Java
I am using Java code to get the value of a System Environment Variable using the Runtime, Process java classes.
The code works fine in tomcat, but when deployed in 9ias the code is unable to retrieve the value stored in the System environment variable in Windows 2000.Thanks for the comment steve, here is the code which i am using.
public String getEnvironmentVariable()
// This will get the FEDREP_HOME environment variable
String FEDREP_HOME = null;
Process p = null;
Runtime rt = Runtime.getRuntime();
try {
// invokes a shell-command to retrieve FEDREP_HOME variable
String OS = System.getProperty("os.name").toLowerCase();
// Get the Windows 95 environment variable
if (OS.indexOf("windows 9") > -1)
p = rt.exec( "command.com /c echo %FEDREP_HOME%" );
// Get the Windows NT environment variable
else if (OS.indexOf("nt") > -1)
p = rt.exec( "cmd.exe /c echo %FEDREP_HOME%" );
// Get the Windows 2000 environment variable
else if (OS.indexOf("2000") > -1)
p = rt.exec( "cmd.exe /c echo %FEDREP_HOME%" );
// Get the Windows XP environment variable
else if (OS.indexOf("xp") > -1)
p = rt.exec( "cmd.exe /c echo %FEDREP_HOME%" );
// Get the unix environment variable
else if (OS.indexOf("linux") > -1)
p = rt.exec( "sh -c echo $FEDREP_HOME" );
// Get the unix environment variable
else if (OS.indexOf("unix") > -1)
p = rt.exec( "sh -c echo $FEDREP_HOME" );
// Get the unix environment variable
else if (OS.indexOf("sunos") > -1)
p = rt.exec( "sh -c echo $FEDREP_HOME" );
} else
System.out.println("OS not known: " + OS);
// set up to read subprogram output
InputStream is = p.getInputStream();
InputStreamReader isr = new InputStreamReader(is);
BufferedReader br = new BufferedReader(isr);
// read output from subprogram
FEDREP_HOME = br.readLine();
br.close();
} catch(Exception ex)
System.out.println("Error when getting FEDREP_HOME environment variable");
ex.printStackTrace();
return(FEDREP_HOME); -
How to set new Tomcat Environment variable?
I have an imported class used by my servlet that is supposed to look for an environment variable like "xxx.app.logdir". I'm having trouble setting it in Tomcat. I have tried the following (stopping and starting Tomcat with each change):
1) In \conf\server.xml file, adding under <GlobalNamingResources> <Environment name="simpleValue" type="java.lang.Integer" value="30"/>
<Environment name="xxx.app.logdir" type="java.lang.String" value="C:\\Tomcat-4-1\\logs"/>2) In my app's web.xml file <env-entry>
<env-entry-name>xxx.app.logdir</env-entry-name>
<env-entry-value>C:\\Tomcat-4-1\\logs</env-entry-value>
<env-entry-type>java.lang.String</env-entry-type>
</env-entry> 3) In my \bin\startup.bat file
set xxx.app.logdir=C:\\Tomcat-4-1\\
4) On my PC's Environment variables.
Nothing has worked. In my code I have the lines
logMsg("System.getProperty('mmm.app.logdir')=" +
System.getProperty("xxx.app.logdir"));
logMsg("System.getProperty('simpleValue')=" +
System.getProperty("simpleValue")); with the output :System.getProperty('xxx.app.logdir')=null
System.getProperty('simpleValue')=null I've searched forums and the Tomcat docs, but no luck. Any ideas?I tried that as well, but maybe I didn't define my DefaultContect correctly. Do I need any other parameters? Couldn't find it in the Tomcat docs. <DefaultContext>
<Environment name="matt" type="java.lang.String" value="value1" />
</DefaultContext>My new code (I simplified the variable name for testing):
System.out.println("System.getProperty('matt')=" + System.getProperty("matt"));
System.out.println("System.getProperty('MATT')=" + System.getProperty("MATT"));Results:
System.getProperty('matt')=null
System.getProperty('MATT')=null -
Accessing environment variables
Good morning,
I have an implementation of Oracle Application Server 10G using a Shibboleth Service Provider (SP) 2.1 for SSO authentication. The problem I am facing now is to accessing with APEX the environmental variables created by the SP. In my tests I used PHP and everything is working well. However with APEX I only have access to a very limited group of environment variables. Anybody have a suggestion or idea on how to solve this problem?
The variable I need is "Login".
Thank you very much.
hugoHello,
Take a look at this thread, where I answer a similar problem -
Re: Unable to access external HTTP Headers
Hope this helps,
John.
Blog: http://jes.blogs.shellprompt.net
Work: http://www.apex-evangelists.com
Author of Pro Application Express: http://tinyurl.com/3gu7cd
REWARDS: Please remember to mark helpful or correct posts on the forum, not just for my answers but for everyone!
Maybe you are looking for
-
Regarding obselete statements in ECC 6.0 ...plz help uregent
Hi guys... I am importing a program from <b>4.7 to ECC 6.0.</b> When i am checking <b>SLIN errors</b> i am getting followin error.. <b>The current ABAP command is obsolete Field groups cannot be created in the OO context. Internal Message Code: FIELD
-
WebDynpro for ABAP - Icon/Symbol in front of a text
Hello all, in the ABAP stack I would like to insert a R/3-Icon <u>at the beginning of a text-field</u>. I know it is possible to do this in a extra-field but this is not the target here. Example: the text should begin with a green hook-symbol or with
-
Lenovo N500 NS74APB and corrupted sound via HDMI
Hello. I have connected the laptop to TV LCD (Philips PFL7403D/12) with HDMI cable and I noticed corrupted sound. There are noises (crackles) and vanishing sound for seconds. Also when i.e. moving the window between the screens, the crackles occure.
-
Using MB_DOCUMENT_BADI on MB31
Hi, I'm trying to use the BADI MB_DOCUMENT_BADI on MB31 (when saving document) to insert notification number on MKPF-XABLN (GR/GI Slip No). I created an Implementation of the BADI, the class and a method IF_EX_MB_DOCUMENT_BADI~MB_DOCUMENT_UPDATE whe
-
Unable to create new software component
Hello All, I am having these troubles with SLD. 1) I am unable to create products for SAP Systems in the catalog. Whenver I select a new product the message always says new product for non-SAP system. 2) I am unable to create software components for