温馨提示:本文翻译自stackoverflow.com,查看原文请点击:java - My portlet don't start after the adding of postgres jdbc in my portlet

java - 在portlet中添加postgres jdbc之后,我的portlet无法启动

发布于 2020-03-27 11:13:51

我的OSGI Portlet有问题。jdbc.jar通过添加了portlet bnd.bnd

这是我的方法:

Bundle-Name: bd-portlet
Bundle-SymbolicName: com.test
Bundle-Version: 1.0.0
Export-Package: com.test.constants
Bundle-ClassPath:\
  .,\
  lib/postgresql.jar
-includeresource:\
  lib/postgresql.jar=postgresql-42.2.5.jar

我看到我的portlet的jar和jdbc在lib文件夹中。但是现在我的portlet无法启动。这是屏幕输出:

org.osgi.framework.BundleException: Could not resolve module: com.test 2019-07-03 14:13:51.054 ERROR [Framework Event Dispatcher: Equinox Container: e04d1c6e-9a3c-4356-88d0-325b8207118b][com_test:97] FrameworkEvent ERROR 
org.osgi.framework.BundleException: Could not resolve module: com.test [1012]_  Unresolved requirement: Import-Package: com.sun.jna_ [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.SystemModule.startWorker(SystemModule.java:264)
    at org.eclipse.osgi.container.Module.doStart(Module.java:581)
    at org.eclipse.osgi.container.Module.start(Module.java:449)
    at org.eclipse.osgi.container.SystemModule.start(SystemModule.java:188)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:428)
    at org.eclipse.osgi.internal.framework.EquinoxBundle.start(EquinoxBundle.java:447)
    at org.eclipse.osgi.launch.Equinox.start(Equinox.java:115)
    at com.liferay.portal.bootstrap.ModuleFrameworkImpl.startFramework(ModuleFrameworkImpl.java:403)
    at com.liferay.portal.module.framework.ModuleFrameworkUtilAdapter.startFramework(ModuleFrameworkUtilAdapter.java:100)
    at com.liferay.portal.spring.context.PortalContextLoaderListener.contextInitialized(PortalContextLoaderListener.java:309)
    at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4682)
    at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5150)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase.addChildInternal(ContainerBase.java:713)
    at org.apache.catalina.core.ContainerBase.addChild(ContainerBase.java:690)
    at org.apache.catalina.core.StandardHost.addChild(StandardHost.java:695)
    at org.apache.catalina.startup.HostConfig.deployDescriptor(HostConfig.java:631)
    at org.apache.catalina.startup.HostConfig$DeployDescriptor.run(HostConfig.java:1832)
    at java.base/java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:515)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:118)
    at org.apache.catalina.startup.HostConfig.deployDescriptors(HostConfig.java:526)
    at org.apache.catalina.startup.HostConfig.deployApps(HostConfig.java:425)
    at org.apache.catalina.startup.HostConfig.start(HostConfig.java:1577)
    at org.apache.catalina.startup.HostConfig.lifecycleEvent(HostConfig.java:309)
    at org.apache.catalina.util.LifecycleBase.fireLifecycleEvent(LifecycleBase.java:123)
    at org.apache.catalina.util.LifecycleBase.setStateInternal(LifecycleBase.java:424)
    at org.apache.catalina.util.LifecycleBase.setState(LifecycleBase.java:367)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:929)
    at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:831)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1377)
    at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1367)
    at java.base/java.util.concurrent.FutureTask.run(FutureTask.java:264)
    at org.apache.tomcat.util.threads.InlineExecutorService.execute(InlineExecutorService.java:75)
    at java.base/java.util.concurrent.AbstractExecutorService.submit(AbstractExecutorService.java:140)
    at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:902)
    at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:262)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardService.startInternal(StandardService.java:423)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:928)
    at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:183)
    at org.apache.catalina.startup.Catalina.start(Catalina.java:634)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.apache.catalina.startup.Bootstrap.start(Bootstrap.java:350)
    at org.apache.catalina.startup.Bootstrap.main(Bootstrap.java:492)

我添加com.sun.jnabuild.gradle我的bnd.bnd文件中:

Bundle-Name: bd-portlet
Bundle-SymbolicName: com.test
Bundle-Version: 1.0.0
Export-Package: com.test.constants
Bundle-ClassPath:\
  .,\
  lib/postgresql.jar,\lib/jna.jar
-includeresource:\
  lib/postgresql.jar=postgresql-42.2.5.jar,\
  lib/jna.jar=jna-3.0.9.jar

,但没有改变。我的portlet无法启动。请问有人有主意吗?

查看更多

查看更多

提问者
Franck Might
被浏览
14
Franck Might 2019-07-04 06:17

我解决了问题。当我们有:

org.osgi.framework.BundleException: Could not resolve module: com.test [1012]_  Unresolved requirement: Import-Package: xxxxxx [Sanitized]

只需添加:

Import-Package: \
!xxxxxx,\
*

在您的bnd.bnd文件中。就我而言,我将添加:

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

在我的bnd.bnd文件中。

发布
问题

分享
好友

手机
浏览

扫码手机浏览