【问题标题】:Deploying Java app to Google App Engine with local dependencies giving ClassNotFoundException使用本地依赖项将 Java 应用程序部署到 Google App Engine,从而产生 ClassNotFoundException
【发布时间】:2021-06-28 15:09:44
【问题描述】:

我正在制作一个使用基于属性的加密的 Spring Boot 应用程序,并且在本地一切正常。但是,由于我使用的库在 maven 存储库中不可用,我通过直接引用 jar 将它添加到我的 pom 中。但是,当我部署到 GAE 并尝试使用它时,我得到了错误:

java.lang.ClassNotFoundException: co.junwei.bswabe.SerializeUtils

不知道为什么在我构建我的应用程序 .jar 时没有包含它,任何帮助将不胜感激。 我的 pom 看起来像这样:

<dependencies>
        <dependency>
            <groupId>it.unisa.dia.gas</groupId>
            <artifactId>jpbc-api</artifactId>
            <version>1.2.1</version>
            <scope>system</scope>
            <systemPath>${pom.basedir}/lib/jpbc-api-1.2.1.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>it.unisa.dia.gas</groupId>
            <artifactId>jpbc-plaf</artifactId>
            <version>1.2.1</version>
            <scope>system</scope>
            <systemPath>${pom.basedir}/lib/jpbc-plaf-1.2.1.jar</systemPath>
        </dependency>
        <dependency>
            <groupId>co.junwei.cpabe</groupId>
            <artifactId>cpabe-api</artifactId>
            <version>1.0.2</version>
            <scope>system</scope>
            <systemPath>${pom.basedir}/lib/cpabe-api-1.0.2.jar</systemPath>
        </dependency>
</dependencies>

我确实知道在 maven 中使用 systemPath 已被弃用,但不确定我可以使用什么来代替它。我尝试使用此处列出的内容:https://maven.apache.org/guides/mini/guide-3rd-party-jars-local.html 但是,这只是在尝试本地运行时导致此错误:

java.lang.Error: Unresolved compilation problems:
        BswabePub cannot be resolved to a type
        SerializeUtils cannot be resolved
        BswabePrv cannot be resolved to a type
        SerializeUtils cannot be resolved

【问题讨论】:

    标签: java maven google-app-engine dependency-management


    【解决方案1】:

    发现是我做错了,在添加罐子后,我的 pom 中仍然有系统

    mvn org.apache.maven.plugins:maven-install-plugin:2.5.2:install-file
    

    我猜这是导致它们没有被正确遵守

    【讨论】:

      猜你喜欢
      • 2016-09-15
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-07-27
      • 1970-01-01
      • 2017-02-08
      • 1970-01-01
      • 2015-05-06
      相关资源
      最近更新 更多