我继续学习本教程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
清单没有变化。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"
谁能帮帮我吗??
清理osgi缓存后,它的工作原理:-)
程序参数
-os ${target.os}
-ws ${target.ws}
-arch ${target.arch}
-nl ${target.nl}
-consoleLog -console
-clean
虚拟机参数
-Dosgi.requiredJavaVersion=1.8
-Xms40m -Xmx512m
-Declipse.ignoreApp=true
-Dosgi.noShutdown=true
-Dorg.osgi.service.http.port=9090
JAX-RS (JSR 311) 是一个社区驱动的标准用于使用 Java 构建 RESTful Web 服务。JAX-RS 的参考实现是 Jersey,并提供 OSGI 绑定。该项目用于连接服务层的 Jersey 和 OSGi。这意味着 OSGi 服务可发布为 RESTful Web 服务。
JAX-RS (JSR 311) 是一个社区驱动的标准用于使用 Java 构建 RESTful Web 服务。
我的jax-rs应用程序的方法: 工作正常。但是,如果修改: 我收到一个错误 服务器Jboss 7.1.1 请告诉我怎么了。 PS.sorry我的英语不好。
JAX-RS教程提供了JAX-RS API的概念和示例。 这个JAX-RS教程专为初学者和专业人士设计。 JAX-RS API有两个主要实现。它们分别如下 - Jersey RESTEasy 如下图示 - RESTful JAX-RS示例(Jersey) https://www.xnip.cn/web_service/jax-rs-example-jersey.html JAX-WS注释示例 ht
问题内容: 我正在使用我的Web服务。我有通用的功能,想使用继承。我正在提供简单的CRUD操作。我已经定义了这样的接口: 我有一个实现此接口的抽象类: 最后,我的实现类仅为资源提供PATH: 当我尝试访问我的资源时(假设上下文根为/): 我得到一个404,它说找不到。我的想法是,在继承的某个地方,它弄乱了我认为资源应位于的位置的路径。有什么想法吗? 编辑 webresources在下面定义。该类由
我们可以通过 实现创建JAX-RS示例。 为此,需要加载 jersey相关jar文件或使用Maven框架。 在这个例子中,我们使用jersey jar文件来实现JAX-RS jersey示例。 Jersey Jar文件下载网址:https://jersey.github.io/download.html 打开Eclipse,创建一个Web工程: restfuljersey,如下图所示 - JAX-