小编Den*_*n B的帖子

UnsatisfiedLinkError:系统库路径中没有 fontmanager:/usr/lib/jvm/java-17-openjdk/lib

在我们将容器迁移到 alpine_java-17 后,Excel 导出功能失败并出现以下错误:

java.lang.UnsatisfiedLinkError: no fontmanager in system library path: /usr/lib/jvm/java-17-openjdk/lib
Run Code Online (Sandbox Code Playgroud)

在我的 Dockerfile 中我安装了:

RUN apk add --no-cache fontconfig
RUN apk add --no-cache ttf-dejavu
RUN apk add --no-cache freetype
Run Code Online (Sandbox Code Playgroud)

这是 Dockerfile 的简短版本:

    FROM custom_registry/alpine_java-17


ENV JAVA_HOME=/usr/lib/jvm/java-17-openjdk


# procps to have the binary 'pgrep'
RUN apk update
RUN apk add curl
RUN apk add procps

#here's mu solution to fix the issue
RUN apk add --no-cache fontconfig
RUN apk add --no-cache ttf-dejavu
RUN apk add --no-cache freetype

# install bash …
Run Code Online (Sandbox Code Playgroud)

java docker alpine-linux java-17

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

在春季启动版本2.0.0.M1中找不到EmbeddedServletContainerFactory TomcatEmbeddedServletContainerFactory

我有春季启动版本'2.0.0.M1'。我在应用程序上配置了https,一切正常。但是现在我尝试将应用程序从http重定向到https。我使用标准配置类

import org.apache.catalina.Context;
import org.apache.catalina.connector.Connector;
import org.apache.tomcat.util.descriptor.web.SecurityCollection;
import org.apache.tomcat.util.descriptor.web.SecurityConstraint;
import org.springframework.boot.context.embedded.EmbeddedServletContainerFactory;
import org.springframework.boot.context.embedded.tomcat.TomcatEmbeddedServletContainerFactory;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

public class ConfRedir {

    @Bean
    public EmbeddedServletContainerFactory servletContainer() {
        TomcatEmbeddedServletContainerFactory tomcat =
                new TomcatEmbeddedServletContainerFactory() {

                    @Override
                    protected void postProcessContext(Context context) {
                        SecurityConstraint securityConstraint = new SecurityConstraint();
                        securityConstraint.setUserConstraint("CONFIDENTIAL");
                        SecurityCollection collection = new SecurityCollection();
                        collection.addPattern("/*");
                        securityConstraint.addCollection(collection);
                        context.addConstraint(securityConstraint);
                    }
                };
        tomcat.addAdditionalTomcatConnectors(createHttpConnector());
        return tomcat;
    }

    private Connector createHttpConnector() {
        Connector connector =
                new Connector("org.apache.coyote.http11.Http11NioProtocol");
        connector.setScheme("http");
        connector.setSecure(false);
        connector.setPort(8080);
        connector.setRedirectPort(8443);
        return connector;
    }
}
Run Code Online (Sandbox Code Playgroud)

我有编译错误。在org.springframework.boot.context.embedded.EmbeddedServletContainerFactory中找不到EmbeddedServletContainerFactory和TomcatEmbeddedServletContainerFactory;

我的Gradle依赖项

dependencies …
Run Code Online (Sandbox Code Playgroud)

java spring tomcat

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

驱动程序:org.postgresql.Driver@3ed03652为URL返回null ...在部署春季启动时到Heroku

我尝试在Heroku上部署我的应用程序,但有一些错误,我无法修复我的application.poperties

    spring.mvc.view.prefix = /WEB-INF/view/
spring.mvc.view.suffix = .jsp

spring.datasource.url = jdbc:postgres://user:pass@ec2-54-247-166-129.eu-west-1.compute.amazonaws.com:5432/database

# Username and password
spring.datasource.username = user
spring.datasource.password = pass

# Keep the connection alive if idle for a long time (needed in production)
spring.datasource.testWhileIdle = true
spring.datasource.validationQuery = SELECT 1

spring.datasource.driverClassName=org.postgresql.Driver

# ===============================
# = JPA / HIBERNATE
# ===============================

# Use spring.jpa.properties.* for Hibernate native properties (the prefix is
# stripped before adding them to the entity manager).

# Show or not log for each sql query
spring.jpa.show-sql …
Run Code Online (Sandbox Code Playgroud)

java postgresql spring heroku maven

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

无法在春季启动中自动装配SessionRegistry

我有从Spring应用程序迁移过来的Spring Boot应用程序。一切正常。我决定添加一些与SessionRegistry相关的新功能。而且我发现sessionRegistry无法自动连线。它只是显示无法自动装配。找不到“ SessionRegistry”类型的bean。我认为这可能是想法问题,并尝试使用此编译问题运行项目,但应用程序无法启动:


申请开始失败


描述:

SessionUtils中构造函数的参数0需要找不到类型为'org.springframework.security.core.session.SessionRegistry'的bean。

行动:

考虑在配置中定义类型为“ org.springframework.security.core.session.SessionRegistry”的bean。

这是我尝试使用SessionRegistry的班级示例:

    import org.springframework.security.core.session.SessionRegistry;

import org.springframework.security.core.userdetails.User;
import org.springframework.security.core.userdetails.UserDetails;
import org.springframework.security.core.session.SessionInformation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class SessionUtils {

    private final SessionRegistry sessionRegistry;

    @Autowired
    public SessionUtils(SessionRegistry sessionRegistry) {
        this.sessionRegistry = sessionRegistry;
    }

    public void expireUserSessions(String username) {
        for (Object principal : sessionRegistry.getAllPrincipals()) {
            if (principal instanceof User) {
                UserDetails userDetails = (UserDetails) principal;
                if (userDetails.getUsername().equals(username)) {
                    for (SessionInformation information : sessionRegistry.getAllSessions(userDetails, true)) {
                        information.expireNow();
                    }
                }
            }
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

我尝试添加@ComponentScan,但没有帮助。我的Application.class代码:

    import …
Run Code Online (Sandbox Code Playgroud)

java spring autowired spring-boot

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