在Kraf(OSGi)中运行,JJWT版本为0.11.1,无法加载类io.jasonwebtoken.impl.crypto.MacProvider

在Kraf(OSGi)中运行,JJWT版本为0.11.1,无法加载类io.jasonwebtoken.impl.crypto.MacProvider,osgi,classloader,jjwt,Osgi,Classloader,Jjwt,正在Karaf OSGi中运行,无法加载类io.jasonwebtoken.impl.crypto.MacProvider jjwt的版本是0.11.1 我的bundle包括提供的jjwtapi和jjwtjackson编译,我将jjwtimpl作为bundle运行 我需要创建一个超级捆绑包来完成这项工作吗?所以,我的工作正常,但并不理想 首先,jjwt impl虽然拥有所有正常的OSGi标记,但不导出任何内容 所以,我不得不做两件事——非常糟糕,但我不知道还能做什么: 1替换围绕对当前bundl

正在Karaf OSGi中运行,无法加载类io.jasonwebtoken.impl.crypto.MacProvider

jjwt的版本是0.11.1

我的bundle包括提供的jjwtapi和jjwtjackson编译,我将jjwtimpl作为bundle运行


我需要创建一个超级捆绑包来完成这项工作吗?

所以,我的工作正常,但并不理想

首先,jjwt impl虽然拥有所有正常的OSGi标记,但不导出任何内容

所以,我不得不做两件事——非常糟糕,但我不知道还能做什么:

1替换围绕对当前bundle类加载器的签名方法调用的线程类加载器

2在调用osgi包中嵌入jjwt impl并导出:

<Embed-Dependency>*;scope=runtime;inline=true</Embed-Dependency>
<Embed-Transitive>false</Embed-Transitive>

 <Export-Package>
     {local-packages},
     io.jsonwebtoken,
     io.jsonwebtoken.lang,
     io.jsonwebtoken.impl.crypto
 </Export-Package>

这已在JJWT 0.11.2中修复。请升级:

我使用了Peter Berkman方法,但做了一些修改

在pom.xml中

        <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt-api</artifactId>
        <version>0.11.2</version>
    </dependency>
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt-impl</artifactId>
        <version>0.11.2</version>
        <scope>runtime</scope>
    </dependency>
    <dependency>
        <groupId>io.jsonwebtoken</groupId>
        <artifactId>jjwt-jackson</artifactId>
        <version>0.11.2</version>
        <scope>runtime</scope>
    </dependency>
        <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                <Karaf-Commands>org.foo.app</Karaf-Commands>
                            <plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                <Karaf-Commands>org.foo.app</Karaf-Commands>
                <!-- dependencies inside the bundle -->
                <Embed-Dependency>*;scope=runtime;inline=true</Embed-Dependency>
                <Export-Package>
                    {local-packages},
                    io.jsonwebtoken,
                    io.jsonwebtoken.lang,
                    io.jsonwebtoken.impl.crypto
                </Export-Package> -->
                </instructions>
            </configuration>
        </plugin>
                <Embed-Dependency>*;scope=runtime;inline=true</Embed-Dependency>
                </instructions>
            </configuration>
        </plugin>
在features.xml中

    <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
    <features xmlns="http://karaf.apache.org/xmlns/features/v1.2.0"name="${project.artifactId}-${project.version}">
    <feature name="${project.artifactId}" version="${project.version}"
             description="${project.description}">
    <feature>onos-api</feature>
    <bundle>mvn:io.jsonwebtoken/jjwt-api/0.11.2</bundle>
    <bundle>mvn:io.jsonwebtoken/jjwt-impl/0.11.2</bundle>
    <bundle>mvn:io.jsonwebtoken/jjwt-jackson/0.11.2</bundle>
    <bundle>mvn:${project.groupId}/${project.artifactId}/${project.version}</bundle>

</feature>

很抱歉,版本0.11.1与JJWT相关,而不是Karaf:注意:您必须对jackson json支持包和导出包执行相同的操作:io.jsonwebtoken.jackson.ioI刚刚发布了JJWT 0.11.2,它对此有一个修复程序。请留出30分钟时间让版本在Maven Central中显示,然后升级并重试。背景:莱斯,刚查过。。。。还没有0.11.2。谢谢你。我看看能不能让它进入这个循环!