이제 관심밖의 IT 기술/ETC

Byteman Best Practical 1 - (parameter value, AT INVOKE)

트래이닝맨 2014. 11. 13. 15:41
728x90
반응형
hat I want to know :

    According to log,  NPE happen when getDeploymentTimeStamp method is called, so I would like to know what value is null and what is going on there.


ErrorMsg :  

             java.lang.NullPointerException



18:04:54,160 ERROR [org.jboss.as.server.deployment.scanner] (DeploymentScanner-threads - 1) JBAS015016: Initial deployment scan failed: java.lang.NullPointerException
    at org.jboss.as.server.deployment.scanner.FileSystemDeploymentService.getDeploymentTimestamp

    (FileSystemDeploymentService.java:723) [jboss-as-deployment-scanner-7.3.4.Final-redhat-1.jar:7.3.4.Final-redhat-1]
    ............



Test Source :

  •       org.jboss.as.server.deployment.scanner.FileSystemDeploymentService

 


private long getDeploymentTimestamp(File deploymentFile) {
     if (deploymentFile.isDirectory()) {
             // Scan for most recent file
             long latest = deploymentFile.lastModified();
             for (File child : deploymentFile.listFiles()) {
                 long childTimestamp = getDeploymentTimestamp(child);
                 if (childTimestamp > latest) {
                     latest = childTimestamp;
                 }
             }
             return latest;
         } else {
             return deploymentFile.lastModified();
         }
     }




Byteman script :


RULE Test autodeployment checking all files under the exploded folder
CLASS org.jboss.as.server.deployment.scanner.FileSystemDeploymentService
METHOD getDeploymentTimestamp
AT INVOKE  getDeploymentTimestamp
BIND subfile = $child;
IF TRUE
DO
   System.out.println("=========================JHOUSE-debug=================");
   System.out.println("deploymentFile : " +  $1);
   System.out.println("subFile : " + subfile);
ENDRULE
 



Result :


INFO  [stdout] (DeploymentScanner-threads - 1) Rule.execute called for Test autodeployment_2
INFO  [stdout] (DeploymentScanner-threads - 1) HelperManager.install for helper class org.jboss.byteman.rule.helper.Helper
INFO  [stdout] (DeploymentScanner-threads - 1) calling activated() for helper class org.jboss.byteman.rule.helper.Helper
INFO  [stdout] (DeploymentScanner-threads - 1) Default helper activated
INFO  [stdout] (DeploymentScanner-threads - 1) calling installed(Test autodeployment) for helper classorg.jboss.byteman.rule.helper.Helper
 INFO  [stdout] (DeploymentScanner-threads - 1) Installed rule using default helper : Test autodeployment
 INFO  [stdout] (DeploymentScanner-threads - 1) Test autodeployment execute
 INFO  [stdout] (DeploymentScanner-threads - 1) =========================JHOUSE-debug=================
INFO  [stdout] (DeploymentScanner-threads - 1) deploymentFile : /home/jooho/Applications/JBoss/EAP/jboss-eap-6.2.4/standalone/deployments/cluster.war
INFO  [stdout] (DeploymentScanner-threads - 1) subFile : /home/jooho/Applications/JBoss/EAP/jboss-eap-6.2.4/standalone/deployments/cluster.war/index.jsp


Compared between source and by teman script, you can easily map each value that related with each other.


If you have any questions, please leave comment.


반응형