JAVA:ThreadGroup.getParent() 上的 SecurityException
我有一些漂亮的样板 Java 代码,它使用 tg.getParent() 执行 while 循环来获取根线程组。它已经在四种不同的环境(一个 Windows 和三个 Linux)上运行了几个月。最近,我们为访问验证测试添加了第五个环境。这个环境应该尽可能地复制我们的生产环境。开发人员对该系统的访问非常有限,并且我们的托管组花费了数周的时间来设置系统以获得所有正确的权限和属性。
现在几乎一切都正常了,但是今天,当测试人员转到应用程序中执行上述 getRootThreadGroup() 方法的部分时,对 ThreadGroup.getParent() 的调用显然引发了 SecurityException。我没有太多详细信息,因为目前我无法找到应用程序日志文件。但我 99.99% 确信这里发生了 SecurityException。我查看了 SecurityException 和 getParent() 和 checkAccess() 等的 javadoc,但它们对我来说没有多大意义。
任何人都可以想到一个简单的原因,为什么这个新环境会导致我们的应用程序在此调用上抛出 SecurityException,而在任何其他环境中从未观察到这种情况(并且代码在所有其他环境中肯定会毫无例外地执行)?我的直觉是,不知何故,应用程序的运行时用户没有“某些东西”的权限...
哦,它运行在带有 java 1.6 (jrockit-jdk) 的 Bea Weblogic 服务器上,但它的配置应该完全相同和其他环境一样。
感谢您的任何帮助。
I have some pretty boilerplate Java code that does a while loop with a tg.getParent() to get the root thread group. This has been working for several months on four different environments (one Windows and three Linux). Recently we added a fifth environment for our Accessment Validation testing. This environment is supposed to be a replica of our production environment as much as possible. The developers have very limited access to this system, and it's been a multi-week process getting the system set up by our hosting group to have all the correct permissions and properties.
Just about everything is now working, however today, when the tester went to the part of the application that exercises the getRootThreadGroup() method mentioned above, the call to ThreadGroup.getParent() apparently threw a SecurityException. I don't have a lot of details because at the moment I haven't been able to locate the application log file. But I am 99.99% sure that a SecurityException occurred here. I've looked at the javadoc for SecurityException and getParent() and checkAccess(), etc, but none of it is making a lot of sense to me.
Can anyone think of a simple reason why this new environment would cause our application to throw a SecurityException on this call when this has never been observed on any other environments (and the code definitely gets executed without exception on all the other environments)? My gut feeling is that somehow the runtime user for the application doesn't have permissions to "something" ...
Oh, it's running on a Bea Weblogic server with java 1.6 (jrockit-jdk), but it should be configured exactly the same as the other environments.
Thanks for any help.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来像是正在使用安全管理器。如果您编写一个简单的程序来执行
Thread.currentThread().getThreadGroup().getParent()
并使用-Djava.security.manager
运行它,您将看到:Sounds like a security manager is being used. If you write a simple program to execute
Thread.currentThread().getThreadGroup().getParent()
and run it with-Djava.security.manager
, you will see:没关系。我发现问题实际上是缺少数据库列。今天早上我花了两个小时终于找到了日志,一旦找到了,找到实际问题就很简单了。
Never mind. I found that the problem was actually a missing database column. It took me two hours this morning to finally locate the log, and once I found that, it was very simple to find the actual problem.