- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我正在使用 maven-bundle-plugin 构建一个 war 文件作为一个包,我想在 Felix 中部署它。这是相同的 POM 文件。
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>net.java</groupId>
<artifactId>jvnet-parent</artifactId>
<version>1</version>
</parent>
<groupId>com.sun.jersey.samples.helloworld-osgi-webapp</groupId>
<artifactId>war-bundle</artifactId>
<version>1.11</version>
<name>Helloworld OSGi WebApp - Jersey Sample WAR</name>
<packaging>war</packaging>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.core</artifactId>
<version>4.2.0</version>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>org.osgi</groupId>
<artifactId>org.osgi.compendium</artifactId>
<version>4.2.0</version>
<!-- <scope>provided</scope> -->
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-server</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.codehaus.jettison</groupId>
<artifactId>jettison</artifactId>
<version>1.1</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-core-asl</artifactId>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-mapper-asl</artifactId>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.5.5</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>3.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.felix</groupId>
<artifactId>org.apache.felix.http.api</artifactId>
<version>2.0.4</version>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<inherited>true</inherited>
<configuration>
<source>1.6</source>
<target>1.6</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<manifestLocation>${project.build.directory}/META-INF</manifestLocation>
<supportedProjectTypes>
<supportedProjectType>bundle</supportedProjectType>
<supportedProjectType>war</supportedProjectType>
</supportedProjectTypes>
<instructions>
<Bundle-SymbolicName>${pom.artifactId}</Bundle-SymbolicName>
<Import-Package>com.sun.jersey.api.core,com.sun.jersey.spi.container.servlet,*</Import-Package>
<Export-Package>com.sun.jersey.samples.helloworld</Export-Package>
<Webapp-Context>jersyweb</Webapp-Context>
<Web-ContextPath>jersyweb</Web-ContextPath>
<Bundle-Activator>com.sun.jersey.samples.helloworld.WebAppContextListener</Bundle-Activator>
<Bundle-ClassPath>WEB-INF/classes</Bundle-ClassPath>
<Embed-Dependency>*;scope=compile|runtime;inline=false</Embed-Dependency>
<Embed-Transitive>true</Embed-Transitive>
</instructions>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.1-alpha-2</version>
<configuration>
<attachClasses>true</attachClasses>
<archive>
<manifestFile>${project.build.directory}/META-INF/MANIFEST.MF</manifestFile>
<manifestEntries>
<Bundle-ClassPath>WEB-INF/classes</Bundle-ClassPath>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings only. It has no influence on the Maven build itself.-->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.apache.felix
</groupId>
<artifactId>
maven-bundle-plugin
</artifactId>
<versionRange>
[2.0.1,)
</versionRange>
<goals>
<goal>manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
<pluginExecution>
<pluginExecutionFilter>
<groupId>
org.jvnet.jaxb2.maven2
</groupId>
<artifactId>
maven-jaxb2-plugin
</artifactId>
<versionRange>
[0.8.1,)
</versionRange>
<goals>
<goal>generate</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
当我使用 maven install 构建它时,我可以在 war 包的 META-INF 文件夹中看到一个逻辑上正确的 MANIFEST.MF 文件。这是 MANIFEST.MF。
**Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven Bundle Plugin
Built-By: parag.ki
Build-Jdk: 1.6.0_18
Bundle-ClassPath: WEB-INF/classes,servlet-api-2.5.jar,org.osgi.core-4.
2.0.jar,org.osgi.compendium-4.2.0.jar,jersey-core-1.11.jar,jersey-ser
ver-1.11.jar,asm-3.1.jar,jettison-1.1.jar,stax-api-1.0.1.jar,jackson-
core-asl-1.5.5.jar,jackson-mapper-asl-1.5.5.jar,jackson-jaxrs-1.5.5.j
ar,jackson-xc-1.5.5.jar,org.apache.felix.http.api-2.0.4.jar
Bnd-LastModified: 1333436962460
Bundle-Activator: com.sun.jersey.samples.helloworld.WebAppContextListe
ner
Bundle-Description: Java.net - The Source for Java Technology Collabor
ation
Bundle-ManifestVersion: 2
Bundle-Name: Helloworld OSGi WebApp - Jersey Sample WAR
Bundle-SymbolicName: war-bundle
Bundle-Version: 1.11.0
Embed-Dependency: *;scope=compile|runtime;inline=false
Embed-Transitive: true
Embedded-Artifacts: servlet-api-2.5.jar;g="javax.servlet";a="servlet-a
pi";v="2.5",org.osgi.core-4.2.0.jar;g="org.osgi";a="org.osgi.core";v=
"4.2.0",org.osgi.compendium-4.2.0.jar;g="org.osgi";a="org.osgi.compen
dium";v="4.2.0",jersey-core-1.11.jar;g="com.sun.jersey";a="jersey-cor
e";v="1.11",jersey-server-1.11.jar;g="com.sun.jersey";a="jersey-serve
r";v="1.11",asm-3.1.jar;g="asm";a="asm";v="3.1",jettison-1.1.jar;g="o
rg.codehaus.jettison";a="jettison";v="1.1",stax-api-1.0.1.jar;g="stax
";a="stax-api";v="1.0.1",jackson-core-asl-1.5.5.jar;g="org.codehaus.j
ackson";a="jackson-core-asl";v="1.5.5",jackson-mapper-asl-1.5.5.jar;g
="org.codehaus.jackson";a="jackson-mapper-asl";v="1.5.5",jackson-jaxr
s-1.5.5.jar;g="org.codehaus.jackson";a="jackson-jaxrs";v="1.5.5",jack
son-xc-1.5.5.jar;g="org.codehaus.jackson";a="jackson-xc";v="1.5.5",or
g.apache.felix.http.api-2.0.4.jar;g="org.apache.felix";a="org.apache.
felix.http.api";v="2.0.4"
Import-Package: com.sun.jersey.api.core,com.sun.jersey.samples.hellowo
rld,com.sun.jersey.spi.container.servlet,com.sun.net.httpserver,javax
.activation,javax.annotation.security,javax.imageio,javax.imageio.spi
,javax.imageio.stream,javax.mail,javax.mail.internet,javax.mail.util,
javax.microedition.io,javax.naming,javax.security.auth.x500,javax.xml
.bind,javax.xml.bind.annotation,javax.xml.bind.annotation.adapters,ja
vax.xml.datatype,javax.xml.parsers,javax.xml.transform,javax.xml.tran
sform.dom,javax.xml.transform.sax,javax.xml.transform.stream,org.joda
.time,org.joda.time.format,org.w3c.dom,org.w3c.dom.bootstrap,org.w3c.
dom.ls,org.xml.sax
Tool: Bnd-1.50.0
Web-ContextPath: jersyweb
Webapp-Context: jersyweb**
但是当我在 Apache Felix 中部署并启动它时,我看到以下错误。
啊! org.osgi.framework.BundleException: bundle war-bundle [5] 中 Unresolved 约束:无法解决 5.0:缺少要求 [5.0] osgi.wiring.package; (osgi.wiring.package=com.sun.jersey.api.core)
包 com.sun.jersey.api.core 是 jersey-core-1.11.jar 的一部分,它已经在 MANIFEST.MF 的 Bundle-ClassPath 中提到,那么为什么我会收到此错误?
如果我开始放置相应的捆绑文件,例如 jersey-core-1.11.jar 的 bundle ,那么问题就解决了,但我认为这不是一个很好的解决方案。事实上,为此目的,只提供了 maven bundle 插件和标签。
请指教。
最佳答案
快速查看 MANIFEST 文件后,我发现 有一个用于 com.sun.jersey.api.core 的导入包。我想你也嵌入了这个包,但这对这种依赖没有影响。如果你要求依赖,你会得到它
只需将其删除即可,在 Maven 中,您可以将其从 Import-Package 行中删除。
此外,您确实嵌入了很多东西。我认为在 webapp 中嵌入 servlet api 不是一个好主意,因为应用程序服务器提供了它。它可能有效,但在部署到其他应用程序服务器时可能会遇到麻烦。
关于osgi - 在 Felix.missing requirement [5.0] osgi.wiring.package 中启动 bundle 时出现问题; (osgi.wiring.package=com.sun.jersey.api.core),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9989034/
我在 trying to share the Struts packages 时遇到了这个问题在 OSGi 容器内的多个包之间。我想避免在包内重复依赖项并在它们之间引入新的依赖项(通过让一个包导出其内
我正在考虑在我们的项目中管理版本控制的最佳方式。目前,我们 bundle 中的每个包都是导出的(这将在以后改进,所以不要因为这个失礼而挂断电话)。我们正在使用 maven-bundle-plugin,
我正在进行一个项目,我们将迁移基于大量定制技术的主要软件系统,使其基于 OSGi 服务。为此,我们可能需要某种与 OSGi 服务配合良好的消息总线。 同步和异步传送 仅点对点 保证交付 - 最好通过文
我的项目有一组自定义定义的注释,它们可以出现在 OSGi 4.3 框架中部署的任何包中。我想在类路径中找到任何带有这些注释的类。我尝试使用 BundleWiring.listResources(...
我创建了一个片段包来访问一些添加到第二方 jar 的功能。我的片段应该注册一个服务来公开这个新功能。它似乎不起作用。在我深入进行故障排除之前,我想知道这是否被允许?也就是说,Felix SCR 的 b
OSGi 是 Java 的动态模块化系统。好的,但是基线主题是什么,为什么要开发 OSGi?使用 OSGi 有什么好处?开发 OSGi 的主要故事是什么?它为什么存在? 最佳答案 如果你仔细观察,Ja
当一个包被更新(比如修复一个错误)时,当前正在使用正在更新的包的其他包会发生什么? 假设有两个捆绑包 service 和 dao。假设当我发出更新 dao 层的命令时,服务包中的类正在使用 dao 包
在 OSGi 下,组件与服务之间的主要区别是什么?据我了解,所有服务都必须是组件,但并非所有组件都必须是服务。 在示例用例中使用其中一种比另一种有什么好处? 最佳答案 “组件”的定义不如服务正式。 服
这合法吗?org.fragment1 的 MANIFEST.MF(org.host 是普通包,不是片段): Bundle-SymbolicName: org.fragment1 Fragment-Ho
在我当前的应用程序中,我在几个地方遇到了这种模式:我在一个 bundle 中有两个服务接口(interface),它们执行不同但相关的工作。 interface Service1 { ... } in
我的 OSGi 应用程序需要一个 jar(sample;version=A),并且我必须将相同的 jar(sample;version=B) 用于我开发的新包。 示例 jar 有一些增强功能,因此我不
osgi> install file:D:\f1\*.jar osgi> install --start file:D:\f1\*.jar 以上命令在 WSO2 OSGi 控制台中是非法的。如何从文件
和有什么不一样和 在spring DM的xml配置文件中。 最佳答案 可用于获取 对现有 OSGi 服务的引用,以便您的 bean 可以使用它。 可用于导出将 bean 作为 OSGi 服务,以
我有一个应用程序暂时使用 Equinox 作为 osgi 框架。直到现在我都使用系统属性 osgi.install.area 来指定我的包在哪里 ${osgi.install.area}/ plu
背景 在过去一年左右的时间里,我设计了许多工具,旨在帮助我为 XPage 编程。这些工具主要包括帮助程序 java 类、扩展日志记录(使用 OpenLogger 和我自己的东西),以及我个人觉得我不能
我有一个 OSGi 组件 MyComponent . 该组件引用了服务 MyService .现在MyService有几个实现 MyServiceImpl1和 MyServiceImpl2 . MyC
我有几个 OSGi 包,每个都可以从 OSGi 包存储库更新。 当我启动我的 OSGi 框架 (Apache Felix) 时,我希望第一个包启动并检查所有已安装包的更新。如果有可用更新,它应该更新每
当我们在 Apache Felix Web OSGi 控制台的配置选项卡中更新组件的任何配置时,这些配置设置保存在哪里?这是针对 AEM 6.0 或更高版本。 最佳答案 手动保存的配置设置存储在 cr
我有简单的 OSGI 事件监听器类 @Component(immediate = true) @Service(value = { EventHandler.class, JobConsumer.cl
我们正在开发一个网络应用程序(我们称之为图像库),我们已经确定了以下需求: 该应用程序迎合由一组用户组成的客户。 可以动态创建新客户并由客户管理其用户 客户有不同的功能集,可以动态更改 客户可以开发自
我是一名优秀的程序员,十分优秀!