小编par*_*boy的帖子

带有非嵌入式Tomcat的Spring Boot:加载器约束违规错误

尝试使用Spring Boot显示JSP时出错.这是我的配置:

  • Spring源码STS(最新版本)
  • Spring Boot 1.1.8(迄今为止的最新版本)
  • Java 1.7
  • Tomcat 8.0.14(我没有使用嵌入式tomcat,所以我手动启动了弹簧启动应用程序)

我的JSP文件是准系统:

TEST
Run Code Online (Sandbox Code Playgroud)

这是我的pom.xml:

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>com.edhec</groupId>
<artifactId>stdapps</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>

<name>stdapps</name>
<description>Project stdapps</description>

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>1.1.8.RELEASE</version>
    <relativePath/> <!-- lookup parent from repository -->
</parent>

<dependencies>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-jpa</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-web</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-security</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-data-rest</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-websocket</artifactId>
    </dependency>
    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-tomcat</artifactId>
        <scope>provided</scope>
    </dependency>

    <dependency>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-test</artifactId>
        <scope>test</scope>
    </dependency>
    <dependency>
        <groupId>org.hibernate</groupId>
        <artifactId>hibernate-c3p0</artifactId>
        <version>4.3.6.Final</version>
    </dependency>
    <dependency>
        <groupId>com.oracle</groupId>
        <artifactId>ojdbc14</artifactId> …
Run Code Online (Sandbox Code Playgroud)

spring jsp spring-mvc spring-boot

4
推荐指数
1
解决办法
4371
查看次数

SPRING BOOT配置Jasig CAS

我正在制作一个测试项目,为我们未来的项目尝试弹簧启动.

我们正在使用jasig CAS,我正在尝试使用spring boot和嵌入式tomcat服务器进行配置.

所以我添加了pom.xml spring-boot-starter-security

之后我尝试配置WebSecurityConfig - > spring提供了用cas配置的类,例如我需要配置一个入口点:

@Bean
public CasAuthenticationEntryPoint casAuthenticationEntryPoint() {
    CasAuthenticationEntryPoint casAuthenticationEntryPoint = new CasAuthenticationEntryPoint();
    casAuthenticationEntryPoint.setLoginUrl("https://localhost:9443/cas/login");
    casAuthenticationEntryPoint.setServiceProperties(serviceProperties());
    return casAuthenticationEntryPoint;
}
Run Code Online (Sandbox Code Playgroud)

这是第一个问题:应用程序未重新配置org.springframework.security.cas.web.CasAuthenticationEntryPoint类.

该类似乎没有使用spring-boot-starter-security导入.

什么是最佳做法?我是否必须像以前那样在我的pom中手动添加依赖项?

例如:

<dependency>
        <groupId>org.springframework.security</groupId>
        <artifactId>spring-security-cas</artifactId>
        <version>${spring-security.version}</version>
        <type>jar</type>
        <scope>compile</scope>
    </dependency>
Run Code Online (Sandbox Code Playgroud)

如果是这样,我需要使用哪个版本来配合启动版本包并避免冲突?

第二点是如何配置嵌入式tomcat以启用带证书的ssl?

这是我对CAS的经典server.xml配置:

Connector emptySessionPath="true" port="8443" protocol="org.apache.coyote.http11.Http11NioProtocol" SSLEnabled="true" URIEncoding="UTF-8"
    maxThreads="150" scheme="https" secure="true"
           clientAuth="false" sslProtocol="TLS" 
           keystoreFile="C:\***\***\***\.keystore" keystorePass="***"
    truststoreFile="C:\Program Files\Java\jdk1.7.0_67\jre\lib\security\cacerts"
compression="on"
     compressionMinSize="2048"
     noCompressionUserAgents="gozilla, traviata"
     compressableMimeType="text/html,text/xml,text/plain,text/css,text/javascript"/>
Run Code Online (Sandbox Code Playgroud)

是否可以使用嵌入式tomcat配置keystorefile/truststorefile?

谢谢

spring cas spring-security spring-boot

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

标签 统计

spring ×2

spring-boot ×2

cas ×1

jsp ×1

spring-mvc ×1

spring-security ×1