Venkat Naveen created CXF-9089:
----------------------------------

             Summary: My services are not available after upgrading my cxf from 
3.5.9 to 4.0.5
                 Key: CXF-9089
                 URL: https://issues.apache.org/jira/browse/CXF-9089
             Project: CXF
          Issue Type: Bug
            Reporter: Venkat Naveen
         Attachments: Web+Service+Projects.zip

My services are not available after upgrading my cxf version from 3.5.9 to 4.0.5
or please provide me the reference sample project with 4.0.5 with cxf servlet 
config latest with jakarta ee9 and using java 17 with spring 5.3.x/6.
please find the below project attached and details also.

added details below

1)pom.xml

2)cxf-servlet.xml

3)web.xml

could you please help me configuring this and attached the old cxf project.

+*Before it was working with old cxf version*+

*1)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/maven-v4_0_0.xsd";>
<modelVersion>4.0.0</modelVersion>
<groupId>com.bharath.trainings.ws</groupId>
<artifactId>sumws</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>sumws Maven Webapp</name>
<url>http://maven.apache.org</url>
<properties>
<cxf.version>3.1.9</cxf.version>
</properties>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.2</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>2.1</version>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>
</plugins>
<finalName>sumws</finalName>
</build>

<dependencies>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>commons-httpclient</groupId>
<artifactId>commons-httpclient</artifactId>
<version>3.1</version>
</dependency>

<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>3.2.0.RELEASE</version>
</dependency>
</dependencies>
</project>
 
*2)cxf-servlet.xml*
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://www.springframework.org/schema/beans";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xmlns:jaxws="http://cxf.apache.org/jaxws";
xmlns:cxf="http://cxf.apache.org/core"; 
xmlns:soap="http://cxf.apache.org/bindings/soap";
xsi:schemaLocation="http://cxf.apache.org/core 
http://cxf.apache.org/schemas/core.xsd 
http://www.springframework.org/schema/beans 
http://www.springframework.org/schema/beans/spring-beans.xsd 
http://cxf.apache.org/bindings/soap 
http://cxf.apache.org/schemas/configuration/soap.xsd 
http://cxf.apache.org/jaxws http://cxf.apache.org/schemas/jaxws.xsd";>

<jaxws:server id="sumService" serviceClass="com.bharath.trainings.ws.SumWS"
address="/sumService">
<jaxws:serviceBean>
<bean class="com.bharath.trainings.ws.SumWSImpl" />
</jaxws:serviceBean>
<jaxws:inInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken Encrypt Signature Timestamp" />
<entry key="passwordType" value="PasswordText" />
<entry key="passwordCallbackRef" value-ref="myPasswordCallback" />
<entry key="decryptionPropFile" value="etc/serviceKeystore.properties" />
<entry key="signaturePropFile" value="etc/serviceKeystore.properties" />
</map>
</constructor-arg>

</bean>
</jaxws:inInterceptors>
<jaxws:outInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Timestamp Signature Encrypt" />
<entry key="passwordCallbackRef" value-ref="myPasswordCallback" />
<entry key="encryptionPropFile" value="etc/serviceKeystore.properties" />
<entry key="encryptionUser" value="myclientkey" />
<entry key="encryptionParts"
value="\{Element}{http://www.w3.org/2000/09/xmldsig#}Signature;\{Content}{http://schemas.xmlsoap.org/soap/envelope/}Body";
 />
<entry key="signaturePropFile" value="etc/serviceKeystore.properties" />
<entry key="signatureUser" value="myservicekey" />
<entry key="signatureParts"
value="\{Element}{http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;\{Element}{http://schemas.xmlsoap.org/soap/envelope/}Body";
 />
</map>
</constructor-arg>
</bean>
</jaxws:outInterceptors>
</jaxws:server>

<bean id="myPasswordCallback" 
class="com.bharath.trainings.ws.PasswordCallbackHandler" />
<cxf:bus>
<cxf:features>
<cxf:logging />
</cxf:features>
</cxf:bus>

</beans>
 
*3)web.xml*
<!DOCTYPE web-app PUBLIC
"-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd"; >

<web-app>
<display-name>Sum Service</display-name>
<servlet>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>
</web-app>
 
+*After upgrade not working*+

*1)pom.xml*
<?xml version="1.0" encoding="UTF-8"?>
<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/maven-v4_0_0.xsd";>
<modelVersion>4.0.0</modelVersion>

<groupId>com.bharath.trainings.ws</groupId>
<artifactId>sumws</artifactId>
<packaging>war</packaging>
<version>0.0.1-SNAPSHOT</version>
<name>sumws Maven Webapp</name>
<url>http://maven.apache.org</url>

<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<cxf.version>4.0.5</cxf.version>
<jetty.version>11.0.14</jetty.version>
<spring.version>5.3.30</spring.version>
<jakarta.version>9.1.0</jakarta.version>
</properties>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.10.1</version>
<configuration>
<source>${maven.compiler.source}</source>
<target>${maven.compiler.target}</target>
</configuration>
</plugin>

<plugin>
<artifactId>maven-war-plugin</artifactId>
<version>3.4.0</version>
<configuration>
<webXml>src/main/webapp/WEB-INF/web.xml</webXml>
</configuration>
</plugin>

