添加atlassian-connect-spring-boot-jpa-starter后Redis缓存功能异常
Hey there, let's tackle that java.util.zip.ZipException: invalid LOC header (bad signature) error you're hitting when starting your Spring Boot cache sample after adding those Atlassian Connect starters. This error pops up because Liquibase can't properly read a resource JAR—usually due to a corrupted dependency or a version conflict.
What's Causing This?
Most often, this means:
- A corrupted JAR file in your local Maven repository (either a Liquibase dependency or one pulled in by the Atlassian Connect starters)
- A dependency version conflict where the Atlassian Connect starters bring in a Liquibase version that clashes with the one your Spring Boot sample expects
Step-by-Step Fixes
1. Clean and Re-Download Dependencies
First, let's rule out corrupted downloads. Run this Maven command to clean your project and force a fresh download of all dependencies:
mvn clean install -U
The -U flag forces Maven to update snapshot dependencies and re-fetch any potentially corrupted JARs. If that doesn't work, manually delete the Liquibase directory in your local Maven repo (usually ~/.m2/repository/org/liquibase) and run the command again.
2. Check for Dependency Conflicts
Atlassian Connect's JPA starter might be pulling in a Liquibase version that's incompatible with your Spring Boot project. Let's check the dependency tree to confirm:
mvn dependency:tree -Dincludes=org.liquibase
If you see multiple versions of Liquibase listed, exclude the conflicting one from the Atlassian Connect dependency. For example:
<dependency> <groupId>com.atlassian.connect</groupId> <artifactId>atlassian-connect-spring-boot-jpa-starter</artifactId> <version>1.3.5</version> <exclusions> <exclusion> <groupId>org.liquibase</groupId> <artifactId>liquibase-core</artifactId> </exclusion> </exclusions> </dependency>
Then add the Liquibase version that matches your Spring Boot project (you can find this in the Spring Boot parent POM's dependency management section).
3. Verify Atlassian Connect Dependencies
Sometimes the Atlassian Connect JARs themselves get corrupted. Delete the com/atlassian/connect directory in your local Maven repo, then run mvn install again to re-download them fresh.
4. Disable Liquibase (If You Don't Need It)
If your project doesn't actually use Liquibase, you can disable it entirely to bypass the error. Add this to your application.properties:
spring.liquibase.enabled=false
Or exclude its auto-configuration in your main application class:
@SpringBootApplication(exclude = LiquibaseAutoConfiguration.class) public class SampleCacheApplication { public static void main(String[] args) { SpringApplication.run(SampleCacheApplication.class, args); } }
Wrap-Up
This error almost always boils down to a bad JAR or version mismatch. Start with cleaning your dependencies, then check for conflicts, and disable Liquibase if it's not needed for your use case.
内容的提问来源于stack exchange,提问作者Shiv

