掲示板

Unresolved requirement: Import-Package:

7年前 に alok Pal によって更新されました。

Unresolved requirement: Import-Package:

New Member 投稿: 21 参加年月日: 16/08/31 最新の投稿
I want to generate ExcelSheet and I used org.apache.poi dependency in liferay 7
but while deploying portlet I'm getting below error.

org.osgi.framework.BundleException: Could not resolve module: test [529]
Unresolved requirement: Import-Package: org.apache.poi.xssf.usermodel

In other service portlet same depency, I used there also same error below is the exception:
org.osgi.framework.BundleException: Could not resolve module: excelsheet [536]_ Unresolved requirement: Import-Package: org.apache.poi.ss.usermodel_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:429)
at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:402)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundle(DirectoryWatcher.java:1252)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.startBundles(DirectoryWatcher.java:1224)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.doProcess(DirectoryWatcher.java:512)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.process(DirectoryWatcher.java:361)
at org.apache.felix.fileinstall.internal.DirectoryWatcher.run(DirectoryWatcher.java:313)
thumbnail
7年前 に Milen Dyankov によって更新されました。

RE: Unresolved requirement: Import-Package:

Expert 投稿: 310 参加年月日: 12/10/30 最新の投稿
How do you build your module?
7年前 に alok Pal によって更新されました。

RE: Unresolved requirement: Import-Package:

New Member 投稿: 21 参加年月日: 16/08/31 最新の投稿
Sorry for replying late,
I just building that module from gradles option build
and put the .jar file in deploy folder.

I have given depency in build.gradle file :
dependencies {
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
compileOnly project(":modules:ExcelSheet-api")
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.9'
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.9'
compile group: 'org.apache.poi', name: 'poi', version: '3.9'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.6.0'

}
In bnd.bnd file:

Bundle-SymbolicName: excelsheet.services
Bundle-Version: 1.0.0
Include-Resource:@poi-ooxml-3.9.jar,\
@poi-3.9.jar,\
@poi-ooxml-schemas-3.9.jar,\
@dom4j-1.6.1.jar,\
@xmlbeans-2.6.0.jar

org.osgi.framework.BundleException: Could not resolve module: excelsheet.services [524]
Unresolved requirement: Import-Package: com.sun.javadoc

I'm getting above error while deploying module
in gogo shell its showing installed status.
7年前 に Deepjyoti Nath によって更新されました。

RE: Unresolved requirement: Import-Package:

Junior Member 投稿: 86 参加年月日: 10/11/02 最新の投稿
Hi,
Are you able to resolve the issue? I'm also getting similar type of issue while trying to add jersey-client dependencies in one of my custom portlet.

Thanks,
Deep
thumbnail
7年前 に Gustavo Oliveira によって更新されました。

RE: Unresolved requirement: Import-Package:

Junior Member 投稿: 98 参加年月日: 15/09/23 最新の投稿
It didnt work with MySQL but it works with other dependency libs.

You need to add it on build.gradle, used 2 libs as example:

	compile group: "mysql", name: "mysql-connector-java", version: "5.1.40"
	compile group: 'c3p0', name: 'c3p0', version: '0.9.1.2'


And then add this to the bnd.bnd:

Bundle-ClassPath:\
  .,\
  lib/mysql.jar,\lib/c3p0.jar
-includeresource:\
  lib/mysql.jar=mysql-connector-java-5.1.40.jar,\
  lib/c3p0.jar=c3p0-0.9.1.2.jar


Mysql connector only worked inside a WAB project.

You have other options, as an Uber Module it will explode the jars classes inside the module. I prefer the option 4 as I showed above:
https://web.liferay.com/pt/web/user.26526/blog/-/blogs/osgi-module-dependencies
thumbnail
6年前 に Santosh B Biradar によって更新されました。

RE: Unresolved requirement: Import-Package:

Junior Member 投稿: 41 参加年月日: 15/08/04 最新の投稿
Hi Deepjyoti Nath,

