Adding the following snippet to my code:
Message message = PhaseInterceptorChain.getCurrentMessage();
HttpServletRequest request = (HttpServletRequest)message.get(AbstractHTTPDestination.HTTP_REQUEST);
request.getRemoteAddr();
Created a situation in which I had to add the following dependency (cxf.version is defined as 2.7.1):
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
Although I already had earlier in my pom.xml the following:
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
<type>jar</type>
<scope>runtime</scope>
</dependency>
If I don't add that later dependency, the project will not build, complaining "package org.apache.cxf.transport.http does not exist".
If I remove the earlier one (the one with <scope>runtime</scope>
), the project will build successfully but the .war
will fail to deploy with ClassNotFoundException: org.apache.cxf.endpoint.AbstractEndpointFactory
.
Why are 2 occurrences of the same exact groupId/artifactId/version needed in the same pom.xml?
How do I clean/tidy up my pom.xml so that this package is only listed once?