Weblogic在虚拟机(VirtualBox和VMware)下启动缓慢(需要11分钟)

18

(已解决!通过伪造系统随机生成器,详见下文)

我正在为我的开发/构建团队设置一个虚拟机镜像。在该虚拟机中应该运行一个Weblogic域。我使用的是Ubuntu服务器发行版,WLS 9.2MP3 + ALSB。

一切都正常工作,速度相当快,但是在启动时,WLS会停止两次,每次停顿时间可测量,总共约有10分钟的延迟。对于需要服务器重启的部署任务来说,这非常令人烦恼。:-(

睡眠时间不是恒定的,有时服务器启动得非常快,有时一般,有时10分钟或更长时间。

有趣的是,如果我在查看停止的服务器时按Enter键,它会更快地唤醒,有时几秒钟后就能启动。当在VM中执行时,WLST(Weblogic Jython shell)也会挂起相当长的时间。虽然它不会响应Enter键。

这里一定有一些开发人员使用VM运行WLS。我想知道其他人是否有同样的问题?有人能够解决吗?

以下是服务器输出(只供参考):

Java(TM) 2 Runtime Environment, Standard Edition (build 1.5.0_12-b04)
Java HotSpot(TM) Client VM (build 1.5.0_12-b04, mixed mode)
Starting WLS with line:
/shared2/beahome/jdk150_12/bin/java -client   -Xmx256m  -XX:MaxPermSize=128m  -Xverify:none  -da -Dplatform.home=/shared2/beahome/weblogic92
 -Dwls.home=/shared2/beahome/weblogic92/server -Dwli.home=/shared2/beahome/weblogic92/integration  -Dweblogic.management.discover=true  -Dwl
w.iterativeDev= -Dwlw.testConsole= -Dwlw.logErrorsToConsole= -Dweblogic.ext.dirs=/shared2/beahome/patch_weblogic923/profiles/default/sysext_
manifest_classpath -Dweblogic.management.username=admin -Dweblogic.management.password=wlsadmin -Dweblogic.Name=LOGMGR-admin -Djava.security
.policy=/shared2/beahome/weblogic92/server/lib/weblogic.policy   weblogic.Server
<1-Apr-2010 12:47:22 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000395> <Following extensions directory contents added to the end
of the classpath:
/shared2/beahome/weblogic92/platform/lib/p13n/p13n-schemas.jar:/shared2/beahome/weblogic92/platform/lib/p13n/p13n_common.jar:/shared2/beahom
e/weblogic92/platform/lib/p13n/p13n_system.jar:/shared2/beahome/weblogic92/platform/lib/wlp/netuix_common.jar:/shared2/beahome/weblogic92/pl
atform/lib/wlp/netuix_schemas.jar:/shared2/beahome/weblogic92/platform/lib/wlp/netuix_system.jar:/shared2/beahome/weblogic92/platform/lib/wl
p/wsrp-common.jar>
<1-Apr-2010 12:47:22 o'clock PM GMT-05:00> <Info> <WebLogicServer> <BEA-000377> <Starting WebLogic Server with Java HotSpot(TM) Client VM Ve
rsion 1.5.0_12-b04 from Sun Microsystems Inc.>
<1-Apr-2010 12:47:23 o'clock PM GMT-05:00> <Info> <Management> <BEA-141107> <Version: WebLogic Server 9.2 MP3  Mon Mar 10 08:28:41 EDT 2008
1096261 >
<1-Apr-2010 12:47:25 o'clock PM GMT-05:00> <Info> <WebLogicServer> <BEA-000215> <Loaded License : /shared2/beahome/license.bea>
<1-Apr-2010 12:47:25 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<1-Apr-2010 12:47:25 o'clock PM GMT-05:00> <Info> <WorkManager> <BEA-002900> <Initializing self-tuning thread pool>
<1-Apr-2010 12:47:25 o'clock PM GMT-05:00> <Notice> <Log Management> <BEA-170019> <The server log file /shared2/wldomains/beaadmd/LOGMGR/ser
vers/LOGMGR-admin/logs/LOGMGR-admin.log is opened. All server side log events will be written to this file.>

这里我们有第一个延迟,最多达到5分钟...

<1-Apr-2010 12:53:21 o'clock PM GMT-05:00> <Notice> <Security> <BEA-090082> <Security initializing using security realm myrealm.>
<1-Apr-2010 12:53:24 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STANDBY>
<1-Apr-2010 12:53:24 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to STARTING>
<1-Apr-2010 12:53:25 o'clock PM GMT-05:00> <Notice> <Log Management> <BEA-170027> <The server initialized the domain log broadcaster success
fully. Log messages will now be broadcasted to the domain log.>
<1-Apr-2010 12:53:25 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to ADMIN>
<1-Apr-2010 12:53:25 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RESUMING>
<1-Apr-2010 12:53:28 o'clock PM GMT-05:00> <Notice> <Security> <BEA-090171> <Loading the identity certificate and private key stored under t
he alias adminuialias from the jks keystore file /shared2/wldomains/beaadmd/LOGMGR/CustomIdentity.jks.>

这里是第二个,同样长达5分钟。


<1-Apr-2010 12:58:56 o'clock PM GMT-05:00> <Notice> <Security> <BEA-090169> <Loading trusted certificates from the jks keystore file /shared
2/wldomains/beaadmd/LOGMGR/CustomTrust.jks.>
<1-Apr-2010 12:58:57 o'clock PM GMT-05:00> <Notice> <Server> <BEA-002613> <Channel "DefaultSecure" is now listening on 192.168.56.102:7002 f
or protocols iiops, t3s, ldaps, https.>
<1-Apr-2010 12:58:57 o'clock PM GMT-05:00> <Notice> <Server> <BEA-002613> <Channel "Default" is now listening on 192.168.56.102:8012 for pro
tocols iiop, t3, ldap, http.>
<1-Apr-2010 12:58:57 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000331> <Started WebLogic Admin Server "LOGMGR-admin" for domain "
LOGMGR" running in Development Mode>
<1-Apr-2010 12:58:57 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000365> <Server state changed to RUNNING>
<1-Apr-2010 12:58:57 o'clock PM GMT-05:00> <Notice> <WebLogicServer> <BEA-000360> <Server started in RUNNING mode>

更新

我认为我找到了问题所在:可能是随机种子的初始化。这可能解释了为什么生成键盘事件会释放服务器。我已经进行了线程转储,一个线程处于可运行状态,但正在等待:

"[STANDBY] ExecuteThread: '1' for queue: 'weblogic.kernel.Default (self-tuning)'" daemon prio=1 tid=0x0a7b06e8 nid=0xeda runnable [0x728a500
0..0x728a6d80]
        at java.io.FileInputStream.readBytes(Native Method)
        at java.io.FileInputStream.read(FileInputStream.java:194)
        at sun.security.provider.NativePRNG$RandomIO.readFully(NativePRNG.java:185)
        at sun.security.provider.NativePRNG$RandomIO.implGenerateSeed(NativePRNG.java:202)
        - locked <0x7d928c78> (a java.lang.Object)
        at sun.security.provider.NativePRNG$RandomIO.access$300(NativePRNG.java:108)
        at sun.security.provider.NativePRNG.engineGenerateSeed(NativePRNG.java:102)
        at java.security.SecureRandom.generateSeed(SecureRandom.java:475)
        at weblogic.security.AbstractRandomData.ensureInittedAndSeeded(AbstractRandomData.java:83)

1
感谢您发布更新,但您应该将您的解决方案作为答案发布并接受它。 - Pascal Thivent
谢谢,我会的。我觉得自言自语有点不健康。 - Vladimir Dyuzhev
1
实际上,这是受到鼓励的,特别是如果您找到了解决方案(您甚至可以将SO用作个人技术博客,采用“危机”风格)。 - Pascal Thivent
4个回答

21

已解决

Weblogic使用SecureRandom初始化安全子系统。SecureRandom默认使用/dev/urandom设备。由于某种原因,在VM下读取此设备经常会停止。生成控制台事件有助于创建更多的随机性并释放WLS。

出于测试目的,我更改了jre/lib/security/java.security文件:

securerandom.source=file:/tmp/big.random.file

Weblogic现在只需要15秒即可启动。

由于我们在虚拟机中不测试任何安全相关的东西,因此对于我们来说,重复的种子完全没问题。


这适用于Windows吗? - NaiveCoder

10

如果你的企业标准应用服务器没有权限更改二进制文件,你可以添加一个JVM标志来覆盖应该使用哪个随机生成器。例如:

-Djava.security.egd=file:/dev/./urandom
那样你就不必更改任何系统设置。

请注意,这可能会导致安全问题,因为您正在使用不安全的 RNG。 - Chris Jefferson
在Windows系统中,如果没有权限进行更改怎么办? - André Luís Tomaz Dionisio

6

Oracle已经创建了一个与此相关的Metalink记录,涉及到在Linux虚拟环境下FMW配置向导非常缓慢。WLS服务器的启动也非常缓慢。[ID 1344974.1]

...

解决方案1 1)下载并安装以下rpm:rng-utils-2.0-1.14.1.fc6.x86_64.rpm。联系您的供应商获取下载详细信息。 2)按照以下方式启动随机生成器: rngd -r /dev/urandom -o /dev/random -t 1

默认情况下,在Linux上似乎存在对/dev/random的依赖,该依赖会阻塞直到产生足够的随机性。没有鼠标和键盘附加的虚拟服务器可能会发生显著的阻塞。在上述命令中,输入来自未阻塞的/dev/urandom,因此等待随机性不会成为应用程序瓶颈。


1
警告:运行rngd -r /dev/urandom将导致您生成的任何密钥(pgp、ssl等)不安全,因此请谨慎使用! - Chris Jefferson

1

尝试安装rngd。在拥有硬件随机数生成器的现代系统上,这将创建足够的熵。


网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接