次のスニペットをコードに追加します。
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr();
次の依存関係を追加しなければならない状況を作成しました (cxf.version は 2.7.1 として定義されています)。
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
私はすでにpom.xmlに次のものを持っていましたが:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
後で依存関係を追加しないと、プロジェクトはビルドされず、「パッケージ org.apache.cxf.transport.http が存在しません」と不平を言います。
以前のもの ( が付いているもの<scope>runtime</scope>
) を削除すると、プロジェクトは正常にビルドされますが、.war
はClassNotFoundException: org.apache.cxf.endpoint.AbstractEndpointFactory
.
同じ pom.xml でまったく同じ groupId/artifactId/version が 2 回出現する必要があるのはなぜですか?
このパッケージが一度だけリストされるように、pom.xml をクリーンアップ/整理するにはどうすればよいですか?