eclipse 打包war时不透明部分中的非法字符

p4tfgftt  于 2022-11-04  发布在  Eclipse
关注(0)|答案(2)|浏览(146)

我正在尝试用JSF和嵌入式Tomcat构建一个Spring引导应用程序。
我想获取一个. war文件。在Eclipse中,应用程序运行正常,但如果我启动.war,则会出现以下错误:

java.lang.RuntimeException: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 135: jar:war:file:/D:/Eigene%20Dokumente/Projekte/Abschlussprojekt/workspace/OrgTool-Sommerfest/target/OrgTool-Sommerfest-0.0.1-SNAPSHOT.war^/WEB-INF/lib/primefaces-5
.1.jar!/META-INF/faces-config.xml
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:292)
        at org.apache.catalina.core.StandardContext.listenerStart(StandardContext.java:4726)
        at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5162)
        at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1409)
        at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1399)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source)
        at java.lang.Thread.run(Unknown Source)
Caused by: com.sun.faces.config.ConfigurationException: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 135: jar:war:file:/D:/Eigene%20Dokumente/Projekte/Abschlussprojekt/workspace/OrgTool-Sommerfest/target/OrgTool-Sommerfest-0.0.1-SNAPSHOT.war^/WEB-INF/lib/primefaces-5.1.jar!/META-INF/
faces-config.xml
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:764)
        at com.sun.faces.config.ConfigManager.initialize(ConfigManager.java:353)
        at com.sun.faces.config.ConfigureListener.contextInitialized(ConfigureListener.java:227)
        ... 9 common frames omitted
Caused by: java.util.concurrent.ExecutionException: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 135: jar:war:file:/D:/Eigene%20Dokumente/Projekte/Abschlussprojekt/workspace/OrgTool-Sommerfest/target/OrgTool-Sommerfest-0.0.1-SNAPSHOT.war^/WEB-INF/lib/primefaces-5.1.jar!/META-INF/faces-config.xml
        at java.util.concurrent.FutureTask.report(Unknown Source)
        at java.util.concurrent.FutureTask.get(Unknown Source)
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:751)
        ... 11 common frames omitted
Caused by: javax.faces.FacesException: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 135: jar:war:file:/D:/Eigene%20Dokumente/Projekte/Abschlussprojekt/workspace/OrgTool-Sommerfest/target/OrgTool-Sommerfest-0.0.1-SNAPSHOT.war^/WEB-INF/lib/primefaces-5.1.jar!/META-INF/faces-config.xml
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:137)
        at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1362)
        at com.sun.faces.config.ConfigManager$URITask.call(ConfigManager.java:1331)
        at java.util.concurrent.FutureTask.run(Unknown Source)
        at com.sun.faces.config.ConfigManager.getConfigDocuments(ConfigManager.java:742)
        ... 11 common frames omitted
Caused by: java.io.IOException: java.net.URISyntaxException: Illegal character in opaque part at index 135: jar:war:file:/D:/Eigene%20Dokumente/Projekte/Abschlussprojekt/workspace/OrgTool-Sommerfest/target/OrgTool-Sommerfest-0.0.1-SNAPSHOT.war^/WEB-INF/lib/primefaces-5.1.jar!/META-INF/faces-config.xml
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.loadURLs(MetaInfFacesConfigResourceProvider.java:185)
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.getResources(MetaInfFacesConfigResourceProvider.java:110)
        ... 15 common frames omitted
Caused by: java.net.URISyntaxException: Illegal character in opaque part at index 135: jar:war:file:/D:/Eigene%20Dokumente/Projekte/Abschlussprojekt/workspace/OrgTool-Sommerfest/target/OrgTool-Sommerfest-0.0.1-SNAPSHOT.war^/WEB-INF/lib/primefaces-5.1.jar!/META-INF/faces-config.xml
        at java.net.URI$Parser.fail(Unknown Source)
        at java.net.URI$Parser.checkChars(Unknown Source)
        at java.net.URI$Parser.parse(Unknown Source)
        at java.net.URI.<init>(Unknown Source)
        at com.sun.faces.config.configprovider.MetaInfFacesConfigResourceProvider.loadURLs(MetaInfFacesConfigResourceProvider.java:164)
        ... 16 common frames omitted

