Apache Tomahawk 文件上传不工作

发布于 2024-10-20 10:34:06 字数 7294 浏览 10 评论 0原文

我在使用 Apache Tomahawk 时遇到问题 - Glassfish 3.0.1 不断记录:

警告:JSF1064:无法从库 org.apache.myfaces.custom 中找到或提供资源 inputFileUpload.xhtml。

我在 /lib 中包含以下库:

  • tomahawk20-1.1.10.jar
  • commons-collections-3.2.1.jar
  • commons-io-1.4.jar
  • commons-fileupload-1.2.1.jar
  • commons-logging-1.1.1。 jar

这是我的 web.xml。

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <!-- Context Params -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.allowTextChildren</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.PRIVATE_CAPTCHA_KEY</param-name>
        <param-value>6Lfm9L4SAAAAALtVsc5E-9pvHmJueDxSXtnNahV9</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.PUBLIC_CAPTCHA_KEY</param-name>
        <param-value>6Lfm9L4SAAAAADKCm-Gi4rYLvo_B2ddLLTkvktAO</param-value>
    </context-param>

    <!-- File Upload Paths -->
    <context-param>
        <param-name>UPLOAD_DATA_URL</param-name>
        <param-value>/resources/app/uploads/data/</param-value>
    </context-param>
    <context-param>
        <param-name>UPLOAD_DTS_URL</param-name>
        <param-value>/resources/app/uploads/dts/</param-value>
    </context-param>
    <context-param>
        <param-name>UPLOAD_VALIDATORS_URL</param-name>
        <param-value>/resources/app/uploads/validators/</param-value>
    </context-param>

    <!-- MS Windows-based context parameters (DEV). See PROJECT_STAGE. -->
    <context-param>
        <description>Specifies the MS Windows path separator.</description>
        <param-name>WIN_PATH_SEPARATOR</param-name>
        <param-value>\</param-value>
    </context-param>
    <context-param>
        <description>Specifies the MS Windows file server path for base-level file IO.</description>
        <param-name>WIN_FILE_SVR_PATH</param-name>
        <param-value>\</param-value>
    </context-param>

    <!-- For Apache TomaHawk MyFaces -->
    <context-param>
        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
        <param-value>/faces/myFacesExtensionResource</param-value>
    </context-param>

    <!-- Filters -->
    <filter>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>5m</param-value>
        </init-param>
        <init-param>
            <param-name>uploadThresholdSize</param-name>
            <param-value>100k</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
    </filter-mapping>
    <!--
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>*.xhtml</url-pattern>
    </filter-mapping>
    -->

    <!-- Servlets -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>Resource Servlet</servlet-name>
        <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Resource Servlet</servlet-name>
        <url-pattern>/primefaces_resource/*</url-pattern>
    </servlet-mapping>

    <!-- Mime Types -->
    <mime-mapping>
        <extension>xls</extension>
        <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>xlxs</extension>
        <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>doc</extension>
        <mime-type>application/msword</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>docx</extension>
        <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>dat</extension>
        <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>zip</extension>
        <mime-type>application/zip</mime-type>
    </mime-mapping>


    <!-- Session Management -->
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
    <!-- Pages -->
    <welcome-file-list>
        <welcome-file>faces/authenticate.xhtml</welcome-file>
    </welcome-file-list>
    <!-- Exceptions -->
</web-app>

在我的 Facelet 中,我使用 xmlns:t="http://myfaces.apache.org/tomahawk",但是 浏览标签时,我根本看不到 。我做错了什么?

I am having an issue with Apache Tomahawk - Glassfish 3.0.1 keeps logging:

WARNING: JSF1064: Unable to find or serve resource, inputFileUpload.xhtml, from library, org.apache.myfaces.custom.

I have the following libraries included in /lib:

  • tomahawk20-1.1.10.jar
  • commons-collections-3.2.1.jar
  • commons-io-1.4.jar
  • commons-fileupload-1.2.1.jar
  • commons-logging-1.1.1.jar

Here is my web.xml.

<?xml version="1.0" encoding="UTF-8"?>
<web-app version="3.0" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
    <!-- Context Params -->
    <context-param>
        <param-name>javax.faces.PROJECT_STAGE</param-name>
        <param-value>Development</param-value>
    </context-param>
    <context-param>
        <param-name>com.sun.faces.allowTextChildren</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>javax.faces.STATE_SAVING_METHOD</param-name>
        <param-value>server</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.PRIVATE_CAPTCHA_KEY</param-name>
        <param-value>6Lfm9L4SAAAAALtVsc5E-9pvHmJueDxSXtnNahV9</param-value>
    </context-param>
    <context-param>
        <param-name>primefaces.PUBLIC_CAPTCHA_KEY</param-name>
        <param-value>6Lfm9L4SAAAAADKCm-Gi4rYLvo_B2ddLLTkvktAO</param-value>
    </context-param>

    <!-- File Upload Paths -->
    <context-param>
        <param-name>UPLOAD_DATA_URL</param-name>
        <param-value>/resources/app/uploads/data/</param-value>
    </context-param>
    <context-param>
        <param-name>UPLOAD_DTS_URL</param-name>
        <param-value>/resources/app/uploads/dts/</param-value>
    </context-param>
    <context-param>
        <param-name>UPLOAD_VALIDATORS_URL</param-name>
        <param-value>/resources/app/uploads/validators/</param-value>
    </context-param>

    <!-- MS Windows-based context parameters (DEV). See PROJECT_STAGE. -->
    <context-param>
        <description>Specifies the MS Windows path separator.</description>
        <param-name>WIN_PATH_SEPARATOR</param-name>
        <param-value>\</param-value>
    </context-param>
    <context-param>
        <description>Specifies the MS Windows file server path for base-level file IO.</description>
        <param-name>WIN_FILE_SVR_PATH</param-name>
        <param-value>\</param-value>
    </context-param>

    <!-- For Apache TomaHawk MyFaces -->
    <context-param>
        <param-name>org.apache.myfaces.CHECK_EXTENSIONS_FILTER</param-name>
        <param-value>true</param-value>
    </context-param>
    <context-param>
        <param-name>org.apache.myfaces.RESOURCE_VIRTUAL_PATH</param-name>
        <param-value>/faces/myFacesExtensionResource</param-value>
    </context-param>

    <!-- Filters -->
    <filter>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <filter-class>org.apache.myfaces.webapp.filter.ExtensionsFilter</filter-class>
        <init-param>
            <param-name>uploadMaxFileSize</param-name>
            <param-value>5m</param-value>
        </init-param>
        <init-param>
            <param-name>uploadThresholdSize</param-name>
            <param-value>100k</param-value>
        </init-param>
    </filter>
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>/faces/myFacesExtensionResource/*</url-pattern>
    </filter-mapping>
    <!--
    <filter-mapping>
        <filter-name>MyFacesExtensionsFilter</filter-name>
        <url-pattern>*.xhtml</url-pattern>
    </filter-mapping>
    -->

    <!-- Servlets -->
    <servlet>
        <servlet-name>Faces Servlet</servlet-name>
        <servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
        <load-on-startup>1</load-on-startup>
    </servlet>
    <servlet-mapping>
        <servlet-name>Faces Servlet</servlet-name>
        <url-pattern>/faces/*</url-pattern>
    </servlet-mapping>
    <servlet>
        <servlet-name>Resource Servlet</servlet-name>
        <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
    </servlet>
    <servlet-mapping>
        <servlet-name>Resource Servlet</servlet-name>
        <url-pattern>/primefaces_resource/*</url-pattern>
    </servlet-mapping>

    <!-- Mime Types -->
    <mime-mapping>
        <extension>xls</extension>
        <mime-type>application/vnd.ms-excel</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>xlxs</extension>
        <mime-type>application/vnd.openxmlformats-officedocument.spreadsheetml.sheet</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>doc</extension>
        <mime-type>application/msword</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>docx</extension>
        <mime-type>application/vnd.openxmlformats-officedocument.wordprocessingml.document</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>dat</extension>
        <mime-type>application/octet-stream</mime-type>
    </mime-mapping>
    <mime-mapping>
        <extension>zip</extension>
        <mime-type>application/zip</mime-type>
    </mime-mapping>


    <!-- Session Management -->
    <session-config>
        <session-timeout>60</session-timeout>
    </session-config>
    <!-- Pages -->
    <welcome-file-list>
        <welcome-file>faces/authenticate.xhtml</welcome-file>
    </welcome-file-list>
    <!-- Exceptions -->
</web-app>

In my Facelet, I am using xmlns:t="http://myfaces.apache.org/tomahawk", but
when browsing tags, I don't see <t:inputFileUpload> at all. What am I doing wrong?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

寄人书 2024-10-27 10:34:06

Tomahawk 需要更多的 JAR。您一定在服务器启动期间看到过 Tomahawk 初始化警告/错误。例如,oro-2.0.8.jar 也是必需的。

另请参阅:

Tomahawk requires more JARs than that. You must have seen Tomahawk initialization warnings/errors during server startup. For example, oro-2.0.8.jar is also mandatory.

See also:

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文