Unresolved requi rement: Import-Package:com.liferay.portal.kernel.model 问题解决
程序员文章站
2022-07-15 13:22:02
...
开发环境
系统:windows10
开发工具IDE: idea
数据库:MySql 8.0.20
Liferay SDK: 7.3.0
Liferay运行环境:7.3.2
Liferay Tomcat: 9.0.33
创建完module 构建部署没有出错,就是把它放在Liferay 运行环境中运行时报如下错误
ERROR [Framework Event Dispatcher: Equinox Container: a223806f-5035-48e4-be05-175ec6ed9b0d][Framework:93] FrameworkEvent ERROR
org.osgi.framework.BundleException: Could not resolve module: student.api [2293]_ Unresolved requirement: Import-Package: com.liferay.portal.kernel.model; version="[4.1.0,5.0.0)"_ [Sanitized]
at org.eclipse.osgi.container.Module.start(Module.java:444)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1682)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1662)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1624)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1555)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:230)
at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:340)
查了各种资料查不出来,包括有个叫“虾老三”的二货,只说版本问题,也没具体说怎么配置,然后哥就各种试,最终确定把Liferay SDK版本号和Liferay运行环境版本号一致即可。
Liferay 创建项目时选择 7.3.0
Liferay 运行时环境改为这个:liferay-ce-portal-7.3.0-ga1
就OK 了