Re: UnauthorizedAccessException error while running WMI in tomcat
Thanks a lot Popo..It worked :-) Mr Popo Sama wrote: HI agn, to change the privilegies try doing this, in vista: go to control panel administrative tools Services , then look for Apache tomcat service , then go to properties (right click on the service) Log on (tab) this account. and you the spaces in with a super user name and pass. then you'll have to restart the service (or the machine, don't know). in xp... don't know but must be preety much like in vista Bye! - Mensaje original De: Tommy Pham [EMAIL PROTECTED] Para: Tomcat Users List users@tomcat.apache.org Enviado: lunes 8 de septiembre de 2008, 4:28:29 Asunto: Re: UnauthorizedAccessException error while running WMI in tomcat --- On Mon, 9/8/08, new_bie_tomcat [EMAIL PROTECTED] wrote: From: new_bie_tomcat [EMAIL PROTECTED] Subject: Re: UnauthorizedAccessException error while running WMI in tomcat To: users@tomcat.apache.org Date: Monday, September 8, 2008, 3:06 AM Hi Mark, Thanks a lot for your reply. I am not able to find out exactly where to change the permission. I am using Tomcat 5.5. I have logged in to the machine, using the same user login as the remote machine. Both of the machine are in the same domain. In tomcat Properties Log on Tab i have logged in as the same login ID of the local/ remote machine. But still i am getting the same error.Please let me know where exactly i need to configure properly. Thanks again.. Hi, Since you're in the domain and if my memory serves correctly (it's been a while since I worked w/ windows domains), you'll need to have proper access rights to access the registry. Not all WMI commands will work with User/Power User rights. You'll need full Administrator's rights on the target system if you want to use WMI to it's fullest. You may want to check your domain policy and the local systems' policy (if any is defined). Logging into a machine does not mean that account have the appropriate access rights, especially if you're trying access HKLM, HKCR, and HKUSERS. You may want to look into impersonation to lessen the security risk of unwanted full domain access ;) Regards, Tommy - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] Yahoo! Cocina Recetas prácticas y comida saludable http://ar.mujer.yahoo.com/cocina/ - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] :clap::clap::clap::clap::clap::clap::jumping::jumping::clap::clap::clap::clap::clap::clap::clap::clap::clap::clap::clap: -- View this message in context: http://www.nabble.com/UnauthorizedAccessException-error-while-running-WMI-in-tomcat-tp19365845p19406260.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: UnauthorizedAccessException error while running WMI in tomcat
Hi Mark, Thanks a lot for your reply. I am not able to find out exactly where to change the permission. I am using Tomcat 5.5. I have logged in to the machine, using the same user login as the remote machine. Both of the machine are in the same domain. In tomcat Properties Log on Tab i have logged in as the same login ID of the local/ remote machine. But still i am getting the same error.Please let me know where exactly i need to configure properly. Thanks again.. Mark Thomas-18 wrote: new_bie_tomcat wrote: Please let me know if any configuration is needed in Tomcat to support this? You need to run Tomcat under a user that has the permissions to perform the action you are trying to perform. If you are running Tomcat as a service, the default LocalSystem user will not have this permission. Mark - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/UnauthorizedAccessException-error-while-running-WMI-in-tomcat-tp19365845p19366919.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: UnauthorizedAccessException error while running WMI in tomcat
Thanks for your reply.You are absolutely right. This error is a .NET Exception.I am not able to figure out exactly where in Tomcat i need to provide the priviledge.I have logged in to the machine with the same login id as the remote machine. In the Tomcat logon tab i have mentioned the same login id and password. But still i am getting the same errror.Please let me know what changes are needed to be done in tomcat. Thanks.. Mr Popo Sama wrote: Ok, first of all, i'm quite sure that exception does not exist in Java nor in Tomcat! (as far as I know it's not in the apis), yet it does exists in .Net. So my gess is that it's a .Net exception after all and you are just reading it from the console. you may want to try giving more privileges to the tomcat service so that it run's the .net program with more privileges too. BYE! ps: excuse my english, it's not my mother's tonge. - Mensaje original De: new_bie_tomcat [EMAIL PROTECTED] Para: users@tomcat.apache.org Enviado: lunes 8 de septiembre de 2008, 1:59:04 Asunto: UnauthorizedAccessException error while running WMI in tomcat I have written the following code in Java to access registry of a remote machine. I am able to execute the program successfully when i run the program separately. But when I try to execute the code in Apache Tomcat. I am getting UnauthorizedAccessException error.The full text of error is System.UnauthorizedAccessException: Access to the registry key is denied. at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(RegistryHive hKey, String machineName) at BOMInfoCollector.BOMInfoCollector.getOSVersion(StreamWriter file, String remoteName) Following is the Java code: try { String keykey = C:\\Diagnostic\\DiagnosticAssayRE\\Executable\\BOMInfoCollector.exe; String ipadddress = Remote machine's IP; String keyStr1= keykey + + ipadddress; Process p = Runtime.getRuntime().exec(keyStr1); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output from the command while ((s = stdInput.readLine()) != null) { response = response + s +\n; } while ((s = stdError.readLine()) != null) { response = response + s +\n; System.out.println(s); }}catch(Exception e){ System.out.println(Exception occured +e); } Following is the C# code whose name is string osKeyName = SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion; try{ RegistryKey hklm = RegistryKey.OpenRemoteBaseKey( RegistryHive.LocalMachine, remoteName); RegistryKey osKey = hklm.OpenSubKey(osKeyName); if(osKey != null) { object prodName = osKey.GetValue(ProductName); Console.WriteLine(OSName= + prodName); } Console.WriteLine(Exiting getOSVersion() method); }catch(System.UnauthorizedAccessException e){ Console.WriteLine(You are not authorized to access the machine.Please check the network Privileges +e); }catch(Exception e){ Console.WriteLine(Error occured +e); } Please let me know if any configuration is needed in Tomcat to support this? -- View this message in context: http://www.nabble.com/UnauthorizedAccessException-error-while-running-WMI-in-tomcat-tp19365845p19365845.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] ¡Buscá desde tu celular! Yahoo! oneSEARCH ahora está en Claro http://ar.mobile.yahoo.com/onesearch - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] -- View this message in context: http://www.nabble.com/UnauthorizedAccessException-error-while-running-WMI-in-tomcat-tp19365845p19366950.html Sent from the Tomcat - User mailing list archive at Nabble.com. - 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: UnauthorizedAccessException error while running WMI in tomcat
hi.. Thanks a lot for your reply. I am not able to figure out exactly where in Tomcat i need to provide the priviledge.I have logged in to the machine with the same login id as the remote machine. In the Tomcat logon tab i have mentioned the same login id and password. But still i am getting the same errror.Please let me know what changes are needed to be done in tomcat. How can i turn off, or on the WMI priviledges? Thanks. Johnny Kewl wrote: - Original Message - From: new_bie_tomcat [EMAIL PROTECTED] To: users@tomcat.apache.org Sent: Monday, September 08, 2008 6:59 AM Subject: UnauthorizedAccessException error while running WMI in tomcat I have written the following code in Java to access registry of a remote machine. I am able to execute the program successfully when i run the program separately. But when I try to execute the code in Apache Tomcat. I am getting UnauthorizedAccessException error.The full text of error is System.UnauthorizedAccessException: Access to the registry key is denied. at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(RegistryHive hKey, String machineName) at BOMInfoCollector.BOMInfoCollector.getOSVersion(StreamWriter file, String remoteName) Following is the Java code: try { String keykey = C:\\Diagnostic\\DiagnosticAssayRE\\Executable\\BOMInfoCollector.exe; String ipadddress = Remote machine's IP; String keyStr1= keykey + + ipadddress; Process p = Runtime.getRuntime().exec(keyStr1); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output from the command while ((s = stdInput.readLine()) != null) { response = response + s +\n; } while ((s = stdError.readLine()) != null) { response = response + s +\n; System.out.println(s); }}catch(Exception e){ System.out.println(Exception occured +e); } Following is the C# code whose name is string osKeyName = SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion; try{ RegistryKey hklm = RegistryKey.OpenRemoteBaseKey( RegistryHive.LocalMachine, remoteName); RegistryKey osKey = hklm.OpenSubKey(osKeyName); if(osKey != null) { object prodName = osKey.GetValue(ProductName); Console.WriteLine(OSName= + prodName); } Console.WriteLine(Exiting getOSVersion() method); }catch(System.UnauthorizedAccessException e){ Console.WriteLine(You are not authorized to access the machine.Please check the network Privileges +e); }catch(Exception e){ Console.WriteLine(Error occured +e); } Please let me know if any configuration is needed in Tomcat to support this? -- View this message in context: http://www.nabble.com/UnauthorizedAccessException-error-while-running-WMI-in-tomcat-tp19365845p19365845.html Sent from the Tomcat - User mailing list archive at Nabble.com. Its Just a user permission thing... you starting a process in the name of System (See Tomcat service settings) and that users doesnt have permission to Access WMI... WMI priviledges can be turned off, or on... If you run Tomcat from the BAT file... it will probably work... Solution, use a user in the service that has permission to run WMI... Interesting way you using for inter-app comms ;) Sort of a Micro-Perl ;) 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] -- View this message in context: http://www.nabble.com/UnauthorizedAccessException-error-while-running-WMI-in-tomcat-tp19365845p19366973.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
UnauthorizedAccessException error while running WMI in tomcat
I have written the following code in Java to access registry of a remote machine. I am able to execute the program successfully when i run the program separately. But when I try to execute the code in Apache Tomcat. I am getting UnauthorizedAccessException error.The full text of error is System.UnauthorizedAccessException: Access to the registry key is denied. at Microsoft.Win32.RegistryKey.Win32Error(Int32 errorCode, String str) at Microsoft.Win32.RegistryKey.OpenRemoteBaseKey(RegistryHive hKey, String machineName) at BOMInfoCollector.BOMInfoCollector.getOSVersion(StreamWriter file, String remoteName) Following is the Java code: try { String keykey = C:\\Diagnostic\\DiagnosticAssayRE\\Executable\\BOMInfoCollector.exe; String ipadddress = Remote machine's IP; String keyStr1= keykey + + ipadddress; Process p = Runtime.getRuntime().exec(keyStr1); BufferedReader stdInput = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader stdError = new BufferedReader(new InputStreamReader(p.getErrorStream())); // read the output from the command while ((s = stdInput.readLine()) != null) { response = response + s +\n; } while ((s = stdError.readLine()) != null) { response = response + s +\n; System.out.println(s); }}catch(Exception e){ System.out.println(Exception occured +e); } Following is the C# code whose name is string osKeyName = SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion; try{ RegistryKey hklm = RegistryKey.OpenRemoteBaseKey( RegistryHive.LocalMachine, remoteName); RegistryKey osKey = hklm.OpenSubKey(osKeyName); if(osKey != null) { object prodName = osKey.GetValue(ProductName); Console.WriteLine(OSName= + prodName); } Console.WriteLine(Exiting getOSVersion() method); }catch(System.UnauthorizedAccessException e){ Console.WriteLine(You are not authorized to access the machine.Please check the network Privileges +e); }catch(Exception e){ Console.WriteLine(Error occured +e); } Please let me know if any configuration is needed in Tomcat to support this? -- View this message in context: http://www.nabble.com/UnauthorizedAccessException-error-while-running-WMI-in-tomcat-tp19365845p19365845.html Sent from the Tomcat - User mailing list archive at Nabble.com. - To start a new topic, e-mail: users@tomcat.apache.org To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]