Java SecurityException没有签名文件的最明显部分

时间:2018-02-12 20:58:55

标签: java maven jar bouncycastle

当我运行使用maven build创建的可执行.jar文件时,我收到以下错误:

Exception in thread "main" java.lang.SecurityException: no manifiest section 
for signature file entry 
org/bouncycastle/cms/CMSSignedDataStreamGenerator$TeeOutputStream.class
    at sun.security.util.SignatureFileVerifier.verifySection(Unknown Source)
    at sun.security.util.SignatureFileVerifier.processImpl(Unknown Source)
    at sun.security.util.SignatureFileVerifier.process(Unknown Source)
    at java.util.jar.JarVerifier.processEntry(Unknown Source)
    at java.util.jar.JarVerifier.update(Unknown Source)
    at java.util.jar.JarFile.initializeVerifier(Unknown Source)
    at java.util.jar.JarFile.getInputStream(Unknown Source)
    at sun.misc.URLClassPath$JarLoader$2.getInputStream(Unknown Source)
    at sun.misc.Resource.cachedInputStream(Unknown Source)

可以注意到点:我正在使用Maven 3.3构建Java swing项目。我定位了一个maven阴影jar文件,并在使用' java -jar'运行jar文件时我收到了上述错误。

感谢任何帮助。如果有人需要更多信息,请告诉我。我被困住了;请帮忙。

1 个答案:

答案 0 :(得分:0)

我已根据@MadProgrammer的建议从maven中排除了许可文件。 在pom.xml中的代码下面使用

<Window.Resources>
    <Style x:Key="FontSizeScale" TargetType="TextBlock">
        <Setter Property="FontSize" Value="{Binding RelativeSource={RelativeSource Self}, Path=ActualWidth, Converter={x:Static localConverter:WidthToFontSizeConverter.Instance}}"></Setter>
    </Style>
</Window.Resources>
<Grid>
               <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="20*"/>
                    <ColumnDefinition Width="715*"/>
                    <ColumnDefinition Width="30*"/>
                    <ColumnDefinition Width="220*"/>
                    <ColumnDefinition Width="20*"/>
                </Grid.ColumnDefinitions>
                <Grid.RowDefinitions>
                    <RowDefinition Height="17*"/>
                    <RowDefinition Height="41*"/>
                    <RowDefinition Height="38*"/>
                    <RowDefinition Height="41*"/>
                    <RowDefinition Height="38*"/>
                    <RowDefinition Height="371*"/>
                    <RowDefinition Height="36*"/>
                    <RowDefinition Height="87*"/>
                    <RowDefinition Height="16*"/>
                </Grid.RowDefinitions>

<TextBlock Style="{StaticResource FontSizeScale}" Text="{Binding Version}" FontWeight="Bold" Grid.Row="1" Grid.Column="1"/>
</Grid>