1 Reply Latest reply on Jan 1, 2006 4:32 PM by starksm64

    DeploymentException: Failed to find META-INF/jboss-service.x

    peterj

      I tried to deploy an EAR file containing an EJB JAR file and a Hibernate archive file to JBoss 4.0.3SP1, and received the following error during deployment:

      2005-12-21 17:06:26,265 ERROR [org.jboss.deployment.MainDeployer] Could not initialise deployment: file:/C:/apps/jboss-4.0.3SP1/server/all/deploy/product-1.0.ear
      org.jboss.deployment.DeploymentException: Failed to find META-INF/jboss-service.xml
       at org.jboss.deployment.SARDeployer.parseDocument(SARDeployer.java:590)
       at org.jboss.deployment.SARDeployer.init(SARDeployer.java:166)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:849)
       at org.jboss.deployment.MainDeployer.init(MainDeployer.java:871)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:784)
       at org.jboss.deployment.MainDeployer.deploy(MainDeployer.java:755)
       at sun.reflect.GeneratedMethodAccessor19.invoke(Unknown Source)
       . . .


      I based my EAR file on a similar EAR file that successfully deploys. I verified that my EAR file was structured the same as the working EAR file (i.e., no missing files, files contained similar data), and even noted that there was no jboss-service.xml file anywhere in the working EAR file. I also looked at forum posts and did a Google search to no avail.

      So I grabbed the JBoss source and modified it to try to pinpoint the problem (after all, that is the point of using open source ? if you run into a problem you can always examine/modify the source to track down problems). Anyway, I found what I believe are two problems.

      The first is that the error message is deceptive: the problem did not concern the product-1.0.ear file; rather it concerned the Hibernate archive file contained within the EAR file. And second, the name of the Hibernate archive file was product-data-1.0.har. The problem is that the code that looks up the configuration information for an archive file incorrectly assumed that all characters after the first dot are part of the file extension, thus making the extension .0.har, which it failed to find in its list of known archive file extensions.

      The solution was simple ? I removed the version number from HAR file name, making it simply product-data.har, and my EAR file successfully deployed.

      However, I think that the JBoss code in question should be changed.

      First, in ./system/src/main/org/jboss/deployment/SARDeployer.java, method getDescriptorName(), change line 668 to read

      int dot = shortName.lastIndexOf('.');


      This change will cause the code to ignore dots that are part of the file name and locate the actual file extension.

      The second change is for the error message. As I mentioned, it is deceptive, but not incorrect: it was the EAR file that could not be deployed, by it was the HAR file for which no configuration information could be found. So I propose changing the exception text rather than the logged error message. Once again in ./system/src/main/org/jboss/deployment/SARDeployer.java, method parseDocument(), change line 580 to read as follows:

      throw new DeploymentException("Failed to find META-INF/jboss-service.xml for archive " + di.shortName);


      If the above changes are reasonable, please let me know. I would be happy to create a JIRA issue and even submit the patches to CVS in both the jboss-head and jboss-4.0.x streams (please let me know if I am missing any streams).