【发布时间】:2015-05-13 01:23:06
【问题描述】:
我有一个 OSGi 应用程序,它包含 3 个捆绑包 -
1 - LoggingWrapper,充当 log4j 和 slf4j jar 的包装器,并导出 org.slf4j.* 包。
2 - MyProject,其中包含 JPA 代码,并导入以下包:
Import-Package: javax.management,
javax.naming,
javax.persistence;version="1.1.0",
javax.persistence.criteria;version="1.1.0",
javax.persistence.metamodel;version="1.1.0",
javax.sql;version="0.0.0",
javax.transaction;version="1.1.0",
javax.transaction.xa;version="1.1.0",
org.apache.openjpa.enhance;version="2.2.0",
org.apache.openjpa.util;version="2.2.0",
org.slf4j
在服务器上部署它会导致以下错误:
[AUDIT ] CWWKZ0404E: An exception was generated when trying to resolve the contents of the application JpaTestApp. The exception text from the OSGi framework is: Uses constraint violation. Unable to resolve resource MyProject [IFileAdapter wrapping file with url file:/D:/programs/WebSphere/liberty/wlp/usr/servers/defaultServer/apps/JpaTestApp.eba/MyProject_1.0.0.jar] because it is exposed to package 'org.slf4j' from resources LoggingWrapper [IFileAdapter wrapping file with url file:/D:/programs/WebSphere/liberty/wlp/usr/servers/defaultServer/apps/JpaTestApp.eba/LoggingWrapper_1.0.0.jar] and com.ibm.ws.slf4j-api.1.7.7 [osgi.identity; osgi.identity="com.ibm.ws.slf4j-api.1.7.7"; type="osgi.bundle"; version:Version="1.0.7.cl50420141211-1039"] via two dependency chains.
Chain 1:
MyProject [IFileAdapter wrapping file with url file:/D:/programs/WebSphere/liberty/wlp/usr/servers/defaultServer/apps/JpaTestApp.eba/MyProject_1.0.0.jar]
import: (&(osgi.wiring.package=org.slf4j)(version>=0.0.0))
|
export: osgi.wiring.package: org.slf4j
LoggingWrapper [IFileAdapter wrapping file with url file:/D:/programs/WebSphere/liberty/wlp/usr/servers/defaultServer/apps/JpaTestApp.eba/LoggingWrapper_1.0.0.jar]
Chain 2:
MyProject [IFileAdapter wrapping file with url file:/D:/programs/WebSphere/liberty/wlp/usr/servers/defaultServer/apps/JpaTestApp.eba/MyProject_1.0.0.jar]
import: (&(osgi.wiring.package=org.apache.openjpa.util)(version>=2.2.0))
|
export: osgi.wiring.package=org.apache.openjpa.util; uses:=org.slf4j
com.ibm.ws.jpa [osgi.identity; osgi.identity="com.ibm.ws.jpa"; type="osgi.bundle"; version:Version="1.0.7.cl50420141211-1039"]
import: (osgi.wiring.package=org.slf4j)
|
export: osgi.wiring.package: org.slf4j
com.ibm.ws.slf4j-api.1.7.7 [osgi.identity; osgi.identity="com.ibm.ws.slf4j-api.1.7.7"; type="osgi.bundle"; version:Version="1.0.7.cl50420141211-1039"]
[AUDIT ] CWWKZ0020I: Application JpaTestApp not updated.
从应用程序中删除“LoggingWrapper”包会导致以下错误:
[AUDIT ] CWWKZ0058I: Monitoring dropins for applications.
[AUDIT ] CWWKZ0404E: An exception was generated when trying to resolve the contents of the application JpaTestApp. The exception text from the OSGi framework is: Unable to resolve IFileAdapter wrapping file with url file:/D:/programs/WebSphere/liberty/wlp/usr/servers/experimentalServer/apps/JpaTestApp.eba/XLetDBUtility_1.0.0.jar: missing requirement org.apache.aries.subsystem.core.archive.ImportPackageRequirement: namespace=osgi.wiring.package, attributes={}, directives={filter=(&(osgi.wiring.package=org.slf4j)(version>=0.0.0))}, resource=IFileAdapter wrapping file with url file:/D:/programs/WebSphere/liberty/wlp/usr/servers/experimentalServer/apps/JpaTestApp.eba/XLetDBUtility_1.0.0.jar
[AUDIT ] CWWKZ0012I: The application JpaTestApp was not started.
如何解决这些错误?
【问题讨论】:
标签: java jpa osgi websphere-liberty