Jersey will not work in Liferay7 I guess because of OSGI issue,
If you find any solution please do post it, It might helps others.

Regards
Santosh B B
thumbnail
6年前 に Sandip Patel によって更新されました。

RE: Unresolved requirement: Import-Package:

Regular Member 投稿: 205 参加年月日: 11/01/05 最新の投稿
Hi Alok,
I am at same situation where you were, I am using apache POI API for word document creation. my build.gradle and bnd.bnd files are as under.

build.gradle :

dependencies {
  
	compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
	compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
	compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
	compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
	compileOnly group: "jstl", name: "jstl", version: "1.2"
	compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
	compile group: 'org.apache.poi', name: 'poi', version: '3.16'
	compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.16'
	compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.16'
	compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
	compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.5.0'
	compile group: 'com.github.virtuald', name: 'curvesapi', version: '1.05'
	compile group: 'org.apache.poi', name: 'ooxml-schemas', version: '1.3'
}


bnd.bnd :

Include-Resource:@poi-3.16.jar, @poi-ooxml-3.16.jar, @poi-ooxml-schemas-3.16.jar, @dom4j-1.6.1.jar,@xmlbeans-2.5.0.jar,@curvesapi-1.05.jar,@ooxml-schemas-1.3.jar


I am getting same error as you.
Unresolved requirement: Import-Package: com.sun.javadoc



Hope you found some solution of problem. If yes can you please share the detail.

Regards,
Sandip Patel
thumbnail
6年前 に Christoph Rabel によって更新されました。

RE: Unresolved requirement: Import-Package:

Liferay Legend 投稿: 1554 参加年月日: 09/09/24 最新の投稿
I guess, you need to deploy tools.jar in Liferay.
https://mvnrepository.com/artifact/com.sun/tools

No idea which version you need. Maybe the error message is more specific. Simply deploy it or copy it into the osgi/modules folder. If it doesn't fit, delete it from the osgi/modules folder and try another version.
thumbnail
6年前 に krishna mohan mathakala によって更新されました。

RE: Unresolved requirement: Import-Package:

Junior Member 投稿: 68 参加年月日: 12/09/08 最新の投稿
Sandip Patel:
Hi

I am getting same error as you.
Unresolved requirement: Import-Package: com.sun.javadoc



did you find the root cause for this issue.
thumbnail
6年前 に Steve Weiss によって更新されました。

RE: Unresolved requirement: Import-Package:

Regular Member 投稿: 107 参加年月日: 11/09/20 最新の投稿
krishna mohan mathakala:
Sandip Patel:
Hi

I am getting same error as you.
Unresolved requirement: Import-Package: com.sun.javadoc



did you find the root cause for this issue.



I'm getting the same error. I tried deploying tools.jar, it's in the osgi/modules directory but that didn't get rid of the error. My bnd.bnd looks like this:
Bundle-SymbolicName: gov.nasa.hq.liferay.audit.documentlibrary
Bundle-Version: 1.0.0
-sources: true
Bundle-Version: 1.0.0
-sources: true
Import-Package:\
 com.sun.javadoc.*
Include-Resource:\
 @poi-3.17.jar,\
 @poi-ooxml-3.17.jar,\
 @poi-ooxml-schemas-3.17.jar,\
 @poi-excelant-3.17.jar,\
 @poi-scratchpad-3.17.jar,\
 @xmlbeans-2.6.0.jar,\
 @curvesapi-1.05.jar,\
 @ooxml-security-1.1.jar,\
 @ooxml-schemas-1.3.jar,\
 @hq_applicationProperties-1.3.6.jar,\
 @hq_utils-2.0.9.jar,\
 @hq_htmlutils-1.0.3.jar,\
 @hq_sqlutils-3.0.0.jar,\
 @commons-lang3-3.4.jar,\
 @commons-collections4-4.1.jar


I just added the Import-Package directive to try and explicitly import the com.sun.javadoc stuff but it didn't make any difference.
thumbnail
6年前 に krishna mohan mathakala によって更新されました。

