struts-community-plugins / struts2-jquery

Struts2 jQuery Plugin
Apache License 2.0
83 stars 49 forks source link

Struts 6.0.3 + struts2-jquery-plugin 5.0.0 = exception on initialization #316

Closed matorodriguez closed 1 year ago

matorodriguez commented 1 year ago

hi! I'm getting the following warning:

[WARN ] 2022-09-26 22:46:37.547 [main] (DomHelper.java:355) - Local DTD is missing for publicID: -//Apache Software Foundation//DTD Struts Configuration 2.6//EN - defined mappings: {-//Apache Software Foundation//DTD Struts Configuration 2.0//EN=struts-2.0.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1//EN=struts-2.1.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.3//EN=struts-2.3.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN=struts-2.1.7.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.5//EN=struts-2.5.dtd, -//Apache Software Foundation//DTD Struts Configuration 6.0//EN=struts-6.0.dtd}

followed by an exception:

[ERROR] 2022-09-26 22:46:37.594 [main] (Dispatcher.java:565) - Dispatcher initialization failed com.opensymphony.xwork2.config.ConfigurationException: Unable to load configuration. ... Caused by: java.io.FileNotFoundException: http://struts.apache.org/dtds/struts-2.6.dtd

the problem seems to be related to a struts2-jquery-plugin dependency: struts2-velocity-plugin:6.0.0, because it tries to use a non-existent DTD (404): http://struts.apache.org/dtds/struts-2.6.dtd

as discussed here, it can be workarounded -for example, by specifying version 6.0.3 for the struts2-velocity-plugin or excluding it-, but it would be nice for it to work out-of-the-box

afattahi54 commented 1 year ago

Same error with Struts 6.0.3 and struts2-jquery-plugin 5.0.0


DTD is missing for publicID: -//Apache Software Foundation//DTD Struts Configuration 2.6//EN - defined mappings: {-//Apache Software Foundation//DTD Struts Configuration 2.0//EN=struts-2.0.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1//EN=struts-2.1.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.3//EN=struts-2.3.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN=struts-2.1.7.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.5//EN=struts-2.5.dtd, -//Apache Software Foundation//DTD Struts Configuration 6.0//EN=struts-6.0.dtd}
lukaszlenart commented 1 year ago

@afattahi54 please double check if you are using proper versions of all the Struts dependencies as this was already addressed in 6.0.3

afattahi54 commented 1 year ago

Dear @lukaszlenart I have rechecked and it is struts 6.0.3.

This is the pom.xml


<struts2.version>6.0.3</struts2.version>
<struts2.jquery.plugin.version>5.0.0</struts2.jquery.plugin.version>
<!-- START:struts -->
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>${struts2.version}</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-convention-plugin</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-lang3</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-junit-plugin</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>spring-context</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spring-core</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
                <exclusion>
                    <groupId>org.springframework</groupId>
                    <artifactId>spring-test</artifactId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-json-plugin</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-lang3</artifactId>
                    <groupId>org.apache.commons</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-spring-plugin</artifactId>
            <version>${struts2.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>spring-web</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spring-beans</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spring-context</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
                <exclusion>
                    <artifactId>spring-core</artifactId>
                    <groupId>org.springframework</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <!--Uncomment during development ONLY 
            <dependency> 
                  <groupId>org.apache.struts</groupId> 
                 <artifactId>struts2-config-browser-plugin</artifactId> 
                 <version>${struts2.version}</version> 
            </dependency> -->
        <dependency>
            <groupId>com.jgeppert.struts2.jquery</groupId>
            <artifactId>struts2-jquery-plugin</artifactId>
            <version>${struts2.jquery.plugin.version}</version>
            <exclusions>
                <exclusion>
                    <artifactId>commons-lang</artifactId>
                    <groupId>commons-lang</groupId>
                </exclusion>
            </exclusions>
        </dependency>
        <dependency>
            <groupId>com.jgeppert.struts2.jquery</groupId>
            <artifactId>struts2-jquery-chart-plugin</artifactId>
            <version>${struts2.jquery.plugin.version}</version>
        </dependency>
        <dependency>
            <groupId>com.jgeppert.struts2.jquery</groupId>
            <artifactId>struts2-jquery-grid-plugin</artifactId>
            <version>${struts2.jquery.plugin.version}</version>
        </dependency>

        <dependency>
            <groupId>com.googlecode.struts2-conversation</groupId>
            <artifactId>struts2-conversation-scope-plugin</artifactId>
            <version>${struts2-conversation-scope-plugin.version}</version>
        </dependency>
        <!--Uncomment during development ONLY 
          <dependency> 
              <groupId>com.googlecode.struts2-conversation</groupId> 
              <artifactId>struts2-conversation-config-browser-extension</artifactId> 
              <version>${struts2-conversation-scope-plugin.version}</version> 
          </dependency> -->
        <!-- END:strust -->

This is what i see int the log


Caused by: Unable to load jar:file:/D:/Novin/workspace/...../WEB-INF/lib/struts2-velocity-plugin-6.0.0.jar!/struts-plugin.xml - Class: sun.net.www.protocol.http.HttpURLConnection

As you can see it is using struts2-velocity-plugin-6.0.0.jar. It seems that struts2-velocity-plugin is loaded by struts2-jquery-plugin as dependency.

Here is screen from eclipse dependency hierarchy

image

Should I manually fix it in the pom.xml

matorodriguez commented 1 year ago

@afattahi54 https://github.com/afattahi54 it's the same versions I reported

El dom., 2 de octubre de 2022 02:26, afattahi54 @.***> escribió:

Same error with Struts 6.0.3 and struts2-jquery-plugin 5.0.0

DTD is missing for publicID: -//Apache Software Foundation//DTD Struts Configuration 2.6//EN - defined mappings: {-//Apache Software Foundation//DTD Struts Configuration 2.0//EN=struts-2.0.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1//EN=struts-2.1.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.3//EN=struts-2.3.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.1.7//EN=struts-2.1.7.dtd, -//Apache Software Foundation//DTD Struts Configuration 2.5//EN=struts-2.5.dtd, -//Apache Software Foundation//DTD Struts Configuration 6.0//EN=struts-6.0.dtd}

— Reply to this email directly, view it on GitHub https://github.com/struts-community-plugins/struts2-jquery/issues/316#issuecomment-1264555837, or unsubscribe https://github.com/notifications/unsubscribe-auth/AETTNCRRM5XT4KZRV22Q5BTWBEMH7ANCNFSM6AAAAAAQX6QWHU . You are receiving this because you authored the thread.Message ID: @.***>

afattahi54 commented 1 year ago

I have updated to struts2-jquery-plugin 5.0.1 and the error seems to be fixed

lukaszlenart commented 1 year ago

I close this issue, as the new version addresses the problem.