maven-bundle-plugin中的内部错误。嵌入式错误:打开资源

时间:2012-05-24 11:18:48

标签: maven osgi

我在使用maven构建OSGi项目时遇到了问题。我开始得到一个奇怪的错误。

我认为某些资源已损坏。但我不知道哪一个。我试图删除.m2 / repository。但问题仍然存在。 有关如何纠正这个问题的任何想法?

[ERROR] An internal error occurred
java.io.IOException: Opening resource
at aQute.lib.osgi.AbstractResource.getLocalBytes(AbstractResource.java:35)
at aQute.lib.osgi.AbstractResource.write(AbstractResource.java:46)
at aQute.lib.osgi.Jar.writeResource(Jar.java:445)
at aQute.lib.osgi.Jar.write(Jar.java:224)
at aQute.lib.osgi.Jar.write(Jar.java:192)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:362)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:264)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:255)
at    org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: java.util.UnknownFormatConversionException: Conversion = '�'
at java.util.Formatter.checkText(Formatter.java:2519)
at java.util.Formatter.parse(Formatter.java:2501)
at java.util.Formatter.format(Formatter.java:2430)
at java.util.Formatter.format(Formatter.java:2383)
at java.lang.String.format(String.java:2781)
at aQute.lib.osgi.Processor.formatArrays(Processor.java:1273)
at aQute.lib.osgi.Processor.warning(Processor.java:116)
at aQute.lib.osgi.Macro.replace(Macro.java:144)
at aQute.lib.osgi.Macro.process(Macro.java:71)
at aQute.lib.osgi.Macro.process(Macro.java:58)
at aQute.lib.osgi.Macro.process(Macro.java:53)
at aQute.lib.osgi.Macro.process(Macro.java:964)
at aQute.lib.osgi.PreprocessResource.getBytes(PreprocessResource.java:25)
at aQute.lib.osgi.AbstractResource.getLocalBytes(AbstractResource.java:31)
... 26 more
 [INFO] ------------------------------------------------------------------------
 [ERROR] BUILD ERROR
 [INFO] ------------------------------------------------------------------------
 [INFO] Internal error in maven-bundle-plugin

 Embedded error: Opening resource
 Conversion = '�'
 [INFO] ------------------------------------------------------------------------
 [INFO] Trace
 org.apache.maven.lifecycle.LifecycleExecutionException: Internal error in maven-bundle-plugin
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:719)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalWithLifecycle(DefaultLifecycleExecutor.java:556)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoal(DefaultLifecycleExecutor.java:535)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoalAndHandleFailures(DefaultLifecycleExecutor.java:387)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeTaskSegments(DefaultLifecycleExecutor.java:348)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.execute(DefaultLifecycleExecutor.java:180)
at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:328)
at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:138)
at org.apache.maven.cli.MavenCli.main(MavenCli.java:362)
at org.apache.maven.cli.compat.CompatibleMain.main(CompatibleMain.java:60)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:616)
at org.codehaus.classworlds.Launcher.launchEnhanced(Launcher.java:315)
at org.codehaus.classworlds.Launcher.launch(Launcher.java:255)
at org.codehaus.classworlds.Launcher.mainWithExitCode(Launcher.java:430)
at org.codehaus.classworlds.Launcher.main(Launcher.java:375)
Caused by: org.apache.maven.plugin.MojoExecutionException: Internal error in maven-bundle-plugin
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:412)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:264)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:255)
at org.apache.maven.plugin.DefaultPluginManager.executeMojo(DefaultPluginManager.java:490)
at org.apache.maven.lifecycle.DefaultLifecycleExecutor.executeGoals(DefaultLifecycleExecutor.java:694)
... 17 more
Caused by: java.io.IOException: Opening resource
at aQute.lib.osgi.AbstractResource.getLocalBytes(AbstractResource.java:35)
at aQute.lib.osgi.AbstractResource.write(AbstractResource.java:46)
at aQute.lib.osgi.Jar.writeResource(Jar.java:445)
at aQute.lib.osgi.Jar.write(Jar.java:224)
at aQute.lib.osgi.Jar.write(Jar.java:192)
at org.apache.felix.bundleplugin.BundlePlugin.execute(BundlePlugin.java:362)
... 21 more
Caused by: java.util.UnknownFormatConversionException: Conversion = '�'
at java.util.Formatter.checkText(Formatter.java:2519)
at java.util.Formatter.parse(Formatter.java:2501)
at java.util.Formatter.format(Formatter.java:2430)
at java.util.Formatter.format(Formatter.java:2383)
at java.lang.String.format(String.java:2781)
at aQute.lib.osgi.Processor.formatArrays(Processor.java:1273)
at aQute.lib.osgi.Processor.warning(Processor.java:116)
at aQute.lib.osgi.Macro.replace(Macro.java:144)
at aQute.lib.osgi.Macro.process(Macro.java:71)
at aQute.lib.osgi.Macro.process(Macro.java:58)
at aQute.lib.osgi.Macro.process(Macro.java:53)
at aQute.lib.osgi.Macro.process(Macro.java:964)
at aQute.lib.osgi.PreprocessResource.getBytes(PreprocessResource.java:25)
    at aQute.lib.osgi.AbstractResource.getLocalBytes(AbstractResource.java:31)
... 26 more

根据要求,maven-bundle-plugin配置:

<plugin>
            <groupId>org.apache.felix</groupId>
            <artifactId>maven-bundle-plugin</artifactId>
            <extensions>true</extensions>
            <configuration>
                <instructions>
                    <Import-Package>*</Import-Package>
                    <Export-Package>org.opennaas.extensions.idb.*;version="${project.version}"</Export-Package>
                    <Meta-Persistence>META-INF/persistence.xml</Meta-Persistence>
                </instructions>
            </configuration>
        </plugin>

2 个答案:

答案 0 :(得分:2)

问题实际上是一个编码问题。可能与persistence.xml文件。我重新保存了资源目录下的所有文本文件,它又开始工作了

答案 1 :(得分:2)

遇到同样的错误我想分享我的发现,这可能会有所帮助,直到诊断信息得到改善。

我添加

时收到错误
<resources>
  <resource>
    <directory>src/main/resources</directory>
    <filtering>true</filtering>
  </resource>
</resources>

到我的bundle pom.xml。我的资源目录中的一个文件存在编码问题,并使用

<includes>

指令与另一个文件后我能够找出它是哪一个。