Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/356.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/jsp/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/cocoa/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 尝试使用struts jquery标记但遇到多个异常?_Java_Jsp_Maven_Struts2_Struts2 Jquery Plugin - Fatal编程技术网

Java 尝试使用struts jquery标记但遇到多个异常?

Java 尝试使用struts jquery标记但遇到多个异常?,java,jsp,maven,struts2,struts2-jquery-plugin,Java,Jsp,Maven,Struts2,Struts2 Jquery Plugin,我将使用,但应用程序抛出以下错误。基于,我将struts更改为struts2,基于,我将bean添加到struts.xml文件中,但没有效果 <%@ taglib prefix="sj" uri="/struts2-jquery-tags" %> 例外情况 ERROR [CommonsLogger.java:38] Unable to load configuration. - bean - jar:file:/C:/Users/Alex/Projects/Myproject

我将使用,但应用程序抛出以下错误。基于,我将struts更改为struts2,基于,我将bean添加到struts.xml文件中,但没有效果

 <%@ taglib prefix="sj" uri="/struts2-jquery-tags" %>

例外情况

ERROR [CommonsLogger.java:38] Unable to load configuration. - bean - jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar!/struts-plugin.xml:27:152

Caused by: Unable to load bean: type:org.apache.struts2.views.TagLibraryDirectiveProvider class:com.jgeppert.struts2.jquery.grid.views.JqueryGridTagLibrary - bean - jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar!/struts-plugin.xml:27:152

Caused by: java.lang.NoClassDefFoundError: org/apache/struts2/views/TagLibraryDirectiveProvider

Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.TagLibraryDirectiveProvider
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
    at org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
    ... 63 more

SEVERE:   WebModule[]Exception starting filter struts2
java.lang.InstantiationException
    at org.apache.catalina.core.ApplicationFilterConfig.<init>(ApplicationFilterConfig.java:135)

Caused by: Unable to load configuration. - bean - jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar!/struts-plugin.xml:27:152

Caused by: Unable to load configuration. - bean - jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar!/struts-plugin.xml:27:152

Caused by: Unable to load configuration. - bean - jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar!/struts-plugin.xml:27:152

Caused by: Unable to load configuration. - bean - jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar!/struts-plugin.xml:27:152

Caused by: Unable to load bean: type:org.apache.struts2.views.TagLibraryDirectiveProvider class:com.jgeppert.struts2.jquery.grid.views.JqueryGridTagLibrary - bean - jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar!/struts-plugin.xml:27:152

Caused by: java.lang.NoClassDefFoundError: org/apache/struts2/views/TagLibraryDirectiveProvider

Caused by: java.lang.ClassNotFoundException: org.apache.struts2.views.TagLibraryDirectiveProvider
错误[commonLogger.java:38]无法加载配置。-bean-jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar/struts plugin.xml:27:152
原因:无法加载bean:type:org.apache.struts2.views.TagLibraryDirectiveProvider类:com.jgeppert.struts2.jquery.grid.views.JqueryGridTagLibrary-bean-jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar/struts plugin.xml:27:152
原因:java.lang.NoClassDefFoundError:org/apache/struts2/views/TagLibraryDirectiveProvider
原因:java.lang.ClassNotFoundException:org.apache.struts2.views.TagLibraryDirectiveProvider
位于org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1761)
位于org.glassfish.web.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1611)
... 63多
严重:WebModule[]异常启动筛选器struts2
java.lang.InstanceionException
位于org.apache.catalina.core.ApplicationFilterConfig.(ApplicationFilterConfig.java:135)
原因:无法加载配置。-bean-jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar/struts plugin.xml:27:152
原因:无法加载配置。-bean-jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar/struts plugin.xml:27:152
原因:无法加载配置。-bean-jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar/struts plugin.xml:27:152
原因:无法加载配置。-bean-jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar/struts plugin.xml:27:152
原因:无法加载bean:type:org.apache.struts2.views.TagLibraryDirectiveProvider类:com.jgeppert.struts2.jquery.grid.views.JqueryGridTagLibrary-bean-jar:file:/C:/Users/Alex/Projects/Myproject/target/Myproject-1.0/WEB-INF/lib/struts2-jquery-grid-plugin-3.7.0.jar/struts plugin.xml:27:152
原因:java.lang.NoClassDefFoundError:org/apache/struts2/views/TagLibraryDirectiveProvider
原因:java.lang.ClassNotFoundException:org.apache.struts2.views.TagLibraryDirectiveProvider
POM.xml

  <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.3.8</version>
        </dependency>
   <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-convention-plugin</artifactId>
            <version>2.3.14</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-dojo-plugin</artifactId>
            <version>2.3.14</version>
        </dependency>
        <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts-taglib</artifactId>
            <version>1.3.10</version>
        </dependency>
   <dependency>
        <groupId>com.jgeppert.struts2.jquery</groupId>
        <artifactId>struts2-jquery-plugin</artifactId>
        <version>3.7.0</version>
    </dependency>
    <dependency>
        <groupId>com.jgeppert.struts2.jquery</groupId>
        <artifactId>struts2-jquery-grid-plugin</artifactId>
        <version>3.7.0</version>
    </dependency>
    <dependency>
        <groupId>com.jgeppert.struts2.jquery</groupId>
        <artifactId>struts2-jquery-richtext-plugin</artifactId>
        <version>3.7.0</version>
    </dependency>
    <dependency>
        <groupId>com.jgeppert.struts2.jquery</groupId>
        <artifactId>struts2-jquery-tree-plugin</artifactId>
        <version>3.7.0</version>
    </dependency>
    <dependency>
        <groupId>com.jgeppert.struts2.jquery</groupId>
        <artifactId>struts2-jquery-mobile-plugin</artifactId>
        <version>3.7.0</version>
    </dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>jsp-api</artifactId>
    <version>2.0</version>
