Free Support Forum - aspose.com

Aspose.Words as OSGI . Dependency cannot be resolved

I am facing an issue to use Aspose.Words when i try to use it inside an OSGI bundle. I am using maven to resolve the dependency, which is downloaded without any issues . In detail i see in my local maven repository under com\aspose\aspose-words\18.6 the file aspose-words-18.6-jdk16.jar .

The issue starts when i try to wrap the aspose dependency in my features.xml
wrap:mvn:com.aspose/aspose-words/18.6 .

The above entry in my features.xml resolves the following exception:

[WARNING] Error resolving artifact com.aspose:aspose-words:jar:18.6-jdk16: [Could not find artifact com.aspose:aspose-words:jar:18.6-jdk16 in central (https://repo.maven.apache.org/maven2/)]
java.io.IOException: Error resolving artifact com.aspose:aspose-words:jar:18.6-jdk16: [Could not find artifact com.aspose:aspose-words:jar:18.6-jdk16 in central (https://repo.maven.apache.org/maven2/)]
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:720)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:659)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:600)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:567)
at org.apache.karaf.features.internal.download.impl.MavenDownloadTask.download(MavenDownloadTask.java:36)
at org.apache.karaf.features.internal.download.impl.AbstractRetryableDownloadTask.run(AbstractRetryableDownloadTask.java:60)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:511)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:180)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:293)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
at java.lang.Thread.run(Thread.java:745)
Suppressed: shaded.org.eclipse.aether.transfer.ArtifactNotFoundException: Could not find artifact com.aspose:aspose-words:jar:18.6-jdk16 in central (https://repo.maven.apache.org/maven2/)
at shaded.org.eclipse.aether.connector.basic.ArtifactTransportListener.transferFailed(ArtifactTransportListener.java:39)
at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$TaskRunner.run(BasicRepositoryConnector.java:355)
at shaded.org.eclipse.aether.util.concurrency.RunnableErrorForwarder$1.run(RunnableErrorForwarder.java:67)
at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector$DirectExecutor.execute(BasicRepositoryConnector.java:581)
at shaded.org.eclipse.aether.connector.basic.BasicRepositoryConnector.get(BasicRepositoryConnector.java:249)
at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.performDownloads(DefaultArtifactResolver.java:520)
at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:421)
at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:705)
… 12 more
Caused by: shaded.org.eclipse.aether.resolution.ArtifactResolutionException: Error resolving artifact com.aspose:aspose-words:jar:18.6-jdk16
at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolve(DefaultArtifactResolver.java:444)
at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifacts(DefaultArtifactResolver.java:246)
at shaded.org.eclipse.aether.internal.impl.DefaultArtifactResolver.resolveArtifact(DefaultArtifactResolver.java:223)
at shaded.org.eclipse.aether.internal.impl.DefaultRepositorySystem.resolveArtifact(DefaultRepositorySystem.java:294)
at org.ops4j.pax.url.mvn.internal.AetherBasedResolver.resolve(AetherBasedResolver.java:705)
… 12 more

In addition i tried also following:
wrap:file:com.aspose/aspose-words/18.6/aspose-words-18.6-jdk16.jar

With the above entry i was able to build my project but had the following warning:
[WARNING] Ignoring artifact file:com.aspose/aspose-words/18.6/aspose-words-18.6-jdk16.jar

Could be the classifier causing an issue making it impossible to resolve from the correct path in my local maven repository the aspose library ? I noticed that when i create in my local repository the directory com\aspose\aspose-words\18.6-jdk16 and place inside the directory 18.6-jdk16 the jar file and inside my features.xml wrap in the following way:
wrap:mvn:com.aspose/aspose-words/18.6-jdk16
then the library is being resolved and i am able to build my bundle.

@ssch,

Thanks for your inquiry. Please clean your project and update Aspose.Words from maven repository. Please refer to the following article about installing Aspose.Words for Java from Maven repository.
Installing Aspose.Words for Java from Maven Repository

I am already using the latest version. I am not facing any issues with maven actually. As i already mentioned maven is able to download the dependency read from the pom.xml . My issue is that the bundle cannot resolve the dependency that was downloaded by maven during the build process in my local repository.

I was able to fix this issue with a workaround, as mentioned in my first post by creating the directory com\aspose\aspose-words\18.6-jdk16 in my local repository and placing by hand the jars in there. Is there a proper way to fix this ?

@ssch,

Thanks for your inquiry. The Aspose.Words for Java is capable with OSGI bundle. Could you please share the following detail here for testing:

  • Please create simple OSGI application that helps us to reproduce your problem on our end and attach it here for testing.
  • Please share the steps that you are following for this issue.

As soon as you get these pieces of information ready, we’ll start investigation into your issue and provide you more information. Thanks for your cooperation.

PS: To attach these resources, please zip and upload them.

Is there maybe any working OSGI bundle using the Aspose.Words ? It would be helpful to use it as a guide and identify where the problem in my project might be.

@ssch,

Thanks for your inquiry. We have logged a ticket as WORDSJAVA-1830 to analyze what it takes to work Aspose.Words for OSGI bundle. You will be notified via this forum thread once this issue is resolved.

We apologize for your inconvenience.