Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
How to include jar under tomcat/webapp/ROOT/WEB-INF/lib to my own project?
Hello everyone. I am trying to use Truezip under tomcat_root/webapp/ROOT/WEB-INF/lib/truezip.jar for my own project, a liferay service module to override ResourceMVCCommand of the OOB document library portlet. I am using tomcat-8.0.32 and liferay dxp.
The build.gradle is:
I've included
to rewrite the zip process of resource command.
However, after deploying, osgi container says:
I've tried to copy truezip.jar to the tomcat's global jar path but neither tomcat/lib nor tomcat/lib/ext worked even after restarting the server.
I also tried the methods described in the blog: osgi module dependencies but all failed due to another reason:
Before using the complex way of removing root path classes from jar file and trying Uber Module/Including Module approach, I wonder if there is any easier way to access the jar files under tomcat/webapp/ROOT/WEB-INF/lib or tomcat/lib. Thank you very much.
The build.gradle is:
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay", name: "com.liferay.document.library.api", version: "3.2.1"
compileOnly group: "com.liferay", name: "com.liferay.document.library.service", version: "1.1.21"
compileOnly group: "com.liferay", name: "com.liferay.petra.memory", version: "1.0.0"
compileOnly group: "org.osgi", name: "osgi.cmpn", version: "6.0.0"
compileOnly group: "org.osgi", name: "org.osgi.service.component.annotations", version: "1.3.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
compileOnly group: 'truezip', name: 'truezip', version: '6.7' // the truezip.jar of liferay shows that its version is 6.7.
runtime group: 'truezip', name: 'truezip', version: '6.7'
}I've included
import de.schlichtherle.io.ArchiveDetector;
import de.schlichtherle.io.ArchiveException;
import de.schlichtherle.io.DefaultArchiveDetector;
import de.schlichtherle.io.File;
import de.schlichtherle.io.FileOutputStream;
import de.schlichtherle.io.archive.zip.ZipDriver;to rewrite the zip process of resource command.
However, after deploying, osgi container says:
org.osgi.framework.BundleException: Could not resolve module: test.document.resource.mvcaction.override [2481]
Unresolved requirement: Import-Package: de.schlichtherle.ioI've tried to copy truezip.jar to the tomcat's global jar path but neither tomcat/lib nor tomcat/lib/ext worked even after restarting the server.
I also tried the methods described in the blog: osgi module dependencies but all failed due to another reason:
truezip.jar has classes defined in its root path:
decrypt.class
encrypt.class
nzip.class
therefore using Include-Resource / Bundle-Path syntax of bnd will result in :
`The default package '.' is not permitted by the Import-Package syntax. ` error.
Before using the complex way of removing root path classes from jar file and trying Uber Module/Including Module approach, I wonder if there is any easier way to access the jar files under tomcat/webapp/ROOT/WEB-INF/lib or tomcat/lib. Thank you very much.
simple solution: use truezip-6.8.1 which does not include those classes in the default/unnamed '.' package