问题: 我有一个J2EE应用程序,它使用特定的数据集来执行给定任务(生成一些文件)的速度非常慢。我决定在应用程序上运行visualvm profiler以了解问题的性质。该应用程序使用最新的Java 8在Widlfly 10上运行。
为避免配置复杂性,探查器(visualvm)和Wildfly服务器均在本地运行。
遇到的第一个问题是JVMTI错误62,该错误使用-Xverify:none作为jvm参数得以解决。
第二个问题(阻塞问题)是,如果我在部署和运行应用程序时运行了探查器,那么Wildfly部署扫描程序会引发如下异常:
13:19:04,476 INFO [stdout] (*** Profiler Agent Communication Thread) Profiler Agent: Waiting for connection on port 5140 (Protocol version: 15)
13:19:04,517 INFO [stdout] (*** Profiler Agent Communication Thread) Profiler Agent: Established connection with the tool
13:19:04,847 INFO [stdout] (*** Profiler Agent Communication Thread) Profiler Agent: Local accelerated session
13:19:15,984 WARN [org.jboss.as.ejb3.timer] (EJB default - 6) WFLYEJB0043: A previous execution of timer [id=e6a6ea46-6c2a-466d-b767-cccc8d5021a9 timedObjectId=ecs.ecs.BatchCoordinator auto-timer?:false persistent?:false timerService=org.jboss.as.ejb3.timerservice.TimerServiceImpl@142b16ca initialExpiration=Sun Aug 05 13:17:05 COT 2018 intervalDuration(in milli sec)=5000 nextExpiration=Sun Aug 05 13:19:15 COT 2018 timerState=IN_TIMEOUT info=null] is still in progress, skipping this overlapping scheduled execution at: Sun Aug 05 13:19:15 COT 2018.
13:19:16,025 ERROR [org.jboss.as.controller.management-operation] (DeploymentScanner-threads - 1) WFLYCTL0013: Operation ("read-resource") failed - address: ([("deployment" => "my_application.war")]): java.lang.NoClassDefFoundError: org/jboss/as/controller/AttributeDefinition$$Lambda$157
at org.jboss.as.controller.AttributeDefinition$$Lambda$157/1799183343.get$Lambda(Unknown Source)
at org.jboss.as.controller.AttributeDefinition.getNoTextDescription(AttributeDefinition.java:872)
at org.jboss.as.controller.AttributeDefinition.addResourceAttributeDescription(AttributeDefinition.java:697)
at org.jboss.as.controller.ListAttributeDefinition.addResourceAttributeDescription(ListAttributeDefinition.java:158)
at org.jboss.as.controller.descriptions.DefaultResourceDescriptionProvider.getModelDescription(DefaultResourceDescriptionProvider.java:129)
at org.jboss.as.controller.operations.global.ReadResourceHandler.doExecuteInternal(ReadResourceHandler.java:370)
at org.jboss.as.controller.operations.global.ReadResourceHandler.doExecute(ReadResourceHandler.java:173)
at org.jboss.as.controller.operations.global.GlobalOperationHandlers$AbstractMultiTargetHandler.execute(GlobalOperationHandlers.java:263)
at org.jboss.as.controller.AbstractOperationContext.executeStep(AbstractOperationContext.java:890)
at org.jboss.as.controller.AbstractOperationContext.processStages(AbstractOperationContext.java:659)
at org.jboss.as.controller.AbstractOperationContext.executeOperation(AbstractOperationContext.java:370)
at org.jboss.as.controller.OperationContextImpl.executeOperation(OperationContextImpl.java:1329)
at org.jboss.as.controller.ModelControllerImpl.internalExecute(ModelControllerImpl.java:400)
at org.jboss.as.controller.ModelControllerImpl.execute(ModelControllerImpl.java:208)
at org.jboss.as.controller.ModelControllerImpl$3.execute(ModelControllerImpl.java:667)
at org.jboss.as.controller.ModelControllerImpl$3.execute(ModelControllerImpl.java:657)
at org.jboss.as.server.deployment.scanner.DefaultDeploymentOperations.getDeploymentsStatus(DefaultDeploymentOperations.java:76)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService$ScanContext.<init>(FileSystemDeploymentService.java:1622)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService$ScanContext.<init>(FileSystemDeploymentService.java:1571)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.scan(FileSystemDeploymentService.java:572)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.scan(FileSystemDeploymentService.java:491)
at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService$DeploymentScanRunnable.run(FileSystemDeploymentService.java:250)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.runAndReset(FutureTask.java:308)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$301(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:294)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
at java.lang.Thread.run(Thread.java:748)
at org.jboss.threads.JBossThread.run(JBossThread.java:320)
Caused by: java.lang.ClassNotFoundException: org.jboss.as.controller.AttributeDefinition$$Lambda$157 from [Module "org.jboss.as.controller:main" from local module loader @4cc77c2e (finder: local module finder @7a7b0070 (roots: D:\jbossas\wildfly-10.1.0.Final-ecs\modules,D:\jbossas\wildfly-10.1.0.Final-ecs\modules\system\layers\base))]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:198)
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:363)
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:351)
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:93)
... 30 more
如果我在没有任何已部署应用程序的情况下运行探查器,VisualVM的探查器将启动而不会出现问题;但是,如果我尝试在此状态/操作模式下部署应用程序,则wildfly扫描程序将永远不会启动,并且应用程序也永远不会部署。
那么,我在做什么错了?
答案 0 :(得分:3)
最后,我开始使用visualVM Profiler ...这是使用VisualVM执行 Wildfly 10 CPU配置文件所需的步骤(均在本地执行! !):
下载latest VisualVM(在我的情况下是1.4.1版)。
下载JDK10 ...您将需要JDK10,以便仅运行VisualVM 。由于存在bug(这是我在分析应用程序时遇到的错误),因此需要执行此步骤。
更改visualVM配置文件(<visual-vm>/etc/visualvm.conf
)指向您的JDK10安装...
转到<visual-vm>/profiler/lib
并将库jfluid-server.jar
复制到:<wildfly>/standalone/lib/ext
...需要该库来克服以下错误:java.lang.NoClassDefFoundError: org/netbeans/lib/profiler/server/ProfilerRuntimeCPUFullInstr
(更多关于here和here中的错误)
接下来,修改wildfly启动脚本,以将包org.netbeans.lib.profiler.server
包含在SystemProperty:jboss.modules.system.pkgs
中。示例:-Djboss.modules.system.pkgs=org.jboss.byteman,org.netbeans.lib.profiler.server
。 (根据此link,此属性会强制Wildfly从任何类加载器中找到此类包)
启动visualVM。
启动wildfly服务器(包括您的应用程序EAR / WAR / JAR应用程序)... 注意:我正在使用JBoss Tools从Eclipse运行Wildfly服务器;在这种配置下,我的应用程序(WAR)处于爆炸模式!
转到visualVM,打开org.jboss.modules.Main
进程。然后转到分析器选项卡。修改目标Profile classes
和Outgoing calls
并放置要监视/配置的类(注意:目前,我的优胜者配置为:Profile classes
:my.package.**
和Include outgoing calls
:my.package.**
)
点击CPU按钮,等待VisualVM检测目标类,然后调用运行缓慢的代码;稍后,分析结果...