标签: apache-felix

OSGi包清单中Bundle-Classpath的字符限制?

使用Apache Felix,我有一个我编写的OSGi组件,它包含了我公司使用的一些中间件.目前它依赖于大量的外部库,我似乎已经遇到Bundle-classpath:参数长度的限制.我不得不将诸如commons-collections.jar之类的库重命名为ccoll.jar.

我很好奇是否有人有任何关于解决这个限制的建议?

Bundle-ClassPath: .,lib/log4j.jar,lib/cvfs.jar,lib/backport.jar,lib/cbeanutils.jar,lib/ccodec.jar,lib/ccoll.jar,lib/chttp.jar,lib/cjxpath.jar,lib/clang.jar,[libs redacted],lib/saaj-api.jar,lib/saaj-impl.jar,lib/Schemas.jar,lib/xbean.jar,lib/clog.jar,lib/dom4j.jar,lib/xml-apis.jar,lib/xerces.jar,lib/xalan.jar,lib/jaxp-ri.jar,lib/japi.jar,lib/mail.jar
Run Code Online (Sandbox Code Playgroud)

我想我可以通过不使用lib/bits来获得更多字符,但我很好奇这是一个错误,一个明确的限制,还是仅仅是我自己的愚蠢.

java osgi apache-felix

2
推荐指数
1
解决办法
2746
查看次数

如何启动immediate = false组件?

我有以下组件:

@Component(
    label = "Service name",
    description = "Service description",
    metatype = true,
    immediate = false)
@Properties({
    @Property(
            label = "My Label"
            name = "property-name",
            value = "my value",
            propertyPrivate = true
    )
})
@Service
public class SampleServiceImpl implements SampleService {
    private final Logger log = 
        LoggerFactory.getLogger(this.getClass());

    /**
     * OSGi Properties *
     */
    private static final String DEFAULT_SAMPLE = "hello!";
    private String mySample = DEFAULT_SAMPLE;
    @Property(label = "Prop name", 
              description = "Prop description", 
              value = DEFAULT_SAMPLE)
    public static final String …
Run Code Online (Sandbox Code Playgroud)

java osgi apache-felix osgi-bundle aem

2
推荐指数
1
解决办法
7411
查看次数

Apache POI 与 Apache Felix 的使用

我正在尝试将 Apache POI 导入到 Atlassian Jira 插件以读取 excel 文件。

一开始,我开始只添加

<dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi</artifactId>
        <version>${poi.version}</version>
    </dependency>
    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml-schemas</artifactId>
        <version>${poi.version}</version>
    </dependency>

    <dependency>
        <groupId>org.apache.poi</groupId>
        <artifactId>poi-ooxml</artifactId>
        <version>${poi.version}</version>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

poi.version 是 3.14

然后当我启动插件时它给出了

Unresolved constraint in bundle com.tezExtensions [165]: Unable to resolve 165.0: missing requirement [165.0] osgi.wiring.package; (osgi.wiring.package=com.sun.javadoc)
Run Code Online (Sandbox Code Playgroud)

然后我用一些指令编辑了 pom,这些指令是我在另一个 StackOverflow 问题Pax Exam issue with Apache POI wrapped bundle 中发现的