RE: Unresolved requirement: Import-Package:

Junior Member 投稿: 68 参加年月日: 12/09/08 最新の投稿
Hi,

Please add the below code snippet to your and.bnd

!com.sun.javadoc,\
*
this should resolve your problem.
thumbnail
6年前 に Steve Weiss によって更新されました。

RE: Unresolved requirement: Import-Package:

Regular Member 投稿: 107 参加年月日: 11/09/20 最新の投稿
Now I get this error:
:extensions:DocumentLibraryAudit:jar[Input file does not exist: !com.sun.javadoc]

FAILURE: Build failed with an exception.

My bnd.bnd looks like this:

Bundle-SymbolicName: gov.nasa.hq.liferay.audit.documentlibrary
Bundle-Version: 1.0.0
-sources: true
Bundle-Version: 1.0.0
-sources: true
Include-Resource:\
 @poi-3.17.jar,\
 @poi-ooxml-3.17.jar,\
 @poi-ooxml-schemas-3.17.jar,\
 @poi-excelant-3.17.jar,\
 @poi-scratchpad-3.17.jar,\
 @xmlbeans-2.6.0.jar,\
 @curvesapi-1.05.jar,\
 @ooxml-security-1.1.jar,\
 @ooxml-schemas-1.3.jar,\
 @hq_applicationProperties-1.3.6.jar,\
 @hq_utils-2.0.9.jar,\
 @hq_htmlutils-1.0.3.jar,\
 @hq_sqlutils-3.0.0.jar,\
 @commons-lang3-3.4.jar,\
 @commons-collections4-4.1.jar,\
 !com.sun.javadoc,\
 *
thumbnail
6年前 に krishna mohan mathakala によって更新されました。

RE: Unresolved requirement: Import-Package:

Junior Member 投稿: 68 参加年月日: 12/09/08 最新の投稿
Steve Weiss:
Now I get this error:
:extensions:DocumentLibraryAudit:jar[Input file does not exist: !com.sun.javadoc]

FAILURE: Build failed with an exception.

My bnd.bnd looks like this:

Bundle-SymbolicName: gov.nasa.hq.liferay.audit.documentlibrary
Bundle-Version: 1.0.0
-sources: true
Bundle-Version: 1.0.0
-sources: true
Include-Resource:\
 @poi-3.17.jar,\
 @poi-ooxml-3.17.jar,\
 @poi-ooxml-schemas-3.17.jar,\
 @poi-excelant-3.17.jar,\
 @poi-scratchpad-3.17.jar,\
 @xmlbeans-2.6.0.jar,\
 @curvesapi-1.05.jar,\
 @ooxml-security-1.1.jar,\
 @ooxml-schemas-1.3.jar,\
 @hq_applicationProperties-1.3.6.jar,\
 @hq_utils-2.0.9.jar,\
 @hq_htmlutils-1.0.3.jar,\
 @hq_sqlutils-3.0.0.jar,\
 @commons-lang3-3.4.jar,\
 @commons-collections4-4.1.jar,\



Hi !com.sun.javadoc,\ should come under Import-Package header as shown below(do not forget to keep the * at last). It should not be under Include-Resource header.


Import-Package: \
!com.sun.*,\
*
thumbnail
6年前 に Steve Weiss によって更新されました。

RE: Unresolved requirement: Import-Package:

Regular Member 投稿: 107 参加年月日: 11/09/20 最新の投稿
krishna mohan mathakala:
Steve Weiss:
Now I get this error:
:extensions:DocumentLibraryAudit:jar[Input file does not exist: !com.sun.javadoc]

FAILURE: Build failed with an exception.

My bnd.bnd looks like this:

