OSGiバンドルにApacheライブラリ(axis-jaxrpc
)の1つが必要ですが、jarファイルにjava組み込みクラス(javax.xml.namespace.QName
)のクラスが含まれているため、問題があります。私はそれを他の代替手段に置き換えることはできません。別の依存関係のための依存関係です......これはどういうことか分かります:)maven bundle plugin embeded depsファイルまたはパッケージを除外
私はパッケージをバンドルして起動すると、まあまあです。しかし、私がjaxrpc
に関連する機能に触れると、<bootloader>
によってすでにQName
がロードされていると主張するLinkageErrorが発生します。
jaxrpc
jarをバンドルjarに展開し、アプリケーションを起動する前にjavax.namespaceディレクトリを手動で削除する(つまり、バンドルのjarコンテンツを編集する)ことができました。それがトリックでした - 私はもはやLinkageErrorを取得しません。
ここで問題は...私はこのような状況を非サドマゾ方法で処理し、問題のクラス/パッケージを埋め込みjarファイルから除外するにはどうすればよいですか?
POMスニペット:
依存関係:
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
<scope>provided</scope>
</dependency>
バンドルプラグイン:
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.6</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
<Export-Package>
/* application packages only */
</Export-Package>
<Private-Package>
/* application packages only */
</Private-Package>
<DynamicImport-Package>
*
</DynamicImport-Package>
<Import-Package></Import-Package>
<Include-Resource>
{maven-resources},target/classes/rebel.xml
</Include-Resource>
<Embed-Dependency>
/* other dependencies */
axis,
axis-jaxrpc;inline=true,
commons-discovery,
commons-logging
</Embed-Dependency>
</instructions>
</configuration>
</plugin>
言い換えるするには...このようになめらかに行うのですかどのような方法があります:
<Embed-Dependency>
axis-jaxrpc;inline=true;exclude=javax.namespace.QName
</Embed-Dependency>
編集:明確にするため
例外:
Caused by: java.lang.LinkageError: loader constraint violation in interface itable initialization: when resolving method "org.apache.axis.message.MessageElement.getChildElements(Ljavax/xml/namespace/QName;)Ljava/util/Iterator;" the class loader (instance of org/apache/felix/framework/BundleWiringImpl$BundleClassLoaderJava5) of the current class, org/apache/axis/message/MessageElement, and the class loader (instance of) for interface javax/xml/soap/SOAPElement