 <instructions>
                    <Atlassian-Plugin-Key>${atlassian.plugin.key}</Atlassian-Plugin-Key>
                    <!-- Add package to export here -->
                    <Export-Package>com.sony.poc.api,</Export-Package>
                    <_exportcontents>
                        org.apache.poi.*;version=${poi.version},
                        org.openxmlformats.schemas.*;version=${poi.schema.version},
                        schemasMicrosoftComOfficeExcel.*;version=${poi.schema.version},
                        schemasMicrosoftComOfficeOffice.*;version=${poi.schema.version},
                        schemasMicrosoftComOfficePowerpoint.*;version=${poi.schema.version},
                        schemasMicrosoftComVml.*;version=${poi.schema.version},
                        org.etsi.uri.*;version=${poi.security.version}
                    </_exportcontents>
                    <!-- Add package import …
Run Code Online (Sandbox Code Playgroud)

apache-poi maven-3 apache-felix osgi-bundle atlassian-plugin-sdk

2
推荐指数
1
解决办法
1430
查看次数

无法启动捆绑包-缺少要求(osgi.wiring.package)

我是Apache karaf和OSGI的新手。我试图编写并运行一个非常简单的捆绑软件。但是启动该捆绑包时出现此错误:

错误执行命令:错误执行捆绑软件命令:无法解决karaf [86](R 86.0):缺少要求[karaf [86](R 86.0)] osgi.wiring.package; (osgi.wiring.package = bundle)未解决的要求:[[karaf [86](R 86.0)] osgi.wiring.package; (osgi.wiring.package = bundle)]

我的pom是:4.0.0

<groupId>com</groupId>
<artifactId>karaf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>bundle</packaging>

<name>karaf Bundle</name>
<description>
    karaf OSGi bundle project.
</description>

<properties>
    <maven-bundle-plugin.version>2.5.4</maven-bundle-plugin.version>
    <osgi.version>6.0.0</osgi.version>
</properties>

<dependencies>
    <dependency>
        <groupId>org.osgi</groupId>
        <artifactId>org.osgi.core</artifactId>
        <version>${osgi.version}</version>

        <scope>provided</scope>
    </dependency>
</dependencies>

<build>
    <plugins>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <version>${maven-bundle-plugin.version}</version>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Bundle-SymbolicName>${project.artifactId}</Bundle-SymbolicName>
                    <Bundle-Version>${project.version}</Bundle-Version>
                    <Bundle-Activator>bundle.Activator</Bundle-Activator>
                    <Export-Package>
                        bundle*;version=${project.version}
                    </Export-Package>
                    <Import-Package>
                         org.osgi.framework,*
                    </Import-Package>
                </instructions>
            </configuration>
        </plugin>
    </plugins>
</build>
Run Code Online (Sandbox Code Playgroud)

我的manifest.mf文件在这里。

> Manifest-Version: 1.0
Bnd-LastModified: 1394131053386
Bundle-Copyright: Copyright (c) OSGi Alliance (2000, 2014). All Rights …
Run Code Online (Sandbox Code Playgroud)

osgi maven apache-felix apache-karaf osgi-bundle

2
推荐指数
1
解决办法
7858
查看次数

apache maven 构建失败 - 无法执行目标 org.apache.felix:maven-bundle-plugin:4.2.0:manifest

我想通过以下位置的文章安装“iText RUPS”

https://github.com/itext/i7j-rups

在命令提示符中输入:“mvn clean package”后,我得到:

[信息] --- maven-bundle-plugin:4.2.0:manifest (bundle-manifest) @ itext-rups ---

[错误] 发生内部错误 java.util.ConcurrentModificationException

at java.util.TreeMap.callMappingFunctionWithCheck (TreeMap.java:742)
at java.util.TreeMap.computeIfAbsent (TreeMap.java:558)
at aQute.bnd.osgi.Jar.putResource (Jar.java:288)
at aQute.bnd.osgi.Jar$1.visitFile (Jar.java:202)
at aQute.bnd.osgi.Jar$1.visitFile (Jar.java:177)
at java.nio.file.Files.walkFileTree (Files.java:2804)
at aQute.bnd.osgi.Jar.buildFromDirectory (Jar.java:176)
at aQute.bnd.osgi.Jar.<init> (Jar.java:119)
at aQute.bnd.osgi.Jar.<init> (Jar.java:172)
at org.apache.felix.bundleplugin.BundlePlugin.getOSGiBuilder (BundlePlugin.java:603)
at org.apache.felix.bundleplugin.ManifestPlugin.getAnalyzer (ManifestPlugin.java:285)
at org.apache.felix.bundleplugin.ManifestPlugin.execute (ManifestPlugin.java:111)
at org.apache.felix.bundleplugin.BundlePlugin.execute (BundlePlugin.java:364)
at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo (DefaultBuildPluginManager.java:137)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:210)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:156)
at org.apache.maven.lifecycle.internal.MojoExecutor.execute (MojoExecutor.java:148)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:117)
at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject (LifecycleModuleBuilder.java:81)
at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build (SingleThreadedBuilder.java:56)
at org.apache.maven.lifecycle.internal.LifecycleStarter.execute (LifecycleStarter.java:128)
at …
Run Code Online (Sandbox Code Playgroud)