Bundle-SymbolicName: gov.nasa.hq.liferay.audit.documentlibrary
Bundle-Version: 1.0.0
-sources: true
Bundle-Version: 1.0.0
-sources: true
Include-Resource:\
 @poi-3.17.jar,\
 @poi-ooxml-3.17.jar,\
 @poi-ooxml-schemas-3.17.jar,\
 @poi-excelant-3.17.jar,\
 @poi-scratchpad-3.17.jar,\
 @xmlbeans-2.6.0.jar,\
 @curvesapi-1.05.jar,\
 @ooxml-security-1.1.jar,\
 @ooxml-schemas-1.3.jar,\
 @hq_applicationProperties-1.3.6.jar,\
 @hq_utils-2.0.9.jar,\
 @hq_htmlutils-1.0.3.jar,\
 @hq_sqlutils-3.0.0.jar,\
 @commons-lang3-3.4.jar,\
 @commons-collections4-4.1.jar,\



Hi !com.sun.javadoc,\ should come under Import-Package header as shown below(do not forget to keep the * at last). It should not be under Include-Resource header.


Import-Package: \
!com.sun.*,\
*



Bingo! That worked. Thank you very much.
6年前 に alok Pal によって更新されました。

RE: Unresolved requirement: Import-Package: (回答)

New Member 投稿: 21 参加年月日: 16/08/31 最新の投稿
Hi ,

yes I able to resolve this dependency error.

Please keep this required jars in build.gradle


//this is POI jars and compile dependency of POI
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.8-beta4'
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.3.0'
compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'org.apache.poi', name: 'poi', version: '3.8-beta4'
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.8-beta4'
compile group: 'stax', name: 'stax-api', version: '1.0.1'
compile group: 'xml-apis', name: 'xml-apis', version: '1.0.b2'
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.3.0'
compile group: 'org.apache.poi', name: 'poi', version: '3.7'

dependencies {
	compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
	compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
	compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
	compileOnly group: "javax.servlet", name: "servlet-api", version: "2.5"
	compileOnly group: "jstl", name: "jstl", version: "1.2"
	compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"
	
	compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.8-beta4'
	compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.3.0'
	compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
	compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
	compile group: 'org.apache.poi', name: 'poi', version: '3.8-beta4'
	compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.8-beta4'
	compile group: 'stax', name: 'stax-api', version: '1.0.1'
	compile group: 'xml-apis', name: 'xml-apis', version: '1.0.b2'
	compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.3.0'
	compile group: 'org.apache.poi', name: 'poi', version: '3.7'
		
}


And yes,please include some this jars in your bnd.bnd file

Bundle-SymbolicName: excel.sheet.generator
Bundle-Version: 1.0.0

Include-Resource: @commons-codec-1.5.jar,
@dom4j-1.6.1.jar,
@poi-3.8-beta4.jar,
@poi-ooxml-3.8-beta4.jar,
@poi-ooxml-schemas-3.8-beta4.jar,
@stax-api-1.0.1.jar,
@xml-apis-1.0.b2.jar,
@xmlbeans-2.3.0.jar
Private-Package: \
org.apache.poi.hssf.usermodel,\
org.apache.poi.*,\
org.apache.poi.ddf,\

Import-Package: \
	!junit.framework,\
	!org.apache.xmlbeans.*,\
	!org.apache.poi.hsmf,\
	!org.apache.poi.hslf.extractor,\
	!org.apache.poi.hpbf.extractor,\
	!org.apache.poi.*,\
	!org.openxmlformats.schemas.*,\
	!schemasMicrosoftComOfficeExcel,\
	!schemasMicrosoftComOfficeOffice,\
	!schemasMicrosoftComVml,\
	!junit.textui,\
	*


/-------------------------------------

Include-Resource: @commons-codec-1.5.jar,
@dom4j-1.6.1.jar,
@poi-3.8-beta4.jar,
@poi-ooxml-3.8-beta4.jar,
@poi-ooxml-schemas-3.8-beta4.jar,
@stax-api-1.0.1.jar,
@xml-apis-1.0.b2.jar,
@xmlbeans-2.3.0.jar
this are the file which want for excel sheet generation and
some package we have to ignore using ...
Import-Package: \
!junit.framework,\
!org.apache.xmlbeans.*,\
!org.apache.poi.hsmf,\
!org.apache.poi.hslf.extractor,\
!org.apache.poi.hpbf.extractor,\
!org.apache.poi.*,\
!org.openxmlformats.schemas.*,\
!schemasMicrosoftComOfficeExcel,\
!schemasMicrosoftComOfficeOffice,\
!schemasMicrosoftComVml,\
!junit.textui,\
*


