Why am I Unable to install bundle PackagesMetadata?

Metadata Deploy: 1.4:

Question: I am trying to install custom HTML forms when a module starts using the Metadata Deploy module, but on startup the module fails with the error java.util.zip.ZipException: invalid code lengths set. The log details can be found here:

http://pastebin.com/b3fm4xSv

Initially I thought that the issue was that the zip file was corrupt, but I have tried regenerating and still get the same result.

Any help will be highly appreciated.

Thanks

The error message seems to suggest that the zip file is corrupt. Can you create a new one?

@dkayiwa I have generated a new zip file from another machine and now the error reads java.util.zip.ZipException: invalid stored block lengths

@gwasilwa, first thing you should do is to go into the built omod (eg. in your omod/target/xyz.omod file, and to find the zip file in question that you are packaging in there. If this zip file fails to open, then you know it is ending up corrupted, and it is not a problem in loading it within openmrs.

One common pitfall I have seen is that, during the build process, we run a filter on all xml and properties files in order to do variable replacement. (eg. it allows you to refer to @MODULE_PACKAGE@ rather than “org.openmrs.module.mymodule” in your resources). Check to make sure that this is not affecting your files during the build process. It will look something like this within the “build” element in your pom.xml most likely:

<resources>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>false</filtering>
    <excludes>
      <exclude>**/*.xml</exclude>
      <exclude>**/*.properties</exclude>
    </excludes>
  </resource>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
    <includes>
      <include>**/*.xml</include>
      <include>**/*.properties</include>
    </includes>
  </resource>
</resources>
<testResources>
  <testResource>
    <directory>src/test/resources</directory>
    <filtering>false</filtering>
    <excludes>
      <exclude>**/*.xml</exclude>
      <exclude>**/*.properties</exclude>
    </excludes>
  </testResource>
  <testResource>
    <directory>src/test/resources</directory>
    <filtering>true</filtering>
    <includes>
      <include>**/*.xml</include>
      <include>**/*.properties</include>
    </includes>
  </testResource>
</testResources>

Mike

1 Like

Thanks @mseaton, your suggestion helped me through the first error.

Now I’m getting java.lang.ClassNotFoundException: org.openmrs.ConceptWord which is true since ConceptWord doesn’t exist in OpenMRS v1.11.2. Does this mean that I can only use the metadatadeploy with lower version of OpenMRS only?

I doubt this has anything to do wtih metadatadeploy. How exactly are you installing Concepts? Are you importing your htmlforms via metadatasharing and pulling Concepts within those MDS packages?

@mseaton, I’m installing html forms which come bundled with concepts (I think). Here’s the code that I’m running to install the package:

@Override
public void install() throws Exception {
    install(CoreConstructors.packageFile("metadata/HTML_Forms-1.zip", null, _Package.UUID));
}

And yes I’m using MDS to package the forms

@gwasilwa, what version of OpenMRS was this MDS package (HTML_Forms-1.zip) created with? If you extract this zip file and grep it, do you see any references to concept word? If the MDS package was created with an earlier version of OpenMRS, and if this pulls in concept word entries, then this is likely causing your problem…

@mseaton the package was created with OpenMRS v1.11.2. There are no reference to ConceptWord, but I traced the error to:

@gwasilwa, good find. Sounds like you need to create a new ticket in MDS. @raff FYI

@mseaton seems like the ticket has already been created:

I tried setting all those but still got this error “java.util.zip.ZipException: invalid code lengths set”. Can some look into this https://github.com/esaude/module-openmrs-esaudemetadata/blob/master/api/src/main/java/org/openmrs/module/esaudemetadata/ESaudeMetadataActivator.java#L100 and maybe advice me where am going wrong? @pascal @dkayiwa @gwasilwa

@ningosi to get around this I just replaced the filtered resources tag with what @mseaton suggested.

I set those already but this problem seem to persist. Maybe it is something else. you can check the here

@ningosi, I believe the issue is that you are still doing the broad filtering in either your api pom, your omod pom, or both. Try removing the resource filtering from these poms unless they are doing something more than what you are doing in the top-level pom.

Thank very much to have mentioned the api and omod poms. I had to modify my api pom resource section to look like this

and my omod resource section to look like this

and NOT put anything in the main pom. And everything worked for me!