plugins bundle maven apache-felix

2
推荐指数
1
解决办法
5302
查看次数

使用iPOJO注释自定义Felix命令

我目前正在尝试使用iPOJO为Felix实现自定义shell命令.我的示例实现如下:

import java.io.PrintStream;

import org.apache.felix.ipojo.annotations.Component;
import org.apache.felix.ipojo.annotations.Provides;
import org.apache.felix.shell.Command;

@Component(immediate = true)
@Provides
public class SampleCommand implements Command {


    @Override
    public String getName() {
        return "testcmd";
    }

    @Override
    public String getUsage() {
        return "testcmd";
    }

    @Override
    public String getShortDescription() {
        return "test command";
    }

    @Override
    public void execute(String line, PrintStream out, PrintStream err) {
        out.println("execute testcmd!");
    }

}
Run Code Online (Sandbox Code Playgroud)

当我在Felix上部署Bundle时,我的SampleCommand被实例化并且getName()被调用.但是当我尝试在shell上执行"testcmd"时,我得到:

gogo: CommandNotFoundException: Command not found: testcmd
Run Code Online (Sandbox Code Playgroud)

还有什么需要考虑的问题吗?

osgi annotations apache-felix

1
推荐指数
2
解决办法
2809
查看次数

未解决的对[org.osgi.service.component]的引用

我正在尝试使用maven-bundle-plugin创建一个包.该项目的pom.xml是:

    <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/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>
    <groupId>com.adobe.support.examples</groupId>
    <artifactId>com.adobe.support.examples.osgi.service</artifactId>
    <version>1.0.8</version>
    <packaging>bundle</packaging>
    <name>OSGi Service Example</name>
    <url>http://blogs.adobe.com/kmossman</url>
    <description>Adobe Developer Support OSGi Service Example</description>
    <!--  
    Credit: This example is based on Moritz Havelock's http://in-the-sling.blogspot.com/ 

    I suggest you use the most current versions of the plugin's. 
    Search the Central Repository for the most current versions http://search.maven.org/

    Use the search strings below and update the appropriate versions

    // Felix
    g:"org.apache.felix" a:"org.apache.felix.framework"
    g:"org.apache.felix" a:"maven-bundle-plugin"
    g:"org.apache.felix" a:"maven-scr-plugin"
    g:"org.apache.felix" a:"org.osgi.core"
    // Maven
    g:"org.apache.maven.plugins" a:"maven-compiler-plugin"  
    // Sling
    g:"org.apache.sling" a:"maven-sling-plugin" …
Run Code Online (Sandbox Code Playgroud)

osgi maven-2 apache-felix aem

1
推荐指数
1
解决办法
3698
查看次数

将服务注册为OSGi容器中的正常服务与ServiceFactory有什么区别?

将服务注册为普通服务与将其作为ServiceFactory之间的区别是什么?

例如 :

我有一个正常的osgi组件,我正在使用服务scr注释进行服务

@Component 
@Service 
class Service1 implements Service1Interface { 
...
... 
... 
}
Run Code Online (Sandbox Code Playgroud)

现在,我有另一个osgi组件,我将作为服务注册ServiceFactory标志为true

