私は小さなWebサービスアプリケーションを実装しています。私のクライアント側では、最初に1つのBeanを実装しました。それはうまくいき、xhtmlページと通信していました。それから、別のクラスのBeanを作ることにしました。すべてが完璧に動作していました。そして、もう使用していないので、最初のBeanを削除することにしました。今、何が機能していないと私はいつもこの "HTTPステータス404 - /ExchangeRatesClient/exchangeRates/index.xhtml" を参照してくださいHTTPステータス取得404リクエストされたリソースが利用できませんTomcat JSF Eclipse
のweb.xml:
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" version="3.1">
<display-name>ExchangeRates</display-name>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.htm</welcome-file>
<welcome-file>index.jsp</welcome-file>
<welcome-file>default.html</welcome-file>
<welcome-file>default.htm</welcome-file>
<welcome-file>default.jsp</welcome-file>
</welcome-file-list>
<servlet>
<display-name>Apache-Axis Servlet</display-name>
<servlet-name>AxisServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AxisServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/servlet/AxisServlet</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>*.jws</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>AxisServlet</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
<servlet>
<display-name>Axis Admin Servlet</display-name>
<servlet-name>AdminServlet</servlet-name>
<servlet-class>org.apache.axis.transport.http.AdminServlet</servlet-class>
<load-on-startup>100</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>AdminServlet</servlet-name>
<url-pattern>/servlet/AdminServlet</url-pattern>
</servlet-mapping>
</web-app>`enter code here`
の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>ExchangeRatesClient</groupId>
<artifactId>ExchangeRatesClient</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Exchange Rates Client</name>
<repositories>
<repository>
<id>prime-repo</id>
<name>Prime Repo</name>
<url>http://repository.primefaces.org</url>
</repository>
</repositories>
<dependencies>
<!-- PrimeFaces -->
<dependency>
<groupId>org.primefaces</groupId>
<artifactId>primefaces</artifactId>
<version>3.3</version>
</dependency>
<dependency>
<groupId>org.primefaces.themes</groupId>
<artifactId>cupertino</artifactId>
<version>1.0.8</version>
</dependency>
<!-- JSF 2 -->
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-api</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>com.sun.faces</groupId>
<artifactId>jsf-impl</artifactId>
<version>2.1.11</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>jstl</artifactId>
<version>1.2</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
</dependency>
<dependency>
<groupId>javax.servlet.jsp</groupId>
<artifactId>jsp-api</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>com.sun.el</groupId>
<artifactId>el-ri</artifactId>
<version>1.0</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-annotations-api</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina-ant</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina-ha</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-storeconfig</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-tribes</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-catalina</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.eclipse.jdt.core.compiler</groupId>
<artifactId>ecj</artifactId>
<version>4.5.1</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-el-api</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper-el</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jasper</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jaspic-api</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jsp-api</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-servlet-api</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-api</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-coyote</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-dbcp</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-i18n-es</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-i18n-fr</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-i18n-ja</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jdbc</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-jni</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util-scan</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-util</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-websocket</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>org.apache.tomcat</groupId>
<artifactId>tomcat-websocket-api</artifactId>
<version>8.5.11</version>
</dependency>
<dependency>
<groupId>axis</groupId>
<artifactId>axis</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>commons-discovery</groupId>
<artifactId>commons-discovery</artifactId>
<version>0.2</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-jaxrpc</artifactId>
<version>1.4</version>
</dependency>
<dependency>
<groupId>org.apache.axis</groupId>
<artifactId>axis-saaj</artifactId>
<version>1.4</version>
</dependency>
</dependencies>
<build>
<finalName>JavaServerFaces</finalName>
<sourceDirectory>src</sourceDirectory>
<plugins>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.0.0</version>
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
</configuration>
</plugin>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.5.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
豆:
package exchange.web.service;
import java.io.Serializable;
import java.rmi.RemoteException;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.SessionScoped;
import exchange.web.bean.Currency;
@SessionScoped
@ManagedBean(name = "exchangeService")
public class ExchangeRatesServiceProxy implements Serializable, ExchangeRatesService {
/**
*
*/
private static final long serialVersionUID = 1357125747412062186L;
private String _endpoint = null;
private exchange.web.service.ExchangeRatesService exchangeRatesService = null;
private float amount = (float) 0.0;
private String from = Currency.KZT.name();
private String to = Currency.USD.name();
private float result = (float) 2.2;
public ExchangeRatesServiceProxy() {
_initExchangeRatesServiceProxy();
}
public ExchangeRatesServiceProxy(String endpoint) {
_endpoint = endpoint;
_initExchangeRatesServiceProxy();
}
private void _initExchangeRatesServiceProxy() {
try {
exchangeRatesService = (new exchange.web.service.ExchangeRatesServiceServiceLocator())
.getExchangeRatesService();
if (exchangeRatesService != null) {
if (_endpoint != null)
((javax.xml.rpc.Stub) exchangeRatesService)._setProperty("javax.xml.rpc.service.endpoint.address",
_endpoint);
else
_endpoint = (String) ((javax.xml.rpc.Stub) exchangeRatesService)
._getProperty("javax.xml.rpc.service.endpoint.address");
}
} catch (javax.xml.rpc.ServiceException serviceException) {
}
}
public String getEndpoint() {
return _endpoint;
}
public void setEndpoint(String endpoint) {
_endpoint = endpoint;
if (exchangeRatesService != null)
((javax.xml.rpc.Stub) exchangeRatesService)._setProperty("javax.xml.rpc.service.endpoint.address",
_endpoint);
}
public exchange.web.service.ExchangeRatesService getExchangeRatesService() {
if (exchangeRatesService == null)
_initExchangeRatesServiceProxy();
return exchangeRatesService;
}
public void invokeExchange() {
try {
result = this.exchange(Currency.valueOf(from).ordinal(), Currency.valueOf(to).ordinal(), amount);
} catch (RemoteException e) {
e.printStackTrace();
}
}
public float exchange(int from, int to, float amount) throws java.rmi.RemoteException {
if (exchangeRatesService == null)
_initExchangeRatesServiceProxy();
return exchangeRatesService.exchange(from, to, amount);
}
public float getAmount() {
return amount;
}
public void setAmount(float amount) {
this.amount = amount;
}
public String getFrom() {
return from;
}
public void setFrom(String from) {
this.from = from;
}
public String getTo() {
return to;
}
public void setTo(String to) {
this.to = to;
}
public float getResult() {
return result;
}
public void setResult(float result) {
this.result = result;
}
public Currency[] getCurrencies() {
return Currency.values();
}
}
それは前に働いていたし、今ちょうど完全に壊れた理由はわかりません:(
012 pom.xmlで
によって到達されました 'index.xhtml'ページも削除しましたか?それとも、「ウェルカムリスト」のエントリから削除しただけですか? – Omar
いいえ、削除しませんでした。何か不足していますか? – RitaRita
これはうまくいきましたが、今は動作していますが、それはなぜ以前に動作したのか理解できません。 – RitaRita