1

如何在 Karaf 中正确导入/导出依赖项?

我有一个调用 AmazonS3Ciient 类的简单 servlet

我的 pom.xml

<plugin>
                            <groupId>org.apache.felix</groupId>
                            <artifactId>maven-bundle-plugin</artifactId>
                            <extensions>true</extensions>
                            <configuration>
                                    <supportedProjectTypes>
                                            <supportedProjectType>jar</supportedProjectType>
                                            <supportedProjectType>bundle</supportedProjectType>
                                            <supportedProjectType>war</supportedProjectType>
                                    </supportedProjectTypes>
                                    <instructions>
                                            <Bundle-SymbolicName>${bundle.symbolicName}</Bundle-SymbolicName>
                                            <Bundle-Version>${project.version}</Bundle-Version>
                                            <Import-Package>
                                               com.amazonaws.*,
                                                    *;resolution:=optional
                                            </Import-Package>
                                            <Export-Package>
                                                    !*
                                            </Export-Package>
                                            <Bundle-Classpath>
                                                    WEB-INF/classes
                                            </Bundle-Classpath>
                                            <Web-ContextPath>agwar</Web-ContextPath>
                                    </instructions>
                            </configuration>
                            <executions>
                                    <execution>
                                            <id>generate-manifest</id>
                                            <phase>process-classes</phase>
                                            <goals>
                                                    <goal>manifest</goal>
                                            </goals>
                                    </execution>
                            </executions>
                    </plugin>
                    <plugin>
                            <artifactId>maven-war-plugin</artifactId>
                            <configuration>
                                    <archive>
                                            <manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile>
                                    </archive>
                            </configuration>
                    </plugin>

我收到错误 noclassdeferror 我相信它是缺少依赖项或依赖项冲突?

我试图找到这个类,它存在于两个捆绑包中

karaf@root()> find-class AmazonS3Client

Apache ServiceMix :: Bundles :: aws-java-sdk (133)
com/amazonaws/services/s3/AmazonS3Client$1.class
com/amazonaws/services/s3/AmazonS3Client$2.class
com/amazonaws/services/s3/AmazonS3Client$3.class
com/amazonaws/services/s3/AmazonS3Client.class

OPS4J Pax Web - Samples - Servlet3 (139)
com/amazonaws/services/s3/AmazonS3Client$1.class
com/amazonaws/services/s3/AmazonS3Client$2.class
com/amazonaws/services/s3/AmazonS3Client$3.class
com/amazonaws/services/s3/AmazonS3Client.class

不太确定如何解决这个问题:(

提前致谢

4

0 回答 0