在Wildfly 14上部署CAS 5.3.10 Maven覆盖WAR时出现非法参数异常

whitzsjs  于 2022-11-02  发布在  Maven
关注(0)|答案(2)|浏览(215)

{"header":{"type":"auto_translation","ret_code":"error","time_cost":459.0,"request_id":"3cb055075a8611ed8a6c78ba710c1e34"},"message":"Translation error (20001), please retry later. Detail: RuntimeException - The length of source sentence is too long!!! - {\n "header": {\n "time_cost": 0.00032,\n "type": "auto_translation",\n "ret_code": "The length of source sentence is too long!!!"\n }\n}"}

wlzqhblo

wlzqhblo1#

由于@Marco没有提供他的修复,我会。对于任何人有同样的问题,请按照以下步骤解决:

  1. checkout cas-overlay-template后,在src/main/java/org/apereo/cas/util下创建包含以下内容的CasVersion.java
package org.apereo.cas.util;

import lombok.SneakyThrows;
import lombok.experimental.UtilityClass;
import lombok.extern.slf4j.Slf4j;
import org.springframework.core.io.VfsResource;

import java.io.File;
import java.net.URL;
import java.time.ZonedDateTime;

/**
 1. Class that exposes the CAS version. Fetches the "Implementation-Version"
 2. manifest attribute from the jar file.
 3.  4. @author Dmitriy Kopylenko
 4. @since 3.0.0
 */
@Slf4j
@UtilityClass
public class CasVersion {

    /**
     * @return Return the full CAS version string.
     * @see java.lang.Package#getImplementationVersion
     */
    public static String getVersion() {
        return CasVersion.class.getPackage().getImplementationVersion();
    }

    /**
     * Gets specification version from the manifest package.
     *
     * @return the specification version
     */
    public static String getSpecificationVersion() {
        return CasVersion.class.getPackage().getSpecificationVersion();
    }

    /**
     * Gets last modified date/time for the module.
     *
     * @return the date/time
     */
    @SneakyThrows
    public static ZonedDateTime getDateTime() {
        final Class clazz = CasVersion.class;
        final URL resource = clazz.getResource(clazz.getSimpleName() + ".class");
        if ("file".equals(resource.getProtocol())) {
            return DateTimeUtils.zonedDateTimeOf(new File(resource.toURI()).lastModified());
        }
        if ("jar".equals(resource.getProtocol())) {
            final String path = resource.getPath();
            final File file = new File(path.substring(5, path.indexOf('!')));
            return DateTimeUtils.zonedDateTimeOf(file.lastModified());
        }
        // These lines are causing the reported exception so we just comment them out.
        // if ("vfs".equals(resource.getProtocol())) {
        //     final File file = new VfsResource(resource.openConnection().getContent()).getFile();
        //     return DateTimeUtils.zonedDateTimeOf(file.lastModified());
        // }
        LOGGER.warn("Unhandled url protocol: [{}] resource: [{}]", resource.getProtocol(), resource);
        return ZonedDateTime.now();
    }
}

1.将以下依赖项添加到pom.xml

<!-- Required for lombok imports -->              
    <dependency>
        <groupId>org.projectlombok</groupId>
        <artifactId>lombok</artifactId>
        <version>1.16.16</version>
        <scope>provided</scope>
    </dependency>  
    <!-- Required for DateTimeUtils to be available on classpath -->              
    <dependency>
        <groupId>org.apereo.cas</groupId>
        <artifactId>cas-server-core-util</artifactId>
        <version>${cas.version}</version>
    </dependency>

1.将出现的任何<app-server>-tomcat</app-server>替换为<app-server></app-server>,因为您要提供应用程序服务器。
以上步骤应足以解决报告的问题

vh0rcniy

vh0rcniy2#

我编译了上面的Java文件,并用一个JAR包替换了它,我试图替换JAR包的cas-server-core-util-api-5.3.16.jar版本。

相关问题