我继续学习本教程 http://eclipsesource.com/blogs/2014/02/04/step-by-step-how-to-bring-jax-rs-and-osgi-together/ 它是独立的,对我来说很好。 现在我想将它与我的其他捆绑包集成,并进入以下例外:
!ENTRY com.eclipsesource.jaxrs.publisher 4 0 2014-09-16 14:11:27.203
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Exception in com.eclipsesource.jaxrs.publisher.internal.Activator.start() of bundle com.eclipsesource.jaxrs.publisher.
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:792)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
at org.eclipse.osgi.container.Module.doStart(Module.java:571)
at org.eclipse.osgi.container.Module.start(Module.java:439)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
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)
Caused by: java.lang.NoClassDefFoundError: javax/servlet/Filter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:272)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:632)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:588)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:540)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:527)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:324)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:311)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:370)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.eclipsesource.jaxrs.publisher.internal.JerseyContext.<init>(JerseyContext.java:43)
at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.createJerseyContext(JAXRSConnector.java:185)
at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.doAddHttpService(JAXRSConnector.java:74)
at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.addHttpService(JAXRSConnector.java:67)
at com.eclipsesource.jaxrs.publisher.internal.HttpTracker.addingService(HttpTracker.java:32)
at com.eclipsesource.jaxrs.publisher.internal.HttpTracker.addingService(HttpTracker.java:1)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
at com.eclipsesource.jaxrs.publisher.internal.Activator.openHttpServiceTracker(Activator.java:70)
at com.eclipsesource.jaxrs.publisher.internal.Activator.start(Activator.java:49)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
... 12 more
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter cannot be found by com.eclipsesource.jaxrs.jersey-all_2.10.1
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 45 more
Root exception:
java.lang.NoClassDefFoundError: javax/servlet/Filter
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.defineClass(ModuleClassLoader.java:272)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.defineClass(ClasspathManager.java:632)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findClassImpl(ClasspathManager.java:588)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClassImpl(ClasspathManager.java:540)
at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:527)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:324)
at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:311)
at org.eclipse.osgi.internal.loader.sources.SingleSourcePackage.loadClass(SingleSourcePackage.java:36)
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:370)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
at com.eclipsesource.jaxrs.publisher.internal.JerseyContext.<init>(JerseyContext.java:43)
at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.createJerseyContext(JAXRSConnector.java:185)
at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.doAddHttpService(JAXRSConnector.java:74)
at com.eclipsesource.jaxrs.publisher.internal.JAXRSConnector.addHttpService(JAXRSConnector.java:67)
at com.eclipsesource.jaxrs.publisher.internal.HttpTracker.addingService(HttpTracker.java:32)
at com.eclipsesource.jaxrs.publisher.internal.HttpTracker.addingService(HttpTracker.java:1)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:941)
at org.osgi.util.tracker.ServiceTracker$Tracked.customizerAdding(ServiceTracker.java:1)
at org.osgi.util.tracker.AbstractTracked.trackAdding(AbstractTracked.java:256)
at org.osgi.util.tracker.AbstractTracked.trackInitial(AbstractTracked.java:183)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:318)
at org.osgi.util.tracker.ServiceTracker.open(ServiceTracker.java:261)
at com.eclipsesource.jaxrs.publisher.internal.Activator.openHttpServiceTracker(Activator.java:70)
at com.eclipsesource.jaxrs.publisher.internal.Activator.start(Activator.java:49)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:771)
at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
at java.security.AccessController.doPrivileged(Native Method)
at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:764)
at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:721)
at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:936)
at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:319)
at org.eclipse.osgi.container.Module.doStart(Module.java:571)
at org.eclipse.osgi.container.Module.start(Module.java:439)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1582)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1562)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1533)
at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1476)
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)
Caused by: java.lang.ClassNotFoundException: javax.servlet.Filter cannot be found by com.eclipsesource.jaxrs.jersey-all_2.10.1
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:423)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:336)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:328)
at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:160)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 45 more
!ENTRY org.eclipse.osgi 4 0 2014-09-16 14:11:27.206
!MESSAGE Bundle com.eclipsesource.jaxrs.publisher_4.1.0.201407081443 [101] is not active.
正如我之前提到的那样,但我的其他捆绑包。 所有捆绑包都列在下面:
0 ACTIVE org.eclipse.osgi_3.10.0.v20140606-1445
39 ACTIVE org.apache.felix.gogo.command_0.10.0.v201209301215
40 ACTIVE org.apache.felix.gogo.runtime_0.10.0.v201209301036
41 ACTIVE org.eclipse.persistence.core_2.5.2.v20140319-9ad6abd
42 ACTIVE org.eclipse.persistence.asm_3.3.1.v201302191223
43 ACTIVE org.eclipse.persistence.jpa_2.5.2.v20140319-9ad6abd
44 ACTIVE org.apache.felix.gogo.shell_0.10.0.v201212101605
47 ACTIVE org.eclipse.persistence.antlr_3.2.0.v201302191141
48 ACTIVE org.eclipse.osgi.services_3.4.0.v20140312-2051
49 ACTIVE org.eclipse.osgi.util_3.3.0.v20131023-1243
50 ACTIVE osgi.enterprise_4.2.0.201003190513
51 ACTIVE org.eclipse.persistence.jpa.jpql_2.5.2.v20140319-9ad6abd
52 ACTIVE javax.persistence_2.1.0.v201304241213
53 ACTIVE org.eclipse.equinox.console_1.1.0.v20140131-1639
56 ACTIVE org.apache.derby_10.8.2.2
62 ACTIVE de.sambalmueslie.zitadelle.container_1.0.0.SNAPSHOT
66 ACTIVE de.sambalmueslie.zitadelle.entity_1.0.0.qualifier
69 ACTIVE de.sambalmueslie.zitadelle.common_1.0.0.SNAPSHOT
73 ACTIVE de.sambalmueslie.zitadelle.data_1.0.0.qualifier
74 ACTIVE de.sambalmueslie.zitadelle.module.town_mgt_1.0.0.qualifier
75 ACTIVE de.sambalmueslie.zitadelle.module.session_mgt_1.0.0.qualifier
78 ACTIVE com.eclipsesource.jaxrs.jersey-all_2.10.1
80 ACTIVE org.eclipse.persistence.core_2.5.0.v20130507-3faac2b
81 ACTIVE org.eclipse.jetty.continuation_8.1.14.v20131031
82 ACTIVE org.eclipse.equinox.http.servlet_1.1.500.v20140318-1755
83 ACTIVE org.eclipse.jetty.servlet_8.1.14.v20131031
84 ACTIVE org.eclipse.jetty.http_8.1.14.v20131031
85 ACTIVE org.eclipse.jetty.security_8.1.14.v20131031
86 ACTIVE org.eclipse.equinox.http.jetty_3.0.200.v20131021-1843
87 ACTIVE org.eclipse.jetty.server_8.1.14.v20131031
89 ACTIVE org.eclipse.jetty.io_8.1.14.v20131031
91 ACTIVE javax.servlet-api_3.0.1
92 ACTIVE org.eclipse.jetty.util_8.1.14.v20131031
93 ACTIVE de.sambalmueslie.zitadelle.utils_1.0.0.SNAPSHOT
97 ACTIVE com.google.gson_2.2.4
98 ACTIVE com.eclipsesource.jaxrs.provider.gson_2.0.0.201407081443
99 ACTIVE com.eclipsesource.jaxrs.provider.sse_2.0.0.201407081443
101 RESOLVED com.eclipsesource.jaxrs.publisher_4.1.0.201407081443
102 ACTIVE de.sambalmueslie.zitadelle.rest_1.0.0.qualifier
除了添加捆绑依赖项之外,Manifest.MF中没有任何更改:
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: ZitadelleRestInterface
Bundle-SymbolicName: de.sambalmueslie.zitadelle.rest
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: de.sambalmueslie.zitadelle.ExampleActivator
Bundle-Vendor: Sambasoft
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
Import-Package: javax.servlet;version="3.0.0",
javax.ws.rs;version="2.0.0",
javax.ws.rs.core;version="2.0.0",
org.osgi.framework;version="1.3.0"
Require-Bundle: org.eclipse.osgi,
de.sambalmueslie.zitadelle.data;bundle-version="1.0.0",
de.sambalmueslie.zitadelle.utils;bundle-version="1.0.0",
de.sambalmueslie.zitadelle.common;bundle-version="1.0.0",
de.sambalmueslie.zitadelle.module.session_mgt;bundle-version="1.0.0"
有人可以帮帮我吗?
答案 0 :(得分:0)
清理osgi缓存后,它可以工作: - )
程序参数
-os ${target.os}
-ws ${target.ws}
-arch ${target.arch}
-nl ${target.nl}
-consoleLog -console
-clean
vm参数
-Dosgi.requiredJavaVersion=1.8
-Xms40m -Xmx512m
-Declipse.ignoreApp=true
-Dosgi.noShutdown=true
-Dorg.osgi.service.http.port=9090