@Component 
@Service(serviceFactory=true )
class Service1 implements Service1Interface { 
...
... 
... 
}
Run Code Online (Sandbox Code Playgroud)

这两者究竟有什么区别?它们在容器中注册时是否存在差异?在什么情况下我们应该选择ServiceFactory?

osgi apache-felix

1
推荐指数
1
解决办法
132
查看次数

无法在Eclipse上运行Configuration Admin

我正在尝试使用Configuration Admin将配置信息传递给捆绑包.我正在使用基于Equinox OSGI实现的声明式服务.首先,因为我找不到Config Admin的Equinox实现我已经安装了felix实现,所以如果有人建议我可以获得equinox版本,那将会很棒.

我的主要问题是:当我运行程序时,我一直收到以下错误.看起来像一个null'配置'对象被传递给我的更新方法.

osgi> !SESSION 2014-08-10 06:54:09.862 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.7.0_51
java.vendor=Oracle Corporation
BootLoader constants: OS=win32, ARCH=x86, WS=win32, NL=en_US
Command-line arguments:  -dev file:C:/Users/Desktop/OSGI/eclipseee/workspace1/.metadata/.plugins/org.eclipse.pde.core/configurator/dev.properties -os win32 -ws win32 -arch x86 -consoleLog -console

!ENTRY org.apache.felix.configadmin 4 0 2014-08-10 07:09:52.639
!MESSAGE Cannot use configuration de.services.logger.mtinylogger for   [org.osgi.service.cm.ManagedService, id=33, bundle=11/initial@reference:file:../workspace1/de.services.logger.mtinylogger/]: No visibility to configuration bound to initial@reference:file:../workspace1/de.init.configurator/
Run Code Online (Sandbox Code Playgroud)

我创建了一个configurator包来创建配置对象,其中的主要内容是activate方法(由声明性服务调用)是:

    protected void activate(BundleContext bundleContext) throws IOException
    {
    //Retrieve a reference to the Configuration Admin service
    ServiceReference serviceReference = bundleContext.getServiceReference(ConfigurationAdmin.class.getName());  
    if(serviceReference != null)
    {
        ConfigurationAdmin configAdmin …
Run Code Online (Sandbox Code Playgroud)

eclipse osgi declarative-services equinox apache-felix

1
推荐指数
1
解决办法
1376
查看次数

无法通过 Dispatcher 访问 AEM /etc.clientlibs

当在调度程序上请求页面时,我在发布实例error.log中看到了这一点

\n\n
18.12.2019 22:13:05.563 *INFO* [x.x.x.x [1576707185560] GET /etc.clientlibs/project/clientlibs/clientlib-all.fd5c5f2e8418f9ae1aa923efb9e7ad95.js HTTP/1.1] com.adobe.granite.ui.clientlibs.impl.ClientLibraryProxyServlet Proxy request to /etc.clientlibs/project/clientlibs/clientlib-all.fd5c5f2e8418f9ae1aa923efb9e7ad95.js not supported.\n
Run Code Online (Sandbox Code Playgroud)\n\n

因此etc.clientlibs不会加载到调度程序中,而是发回 404。

\n\n

过滤规则似乎默认允许 clientlibs/0002 { /type "allow" /url "/etc.clientlibs/*" }

\n\n

我在网上做了一些挖掘,发现了以下潜在的解决方法:

\n\n
    \n
  1. 允许匿名 读取访问/etc
  2. \n
  3. 明确拒绝 的第一级子级的 匿名 读取访问,/etc以确保您不\xe2\x80\x99t 允许事物通过。
  4. \n
\n\n

虽然这似乎暂时解决了问题,但我认为这充其量只是一种解决方法。

\n\n

有谁知道这个问题的解决方案以及如何在不更改 OOTB 权限的情况下解决此问题?

\n\n

谢谢,

\n\n

尼古拉

\n

java crx apache-felix sling aem

1
推荐指数
1
解决办法
3906
查看次数