首页 > 解决方案 > 无法在 AEM 中使用 GraphQL

问题描述

我将 GraphQL 添加到 AEM 中的包中,导致包启动失败。

  1. 我有一个捆绑项目,它在 AEM 中运行良好。捆绑启动命令: mvn clean install -PautoInstallBundle
    <profile>  
        <id>autoInstallBundle</id>  
        <activation>  
            <activeByDefault>false</activeByDefault>  
        </activation>  
        <build>  
            <pluginManagement>  
                <plugins>  
                    <plugin>  
                        <groupId>org.apache.sling</groupId>  
                        <artifactId>maven-sling-plugin</artifactId>  
                        <executions>  
                            <execution>  
                                <id>install-bundle</id>  
                                <goals>  
                                    <goal>install</goal>  
                                </goals>  
                            </execution>  
                        </executions>  
                    </plugin>  
                </plugins>  
            </pluginManagement>  
        </build>  
    </profile>
  1. 我将以下配置添加到 pom.xml 然后重新安装捆绑包,捆绑包仍然可以正常工作。
<dependency>  
<groupId>com.graphql-java</groupId>  
<artifactId>graphql-java</artifactId>  
<version>3.0.0</version>  
</dependency>
  1. 我在我的项目中添加了两个演示类并重新安装了包。捆绑启动失败。GraphQL_SImple.java 和 User.java 可以在https://github.com/zhaiqianfeng/GraphQL-Demo/blob/master/java/src/main/java/com/zqf/get_start/GraphQL_Simple.java找到

  2. 错误信息是:

12.07.2018 14:55:17.223错误[qtp1398311933-54244] org.apache.felix.http.jetty %bundles.pluginTitle:无法启动(org.osgi.framework.BundleException:无法解析 com.mb.graphql.mb-graphql.core [528](R 528.27 ): 缺少需求 [com.mb.graphql.mb-graphql.core [528](R 528.27)] osgi.wiring.package; (osgi.wiring.package=graphql) 未解决的需求: [[com.mb.graphql. mb-graphql.core [528](R 528.27)] osgi.wiring.package; (osgi.wiring.package=graphql)]) org.osgi.framework.BundleException: 无法解析 com.mb.graphql.mb-graphql .core [528](R 528.27):缺少要求 [com.mb.graphql.mb-graphql.core [528](R 528.27)] osgi.wiring.package;(osgi.wiring.package=graphql) 未解决的要求:[[com.mb.graphql.mb-graphql.core [528](R 528.27)] osgi.wiring.package; (osgi.wiring.package=graphql)] 在 org.apache.felix.framework.Felix。

有人面临同样的问题并知道如何解决吗?

谢谢

标签: graphqlaem

解决方案


我找到了解决它的方法。将以下配置添加到 maven-bundle-plugin。

<Export-Package>graphql.*</Export-Package>

推荐阅读