在我开始使用 MsSQL JDBC 之前,我的 Maven shade 插件运行良好
当我将 MsSql 添加到 pom.xml 并且我想运行该应用程序时,出现错误
错误:发生 JNI 错误,请检查您的安装并重试。
线程“main”中的异常java lang SecurityException
Manifest 主要属性的无效签名文件摘要
有什么建议我该如何解决?然而,Main 类是空的,只有一个简单的 main 方法。
<build>
<plugins>
<!-- Maven Shade Plugin -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>2.4.3</version>
<executions>
<!-- Run shade goal on package phase -->
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<transformers>
<!-- add Main-Class to manifest file -->
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>mdb.Main</mainClass>
</transformer>
</transformers>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
<dependencies>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>6.2.2.jre7</version>
</dependency>
</dependencies>
</project>
Run Code Online (Sandbox Code Playgroud) 我想从网络客户端响应中接收标头(尤其是内容类型)。我用 flatmap-mono-getHeaders 找到了这段代码,但它不起作用。
org.springframework.web.reactive.function.UnsupportedMediaTypeException: Content type 'image/tiff' not supported for bodyType=org.company.MyResponse
我该如何修复它?或者也许有人可以推荐一个更简单的解决方案。
Mono<Object> mono = webClient.get()
.uri(path)
.acceptCharset(StandardCharsets.UTF_8)
.retrieve()
.toEntity(MyResponse.class)
.flatMap(entity -> Mono.justOrEmpty(entity.getHeaders().getFirst("content-type")));
Object rs = mono.block();
public class MyResponse {
Object body;
Integer status;
String contentType;
}
Run Code Online (Sandbox Code Playgroud)