<plugin>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-maven-plugin</artifactId>
<version>${jetty.version}</version>
</plugin>
</plugins>
<finalName>sumws</finalName>
</build>

<dependencies>
<!-- Jetty Dependencies -->
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-server</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>${jetty.version}</version>
</dependency>
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-webapp</artifactId>
<version>${jetty.version}</version>
</dependency>

<!-- Apache CXF Dependencies (Jakarta EE 9 Compatible) -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-frontend-jaxws</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf.version}</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-ws-security</artifactId>
<version>${cxf.version}</version>
</dependency>

<!-- Jakarta EE APIs -->
<dependency>
<groupId>jakarta.jws</groupId>
<artifactId>jakarta.jws-api</artifactId>
<version>2.1.0</version>
</dependency>

<dependency>
<groupId>jakarta.servlet</groupId>
<artifactId>jakarta.servlet-api</artifactId>
<version>5.0.0</version>
<scope>provided</scope>
</dependency>


<!-- Spring Framework (5.3.x) -->
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-core</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-context</artifactId>
<version>${spring.version}</version>
</dependency>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>${spring.version}</version>
</dependency>

<!-- Utilities -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.13.0</version>
</dependency>
<dependency>
<groupId>commons-codec</groupId>
<artifactId>commons-codec</artifactId>
<version>1.17.0</version>
</dependency>
</dependencies>
</project>


+*2)cxf-servlet.xml*+
<?xml version="1.0" encoding="UTF-8"?>
<beans
xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance";
xmlns:jaxws="https://cxf.apache.org/jaxws";
xmlns:cxf="https://cxf.apache.org/core";
xmlns:soap="https://cxf.apache.org/bindings/soap";
xsi:schemaLocation="
https://cxf.apache.org/core https://cxf.apache.org/schemas/core.xsd
https://www.springframework.org/schema/beans 
https://www.springframework.org/schema/beans/spring-beans.xsd
https://cxf.apache.org/bindings/soap 
https://cxf.apache.org/schemas/configuration/soap.xsd
https://cxf.apache.org/jaxws https://cxf.apache.org/schemas/jaxws.xsd
https://www.springframework.org/schema/beans ">

<!-- JAX-WS Service Configuration -->
<jaxws:server id="sumService" serviceClass="com.bharath.trainings.ws.SumWS"
address="/sumService">
<jaxws:serviceBean>
<bean class="com.bharath.trainings.ws.SumWSImpl"/>
</jaxws:serviceBean>

<!-- Inbound Interceptors -->
<jaxws:inInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JInInterceptor">
<constructor-arg>
<map>
<entry key="action" value="UsernameToken Encrypt Signature Timestamp"/>
<entry key="passwordType" value="PasswordText"/>
<entry key="passwordCallbackRef" value-ref="myPasswordCallback"/>
<entry key="decryptionPropFile" value="etc/serviceKeystore.properties"/>
<entry key="signaturePropFile" value="etc/serviceKeystore.properties"/>
</map>
</constructor-arg>
</bean>
</jaxws:inInterceptors>

<!-- Outbound Interceptors -->
<jaxws:outInterceptors>
<bean class="org.apache.cxf.ws.security.wss4j.WSS4JOutInterceptor">
<constructor-arg>
<map>
<entry key="action" value="Timestamp Signature Encrypt"/>
<entry key="passwordCallbackRef" value-ref="myPasswordCallback"/>
<entry key="encryptionPropFile" value="etc/serviceKeystore.properties"/>
<entry key="encryptionUser" value="myclientkey"/>
<entry key="encryptionParts"
value="\{Element}{https://www.w3.org/2000/09/xmldsig#}Signature;\{Content}{https://jakarta.xml.soap/envelope/}Body"/>
<entry key="signaturePropFile" value="etc/serviceKeystore.properties"/>
<entry key="signatureUser" value="myservicekey"/>
<entry key="signatureParts"
value="\{Element}{https://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd}Timestamp;\{Element}{https://jakarta.xml.soap/envelope/}Body"/>
</map>
</constructor-arg>
</bean>
</jaxws:outInterceptors>
</jaxws:server>

<!-- Password Callback -->
<bean id="myPasswordCallback" 
class="com.bharath.trainings.ws.PasswordCallbackHandler"/>

<!-- CXF Bus Configuration -->
<cxf:bus>
<cxf:features>
<cxf:logging/>
</cxf:features>
</cxf:bus>
</beans>


+*3)web.xml*+
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app PUBLIC "-//Jakarta EE//DTD Web Application 5.0//EN" 
"http://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd";>
<web-app xmlns="https://jakarta.ee/xml/ns/jakartaee";
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
xsi:schemaLocation="https://jakarta.ee/xml/ns/jakartaee
http://jakarta.ee/xml/ns/jakartaee/web-app_5_0.xsd";
version="5.0">

<display-name>Sum Service</display-name>

<servlet>
<servlet-name>cxf</servlet-name>
<servlet-class>org.apache.cxf.transport.servlet.CXFServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>

<servlet-mapping>
<servlet-name>cxf</servlet-name>
<url-pattern>/services/*</url-pattern>
</servlet-mapping>

</web-app>



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to