我的POM.xml

<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>de.example</groupId>
    <artifactId>OrgTool</artifactId>
    <version>0.0.1-SNAPSHOT</version>

    <packaging>war</packaging>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>

        <java.version>1.7</java.version>
        <maven.compiler.target>1.7</maven.compiler.target>
        <maven.compiler.source>1.7</maven.compiler.source>
    </properties>

    <parent>
        <groupId>org.springframework.boot</groupId>
        <artifactId>spring-boot-starter-parent</artifactId>
        <version>1.2.2.RELEASE</version>
    </parent>

    <dependencies>
        <dependency>
            <groupId>org.primefaces.themes</groupId>
            <artifactId>all-themes</artifactId>
            <version>1.0.10</version>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-web</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.apache.tomcat.embed</groupId>
            <artifactId>tomcat-embed-jasper</artifactId>
            <scope>provided</scope>
        </dependency>

        <dependency>
            <groupId>org.glassfish</groupId>
            <artifactId>javax.faces</artifactId>
            <version>2.2.13</version>
        </dependency>

        <dependency>
            <groupId>javax.servlet</groupId>
            <artifactId>jstl</artifactId>
        </dependency>

        <dependency>
            <groupId>org.springframework.boot</groupId>
            <artifactId>spring-boot-starter-data-jpa</artifactId>
        </dependency>

        <dependency>
            <groupId>com.oracle.jdbc</groupId>
            <artifactId>com.springsource.oracle.jdbc</artifactId>
            <version>10.2.0.2</version>
        </dependency>

        <dependency>
            <groupId>org.primefaces</groupId>
            <artifactId>primefaces</artifactId>
            <version>5.1</version>
        </dependency>

        <dependency>
            <groupId>org.mindrot</groupId>
            <artifactId>jbcrypt</artifactId>
            <version>0.3m</version>
        </dependency>
        <dependency>
            <groupId>org.projectlombok</groupId>
            <artifactId>lombok</artifactId>
            <version>1.16.4</version>
        </dependency>
        <dependency>
            <groupId>javax.mail</groupId>
            <artifactId>mail</artifactId>
            <version>1.4.6-rc1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.poi</groupId>
            <artifactId>poi-ooxml</artifactId>
            <version>3.12</version>
        </dependency>
        <dependency>
            <groupId>com.google.guava</groupId>
            <artifactId>guava</artifactId>
            <version>19.0</version>
        </dependency>

        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-api</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-core</artifactId>
        </dependency>
        <dependency>
            <groupId>org.apache.logging.log4j</groupId>
            <artifactId>log4j-web</artifactId>
            <version>2.5</version>
            <scope>runtime</scope>
        </dependency>
    </dependencies>

    <build>
        <plugins>
            <plugin>
                <groupId>org.springframework.boot</groupId>
                <artifactId>spring-boot-maven-plugin</artifactId>
                <executions>
                    <execution>
                        <goals>
                            <goal>repackage</goal>
                        </goals>
                    </execution>
                </executions>
            </plugin>

        </plugins>
    </build>
</project>

如何解决此问题?

axzmvihb

axzmvihb1#

我也得到了错误,关键是要看看该消息,并计算字符数,以达到索引,这在您的情况下是135(你离开了你的职位,但我看到它在日志)。
文件的第135个字符是“^”(正好在“快照.war”和“/WEB-INF”之间)。
在我的例子中,非法字符是文件路径中的一个空格。

eh57zj3b

eh57zj3b2#

好吧,我修好了。真为我感到羞耻。
我只需要更新我的Maven...

相关问题