获取HTTP错误405

时间:2011-05-03 10:54:40

标签: jsf maven glassfish primefaces glassfish-3

我正在尝试在Glassfish 3.1中设置一个PrimeFaces 2.2简单网页,Maven就是我的 项目管理工具。

目前,我的web.xml看起来像:

<?xml version="1.0" encoding="utf-8"?>
<web-app version="2.5" 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_2_5.xsd">
  <servlet>
    <servlet-name>Jersey Web Application</servlet-name>
    <servlet-class>
    com.sun.jersey.spi.container.servlet.ServletContainer</servlet-class>
    <init-param>
      <param-name>
      com.sun.jersey.config.property.packages</param-name>
      <param-value>org.myapp.services</param-value>
    </init-param>
    <load-on-startup>1</load-on-startup>
  </servlet>
  <servlet-mapping>
    <servlet-name>Jersey Web Application</servlet-name>
    <url-pattern>/webresources/*</url-pattern>
  </servlet-mapping>
  <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>*.jsf</url-pattern>
  </servlet-mapping>
  <servlet>
    <servlet-name>PrimeFaces Servlet</servlet-name>
    <servlet-class>org.primefaces.resource.ResourceServlet</servlet-class>
  </servlet>
  <servlet-mapping>
    <servlet-name>PrimeFaces Servlet</servlet-name>
    <url-pattern>*.xhtml</url-pattern>
  </servlet-mapping>
</web-app>

对于PrimeFaces,我在pom.xml上设置了以下依赖项:

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

,以及以下存储库:

<repository>
  <id>prime-repo</id>
  <name>Prime Technology Maven Repository</name>
  <url>http://repository.prime.com.tr</url>
  <layout>default</layout>
</repository>

然而,当我尝试在浏览器中打开.xhtml文件时,我得到: “HTTP状态405 - 此URL不支持HTTP方法GET”, 这真的很奇怪,因为org.primefaces.resource.ResourceServlet应该响应GET。我在这里缺少什么?

1 个答案:

答案 0 :(得分:1)

请按照网络上的教程进行操作,例如:http://technology.amis.nl/blog/6817/getting-started-with-primefaces-on-glassfish-v3或尝试使用PrimeFaces 3.0M1。