This way I resolve my problem thank you.
6年前 に Safiya Ibrahim によって更新されました。

RE: Unresolved requirement: Import-Package:

New Member 投稿: 4 参加年月日: 17/04/07 最新の投稿
HI ,
Even following teh same step I am still getting the below error,
I am using liferay 7 with tomcat
org.osgi.framework.BundleException: Could not resolve module: excelMainDemo [554]_ Unresolved requirement: Import-Package: com.sun.javadoc_ [Sanitized]

build.gradle file
compileOnly group: "com.liferay.portal", name: "com.liferay.portal.kernel", version: "2.0.0"
compileOnly group: "com.liferay.portal", name: "com.liferay.util.taglib", version: "2.0.0"
compileOnly group: "javax.portlet", name: "portlet-api", version: "2.0"
compileOnly group: "javax.servlet", name: "javax.servlet-api", version: "3.0.1"
compileOnly group: "jstl", name: "jstl", version: "1.2"
compileOnly group: "org.osgi", name: "org.osgi.compendium", version: "5.0.0"

compile project(":modules:excelSaveService:excelSaveService-service")
compile group: 'org.apache.poi', name: 'poi-ooxml', version: '3.8-beta4'
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.3.0'
compile group: 'commons-codec', name: 'commons-codec', version: '1.5'
compile group: 'dom4j', name: 'dom4j', version: '1.6.1'
compile group: 'org.apache.poi', name: 'poi', version: '3.8-beta4'
compile group: 'org.apache.poi', name: 'poi-ooxml-schemas', version: '3.8-beta4'
compile group: 'stax', name: 'stax-api', version: '1.0.1'
compile group: 'xml-apis', name: 'xml-apis', version: '1.0.b2'
compile group: 'org.apache.xmlbeans', name: 'xmlbeans', version: '2.3.0'
compile group: 'org.apache.poi', name: 'poi', version: '3.7'

Build.bnd
Bundle-Name: excelMainDemo
Bundle-SymbolicName: excelMainDemo
Bundle-Version: 1.0.0

Include-Resource: @commons-codec-1.5.jar,
@dom4j-1.6.1.jar,
@poi-3.8-beta4.jar,
@poi-ooxml-3.8-beta4.jar,
@poi-ooxml-schemas-3.8-beta4.jar,
@stax-api-1.0.1.jar,
@xml-apis-1.0.b2.jar,
@xmlbeans-2.3.0.jar,\


Private-Package: \
org.apache.poi.hssf.usermodel,\
org.apache.poi.*,\
org.apache.poi.ddf,\


Import-Package: \
!com.sun.javadoc,\
!com.sun.*,\
!junit.framework,\
!org.apache.xmlbeans.*,\
!org.apache.poi.hsmf,\
!org.apache.poi.hslf.extractor,\
!org.apache.poi.hpbf.extractor,\
!org.apache.poi.*,\
!org.openxmlformats.schemas.*,\
!schemasMicrosoftComOfficeExcel,\
!schemasMicrosoftComOfficeOffice,\
!schemasMicrosoftComVml,\
!junit.textui,\
*

PLEASE HELP

THANKS
Safiya
thumbnail
5年前 に saleem khan によって更新されました。

RE: Unresolved requirement: Import-Package:

Junior Member 投稿: 71 参加年月日: 13/11/16 最新の投稿

Hi,

 

Please refer the link below. I have posted a solution which worked

https://community.liferay.com/forums/-/message_boards/message/111758458

 

Thanks & Regards

Saleem Khan