</dependency>
<dependency>
    <groupId>javax.servlet</groupId>
    <artifactId>servlet-api</artifactId>
    <version>2.5</version>
</dependency>
<dependency>
    <groupId>org.apache.struts</groupId>
    <artifactId>struts-annotations</artifactId>
    <version>1.0.5</version>
</dependency>
<dependency>
    <groupId>junit</groupId>
    <artifactId>junit</artifactId>
    <version>4.11</version>
</dependency>
            <dependency>
    <groupId>org.freemarker</groupId>
    <artifactId>freemarker</artifactId>
    <version>2.3.20</version>
</dependency>
          <dependency>
    <groupId>org.apache.velocity</groupId>
    <artifactId>velocity</artifactId>
    <version>1.7</version>
</dependency>

org.apache.struts
struts2型芯
2.3.8
org.apache.struts
struts2约定插件
2.3.14
org.apache.struts
struts2 dojo插件
2.3.14
org.apache.struts
struts标记库
1.3.10
com.jgeppert.struts2.jquery
struts2 jquery插件
3.7.0
com.jgeppert.struts2.jquery
struts2 jquery网格插件
3.7.0
com.jgeppert.struts2.jquery
struts2 jquery richtext插件
3.7.0
com.jgeppert.struts2.jquery
struts2 jquery树插件
3.7.0
com.jgeppert.struts2.jquery
struts2 jquery移动插件
3.7.0
javax.servlet
jsp api
2
javax.servlet
servlet api
2.5
org.apache.struts
struts注释
1.0.5
朱尼特
朱尼特
4.11
org.freemarker
自由标记
2.3.20
org.apache.velocity
速度
1.7

您有依赖性问题:

类TagLibraryDirectiveProvider存在于struts2 core jar中,但其版本(2.3.16)比您声明的版本(2.3.8)更新:


升级依赖项非常简单。

我可以使用Struts2 2.3.14上的jQuery插件,我只是删除了应用程序的目标目录,并使用了以下依赖项

 <dependency>
            <groupId>org.apache.struts</groupId>
            <artifactId>struts2-core</artifactId>
            <version>2.3.14</version>
        </dependency>
        <dependency>
            <groupId>com.jgeppert.struts2.jquery</groupId>
            <artifactId>struts2-jquery-plugin</artifactId>
            <version>3.6.1</version>
        </dependency>
             <dependency>
        <groupId>org.apache.velocity</groupId>
        <artifactId>velocity</artifactId>
        <version>1.7</version>
      </dependency>

org.apache.struts
struts2型芯
2.3.14
com.jgeppert.struts2.jquery
struts2 jquery插件
3.6.1
org.apache.velocity
速度
1.7

我编译并将它们添加到我的classes文件夹中

如果我将其更改为最新版本的2.3.16.1,我就不能再使用ServletResponseAware接口了。我还为此发布了一个问题:为什么要使用Struts 1.3标记库?
/*
 * $Id$
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.struts2.views;

import java.util.List;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.opensymphony.xwork2.util.ValueStack;

/**
 * Provides Velocity implementation classes for a tag library
 */
public interface TagLibraryDirectiveProvider {

    /**
     * Gets a list of Velocity directive classes for the tag library.  Called once on framework
     * startup when initializing Velocity.
     *
     * @return A list of Velocity directive classes
     */
    public List<Class> getDirectiveClasses();

}
/*
 * $Id: TagLibrary.java 651946 2008-04-27 13:41:38Z apetrelli $
 *
 * Licensed to the Apache Software Foundation (ASF) under one
 * or more contributor license agreements.  See the NOTICE file
 * distributed with this work for additional information
 * regarding copyright ownership.  The ASF licenses this file
 * to you under the Apache License, Version 2.0 (the
 * "License"); you may not use this file except in compliance
 * with the License.  You may obtain a copy of the License at
 *
 *  http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing,
 * software distributed under the License is distributed on an
 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 * KIND, either express or implied.  See the License for the
 * specific language governing permissions and limitations
 * under the License.
 */

package org.apache.struts2.views;

import com.opensymphony.xwork2.util.ValueStack;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

/**
 * Provides Freemarker implementation classes for a tag library
 */
public interface TagLibraryModelProvider {

    /**
     * Gets a Java object that contains getters for the tag library's Freemarker models.
     * Called once per Freemarker template processing.
     *
     * @param stack The current value stack
     * @param req The HTTP request
     * @param res The HTTP response
     * @return The Java object containing the Freemarker model getter methods
     */
    Object getModels(ValueStack stack, HttpServletRequest req, HttpServletResponse res);

}