I’m trying to create an OSGI bundle to convert docs to pdfs and it passes the maven test, but when I gets deployed into Lucee I get this error.
org.apache.commons.io.output.UnsynchronizedByteArrayOutputStream not found by org.lucee.commons.io
I added commons-io to the pom dependencies.I tried copying it’s bundle in as well, but the error persists?
If anyone has a solution other than creating a new bundle, that would also be great.
Don’t forget to tell us about your stack!
OS: Linux
Java Version: 11
Tomcat Version: 9.0.70
Lucee Version: 5.3.9.166
Figured it out. Basically a journey of working through building my first OSGI bundle. And because it had to do with document conversion there were a ton on dependences to walk through and add to the POM.
Great!!! Is it possible to wirte the steps you did down somewhere? That’s something very interesting I’d like to read sometime!
I put this together.
Really it’s kinda simple once you figure it out. The pom.xml is where you register all the dependencies. It was a bit of a journey because converting word docs to pdfs has quite a bit of dependencies. In general you can find the XML dependency attribute to add to your pom.xml by searching “maven desired_artifactid”. And it’s important to note that when you find the artifact that you need. The associated pom.xml will tell you it’s dependencies.
I also had to switch the pom.xml’s “packaging” attribute from “jar” to “bundle” and add the “mavin-bundle-plugin”
Once I got it to build and pass the tests, I then copied it into my image by adding this to the Dockerfile
COPY ./doc2pdf-0.0.1-SNAPSHOT.jar /opt/lucee/server/lucee-server/context/lib/doc2pdf-0.0.1-SNAPSHOT.jar
3 Likes