Re: Reading environment variable from Tomcat
Sureka, Sushil wrote: Hi, I have run into an issue related to starting tomcat as a service. When we were starting tomcat from the command line, we were able to just say System.getProperty("user.name" ) to retrieve the logged in user id. But now that we start tomcat using a service, the get property call returns "SYSTEM". After doing some more research, it seems like I have two options to find out the login id. 1. Start the service using logged on option. 2. Use System.getEnv() It seems like the first option may not work for us as our passwords expires periodically, and setting the logon/password account means that we would have to have manual intervention. Additionally, when I tried use my user id as logon id, it won't let me do that ( I imagine I need to have system admin turn the privilege on for or something on those lines) The second option did not work either. Calling the System.getEnv("USERNAME") in a program started from the command line returns the logged in user name, but it returns null when tomcat was started using service approach. I am not sure if there is a way to find out who is logged in into the system when Tomcat has been started using service mechanism. Any help in this matter would be great help Somewhat related to this: what do you want it to return when nobody is logged on? When it's a service and set to automatic start, the system will run without needing to be logged on (just sitting at the logon prompt)... D - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading environment variable from Tomcat
+1 exactly! you can even login with two different users (if you are using windows server) none of them would be running the service unless you change the logged on option. On Wed, Aug 13, 2008 at 9:27 PM, David kerber <[EMAIL PROTECTED]> wrote: > Sureka, Sushil wrote: > >> Hi, >> >> >> I have run into an issue related to starting tomcat as a service. When >> we were starting tomcat from the command line, we were able to just say >> System.getProperty("user.name" ) to retrieve the logged in user id. But >> now that we start tomcat using a service, the get property call returns >> "SYSTEM". >> >> After doing some more research, it seems like I have two options to find >> out the login id. >> >> >> 1. Start the service using logged on option. >> >> 2. Use System.getEnv() >> >> >> >> It seems like the first option may not work for us as our passwords >> expires periodically, and setting the logon/password account means that >> we would have to have manual intervention. Additionally, when I tried >> use my user id as logon id, it won't let me do that ( I imagine I need >> to have system admin turn the privilege on for or something on those >> lines) >> >> >> The second option did not work either. Calling the >> System.getEnv("USERNAME") in a program started from the command line >> returns the logged in user name, but it returns null when tomcat was >> started using service approach. >> >> I am not sure if there is a way to find out who is logged in into the >> system when Tomcat has been started using service mechanism. Any help in >> this matter would be great help >> >> > Somewhat related to this: what do you want it to return when nobody is > logged on? When it's a service and set to automatic start, the system will > run without needing to be logged on (just sitting at the logon prompt)... > > D > > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Regards, Youssef
RE: Reading environment variable from Tomcat
The service does not need to run when no one is logged in. We are in a kind of one off situation where Tomcat would be running on standalone laptops when the users are not connected to internet. So we are not running it on windows server rather on windows xp. I saw the other reply but I am not sure if I understand how to make that work. I just tried the option of adding --User in the service.bat specifying my user id, but it did not work. Also as I mentioned in my original email, the password issue will remain as a problem even if we get past the first issue. SS -Original Message- From: David kerber [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 1:27 PM To: Tomcat Users List Subject: Re: Reading environment variable from Tomcat Sureka, Sushil wrote: > Hi, > > > > I have run into an issue related to starting tomcat as a service. When > we were starting tomcat from the command line, we were able to just say > System.getProperty("user.name" ) to retrieve the logged in user id. But > now that we start tomcat using a service, the get property call returns > "SYSTEM". > > > > After doing some more research, it seems like I have two options to find > out the login id. > > > > 1. Start the service using logged on option. > > 2. Use System.getEnv() > > > > > > It seems like the first option may not work for us as our passwords > expires periodically, and setting the logon/password account means that > we would have to have manual intervention. Additionally, when I tried > use my user id as logon id, it won't let me do that ( I imagine I need > to have system admin turn the privilege on for or something on those > lines) > > > > The second option did not work either. Calling the > System.getEnv("USERNAME") in a program started from the command line > returns the logged in user name, but it returns null when tomcat was > started using service approach. > > > > I am not sure if there is a way to find out who is logged in into the > system when Tomcat has been started using service mechanism. Any help in > this matter would be great help > Somewhat related to this: what do you want it to return when nobody is logged on? When it's a service and set to automatic start, the system will run without needing to be logged on (just sitting at the logon prompt)... D - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading environment variable from Tomcat
I responded to this in another email. Youssef, I would appreciate if you can provide your input (I am just trying to consolidate my answer in one email for better readability) -Original Message- From: Youssef Mohammed [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 1:33 PM To: Tomcat Users List Subject: Re: Reading environment variable from Tomcat +1 exactly! you can even login with two different users (if you are using windows server) none of them would be running the service unless you change the logged on option. On Wed, Aug 13, 2008 at 9:27 PM, David kerber <[EMAIL PROTECTED]> wrote: > Sureka, Sushil wrote: > >> Hi, >> >> >> I have run into an issue related to starting tomcat as a service. When >> we were starting tomcat from the command line, we were able to just say >> System.getProperty("user.name" ) to retrieve the logged in user id. But >> now that we start tomcat using a service, the get property call returns >> "SYSTEM". >> >> After doing some more research, it seems like I have two options to find >> out the login id. >> >> >> 1. Start the service using logged on option. >> >> 2. Use System.getEnv() >> >> >> >> It seems like the first option may not work for us as our passwords >> expires periodically, and setting the logon/password account means that >> we would have to have manual intervention. Additionally, when I tried >> use my user id as logon id, it won't let me do that ( I imagine I need >> to have system admin turn the privilege on for or something on those >> lines) >> >> >> The second option did not work either. Calling the >> System.getEnv("USERNAME") in a program started from the command line >> returns the logged in user name, but it returns null when tomcat was >> started using service approach. >> >> I am not sure if there is a way to find out who is logged in into the >> system when Tomcat has been started using service mechanism. Any help in >> this matter would be great help >> >> > Somewhat related to this: what do you want it to return when nobody is > logged on? When it's a service and set to automatic start, the system will > run without needing to be logged on (just sitting at the logon prompt)... > > D > > > > - > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > > -- Regards, Youssef - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading environment variable from Tomcat
Looks like correct behavior to me. You can see that tomcat runs in the System account when you look at it via Process Explorer or Task Manager. It has it's own environment separate from any desktop user and can run without any desktop user. This is also why tomcat can't access mapped network drives when it runs as a service. The real question is why do you want to know who the current desktop user(s) is/are? Tomcat should only be interested in the users coming in via http(s) connections. --David Sureka, Sushil wrote: Hi, I have run into an issue related to starting tomcat as a service. When we were starting tomcat from the command line, we were able to just say System.getProperty("user.name" ) to retrieve the logged in user id. But now that we start tomcat using a service, the get property call returns "SYSTEM". After doing some more research, it seems like I have two options to find out the login id. 1. Start the service using logged on option. 2. Use System.getEnv() It seems like the first option may not work for us as our passwords expires periodically, and setting the logon/password account means that we would have to have manual intervention. Additionally, when I tried use my user id as logon id, it won't let me do that ( I imagine I need to have system admin turn the privilege on for or something on those lines) The second option did not work either. Calling the System.getEnv("USERNAME") in a program started from the command line returns the logged in user name, but it returns null when tomcat was started using service approach. I am not sure if there is a way to find out who is logged in into the system when Tomcat has been started using service mechanism. Any help in this matter would be great help SS - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading environment variable from Tomcat
Because we are using the app more like a standalone application (for details please see my another posting). Generally these sort of app are not meant for tomcat, but we already had the app developed for central server, and we had a need to run the same app in a standalone mode for folks who are not connected to internet. Hence we took the same code base (with lot less fat) and ported it on tomcat. -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 1:47 PM To: Tomcat Users List Subject: Re: Reading environment variable from Tomcat Looks like correct behavior to me. You can see that tomcat runs in the System account when you look at it via Process Explorer or Task Manager. It has it's own environment separate from any desktop user and can run without any desktop user. This is also why tomcat can't access mapped network drives when it runs as a service. The real question is why do you want to know who the current desktop user(s) is/are? Tomcat should only be interested in the users coming in via http(s) connections. --David Sureka, Sushil wrote: > Hi, > > > > I have run into an issue related to starting tomcat as a service. When > we were starting tomcat from the command line, we were able to just say > System.getProperty("user.name" ) to retrieve the logged in user id. But > now that we start tomcat using a service, the get property call returns > "SYSTEM". > > > > After doing some more research, it seems like I have two options to find > out the login id. > > > > 1. Start the service using logged on option. > > 2. Use System.getEnv() > > > > > > It seems like the first option may not work for us as our passwords > expires periodically, and setting the logon/password account means that > we would have to have manual intervention. Additionally, when I tried > use my user id as logon id, it won't let me do that ( I imagine I need > to have system admin turn the privilege on for or something on those > lines) > > > > The second option did not work either. Calling the > System.getEnv("USERNAME") in a program started from the command line > returns the logged in user name, but it returns null when tomcat was > started using service approach. > > > > I am not sure if there is a way to find out who is logged in into the > system when Tomcat has been started using service mechanism. Any help in > this matter would be great help > > > > SS > > - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading environment variable from Tomcat
> From: Sureka, Sushil [mailto:[EMAIL PROTECTED] > Subject: RE: Reading environment variable from Tomcat > > Because we are using the app more like a standalone application Then don't run it as a service, just put the startup script call in: C:\Documents and Settings\[userid]\Start Menu\Programs\Startup This will start Tomcat when the user logs on and run it under that user account. There's also a registry key you can use if you don't want to expose the script in the above directory. - Chuck THIS COMMUNICATION MAY CONTAIN CONFIDENTIAL AND/OR OTHERWISE PROPRIETARY MATERIAL and is thus for use only by the intended recipient. If you received this in error, please contact the sender and delete the e-mail and its attachments from all computers. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading environment variable from Tomcat
Then I think you'll have to have tomcat startup in the Startup program group or equivalent in the registry and shutdown when the user log's out. That will put tomcat in the user's environment and make it run as the current desktop user. --David Sureka, Sushil wrote: Because we are using the app more like a standalone application (for details please see my another posting). Generally these sort of app are not meant for tomcat, but we already had the app developed for central server, and we had a need to run the same app in a standalone mode for folks who are not connected to internet. Hence we took the same code base (with lot less fat) and ported it on tomcat. -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 1:47 PM To: Tomcat Users List Subject: Re: Reading environment variable from Tomcat Looks like correct behavior to me. You can see that tomcat runs in the System account when you look at it via Process Explorer or Task Manager. It has it's own environment separate from any desktop user and can run without any desktop user. This is also why tomcat can't access mapped network drives when it runs as a service. The real question is why do you want to know who the current desktop user(s) is/are? Tomcat should only be interested in the users coming in via http(s) connections. --David Sureka, Sushil wrote: Hi, I have run into an issue related to starting tomcat as a service. When we were starting tomcat from the command line, we were able to just say System.getProperty("user.name" ) to retrieve the logged in user id. But now that we start tomcat using a service, the get property call returns "SYSTEM". After doing some more research, it seems like I have two options to find out the login id. 1. Start the service using logged on option. 2. Use System.getEnv() It seems like the first option may not work for us as our passwords expires periodically, and setting the logon/password account means that we would have to have manual intervention. Additionally, when I tried use my user id as logon id, it won't let me do that ( I imagine I need to have system admin turn the privilege on for or something on those lines) The second option did not work either. Calling the System.getEnv("USERNAME") in a program started from the command line returns the logged in user name, but it returns null when tomcat was started using service approach. I am not sure if there is a way to find out who is logged in into the system when Tomcat has been started using service mechanism. Any help in this matter would be great help SS - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading environment variable from Tomcat
This was going to be my suggestion as well: have it start after a user logs in, via either the Run registry entry, or the startup group on the start menu. D David Smith wrote: Then I think you'll have to have tomcat startup in the Startup program group or equivalent in the registry and shutdown when the user log's out. That will put tomcat in the user's environment and make it run as the current desktop user. --David Sureka, Sushil wrote: Because we are using the app more like a standalone application (for details please see my another posting). Generally these sort of app are not meant for tomcat, but we already had the app developed for central server, and we had a need to run the same app in a standalone mode for folks who are not connected to internet. Hence we took the same code base (with lot less fat) and ported it on tomcat. -Original Message- From: David Smith [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2008 1:47 PM To: Tomcat Users List Subject: Re: Reading environment variable from Tomcat Looks like correct behavior to me. You can see that tomcat runs in the System account when you look at it via Process Explorer or Task Manager. It has it's own environment separate from any desktop user and can run without any desktop user. This is also why tomcat can't access mapped network drives when it runs as a service. The real question is why do you want to know who the current desktop user(s) is/are? Tomcat should only be interested in the users coming in via http(s) connections. --David Sureka, Sushil wrote: Hi, I have run into an issue related to starting tomcat as a service. When we were starting tomcat from the command line, we were able to just say System.getProperty("user.name" ) to retrieve the logged in user id. But now that we start tomcat using a service, the get property call returns "SYSTEM". After doing some more research, it seems like I have two options to find out the login id. 1. Start the service using logged on option. 2. Use System.getEnv() It seems like the first option may not work for us as our passwords expires periodically, and setting the logon/password account means that we would have to have manual intervention. Additionally, when I tried use my user id as logon id, it won't let me do that ( I imagine I need to have system admin turn the privilege on for or something on those lines) The second option did not work either. Calling the System.getEnv("USERNAME") in a program started from the command line returns the logged in user name, but it returns null when tomcat was started using service approach. I am not sure if there is a way to find out who is logged in into the system when Tomcat has been started using service mechanism. Any help in this matter would be great help SS - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: Reading environment variable from Tomcat
environment variables and system properties are REALLY basic and pretty easy to figure out you may want to create keystores and Implement via a SSL connector.. http://tomcat.apache.org/tomcat-4.0-doc/ssl-howto.html Here is an option which has a wide range of options from basic form to XML Authenticate to JDBC *using Database to divine a password which will hash to the same option as supplied username* to more advanced SSL options http://www.caucho.com/resin-3.0/security/authentication.xtp Good Stuff Martin __ Disclaimer and confidentiality note Everything in this e-mail and any attachments relates to the official business of Sender. This transmission is of a confidential nature and Sender does not endorse distribution to any party other than intended recipient. Sender does not necessarily endorse content contained within this transmission. > Date: Wed, 13 Aug 2008 21:33:13 +0300 > From: [EMAIL PROTECTED] > To: users@tomcat.apache.org > Subject: Re: Reading environment variable from Tomcat > > +1 > exactly! you can even login with two different users (if you are using > windows server) none of them would be running the service unless you change > the logged on option. > > On Wed, Aug 13, 2008 at 9:27 PM, David kerber <[EMAIL PROTECTED]> wrote: > > > Sureka, Sushil wrote: > > > >> Hi, > >> > >> > >> I have run into an issue related to starting tomcat as a service. When > >> we were starting tomcat from the command line, we were able to just say > >> System.getProperty("user.name" ) to retrieve the logged in user id. But > >> now that we start tomcat using a service, the get property call returns > >> "SYSTEM". > >> > >> After doing some more research, it seems like I have two options to find > >> out the login id. > >> > >> > >> 1. Start the service using logged on option. > >> > >> 2. Use System.getEnv() > >> > >> > >> > >> It seems like the first option may not work for us as our passwords > >> expires periodically, and setting the logon/password account means that > >> we would have to have manual intervention. Additionally, when I tried > >> use my user id as logon id, it won't let me do that ( I imagine I need > >> to have system admin turn the privilege on for or something on those > >> lines) > >> > >> > >> The second option did not work either. Calling the > >> System.getEnv("USERNAME") in a program started from the command line > >> returns the logged in user name, but it returns null when tomcat was > >> started using service approach. > >> > >> I am not sure if there is a way to find out who is logged in into the > >> system when Tomcat has been started using service mechanism. Any help in > >> this matter would be great help > >> > >> > > Somewhat related to this: what do you want it to return when nobody is > > logged on? When it's a service and set to automatic start, the system will > > run without needing to be logged on (just sitting at the logon prompt)... > > > > D > > > > > > > > - > > To start a new topic, e-mail: users@tomcat.apache.org > > To unsubscribe, e-mail: [EMAIL PROTECTED] > > For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > -- > Regards, Youssef _ Get more from your digital life. Find out how. http://www.windowslive.com/default.html?ocid=TXT_TAGLM_WL_Home2_082008
Re: Reading environment variable from Tomcat
- Original Message - From: "Sureka, Sushil" <[EMAIL PROTECTED]> To: Sent: Wednesday, August 13, 2008 8:16 PM Subject: Reading environment variable from Tomcat Hi, I have run into an issue related to starting tomcat as a service. When we were starting tomcat from the command line, we were able to just say System.getProperty("user.name" ) to retrieve the logged in user id. But now that we start tomcat using a service, the get property call returns "SYSTEM". After doing some more research, it seems like I have two options to find out the login id. 1. Start the service using logged on option. 2. Use System.getEnv() It seems like the first option may not work for us as our passwords expires periodically, and setting the logon/password account means that we would have to have manual intervention. Additionally, when I tried use my user id as logon id, it won't let me do that ( I imagine I need to have system admin turn the privilege on for or something on those lines) The second option did not work either. Calling the System.getEnv("USERNAME") in a program started from the command line returns the logged in user name, but it returns null when tomcat was started using service approach. I am not sure if there is a way to find out who is logged in into the system when Tomcat has been started using service mechanism. Any help in this matter would be great help SS --- Sureka, A service is like a completely diff user, eg you dont even have to log into a machine and it will run, thus it defaults to SYSTEM, and you can change it, but its always a diff user... You could possibly do some tricks like call some MS functions, but you see the immediate problem is the service is already running long before anyone has logged in... so when would you do that... Here a thought... MS has a RUN folder, what ever you put in there starts when the user starts... so you can hook it up that way... ... but the big question is... why are you doing it, and why are you even assuming anyone is logged in... Before you make work for yourself... maybe bouncing the concept off the guru's in here is a good idea... what it is you actually trying to do? Your Java stuff wont work because all that stuff you looking for is setup as the VM starts... the service has a diff one to whatever the user is doing... Normally a user would be logging into TC itself... and thus TC would know who it is... Have fun ;) --- HARBOR : http://www.kewlstuff.co.za/index.htm The most powerful application server on earth. The only real POJO Application Server. See it in Action : http://www.kewlstuff.co.za/cd_tut_swf/whatisejb1.htm --- - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Reading environment variable from Tomcat
David kerber wrote: Sureka, Sushil wrote: Hi, I have run into an issue related to starting tomcat as a service. When we were starting tomcat from the command line, we were able to just say System.getProperty("user.name" ) to retrieve the logged in user id. But now that we start tomcat using a service, the get property call returns "SYSTEM". I saw all the other answers, but I would just like to point out clearky that what you mention above is *normal*. System.getProperty("user.name") will return "SYSTEM" when you start Tomcat as a service under Windows, because "SYSTEM" is the user name under which Tomcat then starts. Right-click on the "My computer" icon, then "Manage.." then "services and applications", then "services". Locate the Tomcat service in the list on the right, and right-click on it, choose "Properties". The second tab shows under which user-id the Tomcat Service is started. By default, it will say something like "LocalSystem" (which is an alias for "SYSTEM"). That is the user-id under which the service is running. In the same tab, you can change it, and set it to the user-id you want. Now, if you want to run Tomcat as a different user each time someone logs on to the laptop, that's a different story, for which you already got tips from other people. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]