I was searching for rest service using apache camel - apache-camel

Getting error servlet unavailable. Program for rest service using camel
Getting error servlet unavailable. Program for rest service using camel
Getting error servlet unavailable. Program for rest service using camel
Getting error servlet unavailable. Program for rest service using camel
17:03:15,180 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/my]] (ServerService Thread Pool -- 57) JBWEB000289: Servlet myServlet threw load() exception: java.lang.ClassNotFoundException: org.apache.camel.component.servlet.CamelHttpTransportServlet from [Module "deployment..war:main" from Service Module Loader]
at org.jboss.modules.ModuleClassLoader.findClass(ModuleClassLoader.java:213) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassUnchecked(ConcurrentClassLoader.java:459) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClassChecked(ConcurrentClassLoader.java:408) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.performLoadClass(ConcurrentClassLoader.java:389) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.modules.ConcurrentClassLoader.loadClass(ConcurrentClassLoader.java:134) [jboss-modules.jar:1.3.7.Final-redhat-1]
at org.jboss.as.web.deployment.WebInjectionContainer.newInstance(WebInjectionContainer.java:78) [jboss-as-web-7.5.10.Final-redhat-2.jar:7.5.10.Final-redhat-2]
at org.apache.catalina.core.StandardWrapper.loadServlet(StandardWrapper.java:1166) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.apache.catalina.core.StandardWrapper.load(StandardWrapper.java:1112) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.apache.catalina.core.StandardContext.loadOnStartup(StandardContext.java:3593) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.apache.catalina.core.StandardContext.start(StandardContext.java:3802) [jbossweb-7.5.17.Final-redhat-1.jar:7.5.17.Final-redhat-1]
at org.jboss.as.web.deployment.WebDeploymentService.doStart(WebDeploymentService.java:163) [jboss-as-web-7.5.10.Final-redhat-2.jar:7.5.10.Final-redhat-2]
at org.jboss.as.web.deployment.WebDeploymentService.access$000(WebDeploymentService.java:61) [jboss-as-web-7.5.10.Final-redhat-2.jar:7.5.10.Final-redhat-2]
at org.jboss.as.web.deployment.WebDeploymentService$1.run(WebDeploymentService.java:96) [jboss-as-web-7.5.10.Final-redhat-2.jar:7.5.10.Final-redhat-2]
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471) [rt.jar:1.7.0_121]
at java.util.concurrent.FutureTask.run(FutureTask.java:262) [rt.jar:1.7.0_121]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_121]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_121]
at java.lang.Thread.run(Thread.java:745) [rt.jar:1.7.0_121]
at org.jboss.threads.JBossThread.run(JBossThread.java:122)
web.xml::
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:web="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<servlet>
<display-name>Camel Http Transport Servlet</display-name>
<servlet-name>apiServlet</servlet-name>
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
<load-on-startup>0</load-on-startup>
<init-param>
<param-name>ignoreDuplicateServletName</param-name>
<param-value>true</param-value>
</init-param>
</servlet>
<servlet-mapping>
<servlet-name>myServlet</servlet-name>
<url-pattern>/*</url-pattern>
</servlet-mapping>
</web-app>
pom.xml::
<!-- Provided -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cdi</artifactId>
<version>2.14.1</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-http4</artifactId>
<version>2.14.1</version>
</dependency>
<dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.1-api</artifactId>
<version>1.0.0.Final-redhat-1</version>
<scope>system</scope>
<systemPath>${project.basedir}/lib/hibernate-jpa-2.1-api-1.0.0.Final-redhat-1.jar</systemPath>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.ejb</groupId>
<artifactId>jboss-ejb-api_3.1_spec</artifactId>
<version>1.0.2.Final</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jboss.spec.javax.servlet</groupId>
<artifactId>jboss-servlet-api_3.0_spec</artifactId>
<version>1.0.2.Final</version>
<scope>provided</scope>
</dependency>
jboss-web.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-web>
<context-root>my</context-root>
</jboss-web>
routeBuilder::
public class MYRouteBuilder extends RouteBuilder {
#Inject
private MYRouteBuilderRequestResponseHandler requestResponse;
#Override
public void configure() throws Exception {
CommonUtils commonUtils=new CommonUtils();
restConfiguration().component("servlet").contextPath("/my").bindingMode(RestBindingMode.off).endpointProperty("servletName", "myServlet") .port(8084);

Aditi
you are mixing a lot of things together hoping it will work 'itself'. It won't. You have to configure the Camel context as a servlet.
For the start you may want check some examples, such as https://camel.apache.org/servlet-tomcat-example.html

Related

Apache Camel 3.x + Spring Boot + JDBC DataSource: java.lang.IllegalStateException: No supported DataSource type found

This is no doubt a configuration/dependency issue.
failing code snippet
#Bean
#ConfigurationProperties(prefix="rmw.datasource")
public DataSource getDataSource() {
return DataSourceBuilder.create().build();
}
application.properties
rmw.datasource.url=jdbc:sqlserver://123.123.123.123
rmw.datasource.driverClassName=com.microsoft.sqlserver.jdbc.SQLServerDriver
rmw.datasource.username=xxxx
rmw.datasource.password=zzzz
rmw.datasource.platform=sqlserver
I have tried with and without rmw.datasource.platform=sqlserver - it makes no difference.
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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>biz.suitej.poc</groupId>
<artifactId>http-producer</artifactId>
<version>0.0.1-SNAPSHOT</version>
<properties>
<java.version>1.11</java.version>
<camel.version>3.1.0</camel.version>
<maven-compiler-plugin.version>3.8.1</maven-compiler-plugin.version>
</properties>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-spring-boot-dependencies</artifactId>
<version>${camel.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-core-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-http-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-log-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-jackson-starter</artifactId>
</dependency>
<dependency>
<groupId>org.apache.camel.springboot</groupId>
<artifactId>camel-jdbc-starter</artifactId>
</dependency>
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>8.2.2.jre11</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>${maven-compiler-plugin.version}</version>
<configuration>
<source>11</source>
<target>11</target>
</configuration>
</plugin>
</plugins>
</build>
</project>
I have camel-jdbc-starter and mssql-jdbc JDBC driver.
I have tried camel-sql-starter and get the same error.
console output
2020-06-17 13:15:45.978 WARN 128833 --- [ main] s.c.a.AnnotationConfigApplicationContext : Exception encountered during context initialization - cancelling refresh attempt: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDataSource' defined in class path resource [c10y/sql/query/GetRemodelWorksRouteBuilder.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDataSource' threw exception; nested exception is java.lang.IllegalStateException: No supported DataSource type found
2020-06-17 13:15:45.998 INFO 128833 --- [ main] ConditionEvaluationReportLoggingListener :
Error starting ApplicationContext. To display the conditions report re-run your application with 'debug' enabled.
2020-06-17 13:15:46.009 ERROR 128833 --- [ main] o.s.boot.SpringApplication : Application run failed
org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'getDataSource' defined in class path resource [c10y/sql/query/GetRemodelWorksRouteBuilder.class]: Bean instantiation via factory method failed; nested exception is org.springframework.beans.BeanInstantiationException: Failed to instantiate [javax.sql.DataSource]: Factory method 'getDataSource' threw exception; nested exception is java.lang.IllegalStateException: No supported DataSource type found
at org.springframework.beans.factory.support.ConstructorResolver.instantiate(ConstructorResolver.java:656) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
at org.springframework.beans.factory.support.ConstructorResolver.instantiateUsingFactoryMethod(ConstructorResolver.java:484) ~[spring-beans-5.2.3.RELEASE.jar:5.2.3.RELEASE]
...
The solution listed elsewhere to add spring-boot-starter-data-jpa didn't work for me (it just returned a different error):
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
<version>1.5.6.RELEASE</version>
</dependency>
I'm baffled why this just doesn't work 'straight out of the box'.
Thanks in advance for your help.
Just after posting this I found the solution that worked for me:
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-jdbc</artifactId>
<version>1.5.6.RELEASE</version>
</dependency>

How to build a war file with camel-swagger-java and camel-servlet

I have created a rest Service using camel Rest DSL, camel-swagger-java and camel-servlet component then package into a war file and deploy to wildfly-11.0.0.Final, but got the following exception:
Caused by: org.jboss.as.server.deployment.DeploymentUnitProcessingException: java.lang.ClassNotFoundException: org.jboss.weld.environment.servlet.Listener from [Module \"deployment.camelSample-0.0.1-SNAPSHOT.war\" from Service Module Loader]
is there any way to build a war file with camel-swagger-java and camel-servlet that can successfully deploy on wildfly-11.0.0.Final? Looking forward to your answers. Thanks in advance.
pom.xml
<dependencies>
<!-- CDI API -->
<dependency>
<groupId>javax.enterprise</groupId>
<artifactId>cdi-api</artifactId>
<version>1.2</version>
<scope>provided</scope>
</dependency>
<!-- Camel -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cdi</artifactId>
<version>2.22.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-swagger-java</artifactId>
<version>2.22.0</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet</artifactId>
<version>2.22.0</version>
<scope>runtime</scope>
<exclusions>
<exclusion>
<groupId>org.apache.tomcat.embed</groupId>
<artifactId>tomcat-embed-logging-juli</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- JSON support -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jackson</artifactId>
<version>2.22.0</version>
</dependency>
</dependencies>
web.xml
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
<servlet>
<servlet-name>CamelServlet</servlet-name>
<servlet-class>org.apache.camel.component.servlet.CamelHttpTransportServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CamelServlet</servlet-name>
<url-pattern>/camel/*</url-pattern>
</servlet-mapping>
<servlet>
<servlet-name>SwaggerServlet</servlet-name>
<servlet-class>org.apache.camel.swagger.servlet.RestSwaggerServlet</servlet-class>
<init-param>
<param-name>base.path</param-name>
<param-value>rest</param-value>
</init-param>
<init-param>
<param-name>api.path</param-name>
<param-value>api-docs</param-value>
</init-param>
<init-param>
<param-name>api.version</param-name>
<param-value>1.2.3</param-value>
</init-param>
<init-param>
<param-name>api.title</param-name>
<param-value>User Services</param-value>
</init-param>
<init-param>
<param-name>api.description</param-name>
<param-value>Camel Rest Example with Swagger that provides an User REST service</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!-- swagger api -->
<servlet-mapping>
<servlet-name>SwaggerServlet</servlet-name>
<url-pattern>/api-docs/*</url-pattern>
</servlet-mapping>
UserRestRoute.java
public class UserRestRoute extends RouteBuilder {
#Override
public void configure() {
rest("/user").description("User rest service")
.consumes("application/json").produces("application/json")
.get("/{id}").description("Find user by id").outType(User.class)
.param().name("id").type(path).description("The id of the user to get").dataType("integer").endParam()
.responseMessage().code(200).message("The user").endResponseMessage()
.to("bean:userService?method=getUser(${header.id})");
}
}
You should remove the listener declaration from your web.xml:
<listener>
<listener-class>org.jboss.weld.environment.servlet.Listener</listener-class>
</listener>
It's only really useful for plain Servlet containers like Tomcat, Jetty etc. WildFly already provides Weld & CDI integration for you.

Google App Engine Application Suddenly Stopped Working, returning 503

I have an application running on Google App Engine, I deployed the last version of latest version of the application on Sep 6, 2018 but today the application stopped serving request and it is returning error 503 with the following
<HTML>
<HEAD>
<TITLE>Service Unavailable</TITLE>
</HEAD>
<BODY BGCOLOR="#FFFFFF" TEXT="#000000">
<H1>Service Unavailable</H1>
<H2>Error 503</H2>
</BODY>
</HTML>
I thought it was because i have not migrated to the deprecated Cloud Endpoint v1.1 to V2.0
But after I made the changes necessary for migration, when I try to deploy it still returns 503 while running the Maven command to deploy or generate Docs.
I am aware that Google stated that they are experiencing issues with some App Engine regions yesterday but I am not sure if it has anything to do with what I am experiencing.
My App engine application is using Us-central region.
Update: Looks like cloud endpoint V1.1 has been turned off and can no longer serve traffic so following the migration guide, I have been able to migrate to version 2.0 but unfortunately I am getting an error with the api-discovery doc
This is the error
500
API discovery response missing required fields.
I am trying to get around this
here is my pom.xml file
<?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/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>group-id</groupId>
<artifactId>artifact-id</artifactId>
<properties>
<app.id>project-id</app.id>
<app.version>1</app.version>
<appengine.version>1.9.64</appengine.version>
<gcloud.plugin.version>2.0.9.121.v20160815</gcloud.plugin.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<maven.compiler.source>1.7</maven.compiler.source>
<maven.compiler.target>1.7</maven.compiler.target>
<jackson.version>2.9.0</jackson.version>
<archiveClasses>true</archiveClasses>
</properties>
<prerequisites>
<maven>3.3.9</maven>
</prerequisites>
<dependencies>
<!-- Compile/runtime dependencies -->
<dependency>
<groupId>com.google.endpoints</groupId>
<artifactId>endpoints-framework</artifactId>
<version>2.1.0</version>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
<artifactId>javax.inject</artifactId>
<version>1</version>
</dependency>
<!-- Objectify library ready -->
<dependency>
<groupId>com.googlecode.objectify</groupId>
<artifactId>objectify</artifactId>
<version>6.0</version>
</dependency>
<!-- Apache Commons Library -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.0</version>
</dependency>
<!-- Add support for joda money library -->
<dependency>
<groupId>org.joda</groupId>
<artifactId>joda-money</artifactId>
<version>0.10.0</version>
</dependency>
<!--Added support for joda time library -->
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
<version>2.9.4</version>
</dependency>
<!-- end joda time api.-->
<!-- Load scrypt library for password encryption and decryption -->
<dependency>
<groupId>com.lambdaworks</groupId>
<artifactId>scrypt</artifactId>
<version>1.4.0</version>
</dependency>
<!-- Objectify utils to help us with currency -->
<dependency>
<groupId>com.sappenin.objectify</groupId>
<artifactId>objectify-utils</artifactId>
<version>5.1.3</version>
</dependency>
<!-- google guava -->
<dependency>
<groupId>com.google.guava</groupId>
<artifactId>guava</artifactId>
<version>19.0</version>
</dependency>
<!-- Apache poi for excel file processing -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi</artifactId>
<version>3.15</version>
</dependency>
<!-- https://mvnrepository.com/artifact/org.apache.poi/poi-ooxml -->
<dependency>
<groupId>org.apache.poi</groupId>
<artifactId>poi-ooxml</artifactId>
<version>3.15</version>
</dependency>
<!-- jackson-dataformat-csv-->
<dependency>
<groupId>com.fasterxml.jackson.dataformat</groupId>
<artifactId>jackson-dataformat-csv</artifactId>
<version>2.7.0</version>
</dependency>
<!-- jackson data bind library for json -->
<!-- Google cloud storage ends -->
<!-- google cloud storage client -->
<dependency>
<groupId>com.google.appengine.tools</groupId>
<artifactId>appengine-gcs-client</artifactId>
<version>0.7</version>
<exclusions>
<exclusion>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-appengine</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
</exclusion>
<exclusion>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
</exclusion>
</exclusions>
</dependency>
<dependency>
<groupId>com.google.cloud</groupId>
<artifactId>google-cloud-storage</artifactId>
<version>0.4.0</version>
</dependency>
<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client-appengine</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client-jackson2</artifactId>
<version>1.23.0</version>
</dependency>
<dependency>
<groupId>com.google.http-client</groupId>
<artifactId>google-http-client</artifactId>
<version>1.23.0</version>
</dependency>
<!-- Test Dependencies -->
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.mockito</groupId>
<artifactId>mockito-all</artifactId>
<version>2.0.2-beta</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>com.google.appengine</groupId>
<artifactId>appengine-api-stubs</artifactId>
<version>${appengine.version}</version>
<scope>test</scope>
</dependency>
<!-- Mail Dependencies with MailGun -->
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-core</artifactId>
<version>1.19.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey</groupId>
<artifactId>jersey-client</artifactId>
<version>1.19.1</version>
</dependency>
<dependency>
<groupId>com.sun.jersey.contribs</groupId>
<artifactId>jersey-multipart</artifactId>
<version>1.19.1</version>
</dependency>
<!-- End Mail Dependencies with MailGun -->
<dependency>
<groupId>org.freemarker</groupId>
<artifactId>freemarker-gae</artifactId>
<version>2.3.25-incubating</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-databind</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<!-- Note: core-annotations version x.y.0 is generally compatible with
(identical to) version x.y.1, x.y.2, etc. -->
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
<version>${jackson.version}</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-core</artifactId>
<version>${jackson.version}</version>
</dependency>
</dependencies>
<build>
<!-- for hot reload of the web application-->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>versions-maven-plugin</artifactId>
<version>2.1</version>
<executions>
<execution>
<phase>compile</phase>
<goals>
<goal>display-dependency-updates</goal>
<goal>display-plugin-updates</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<stage.enableJarClasses>true</stage.enableJarClasses>
<cloudSdkPath>/usr/local/Caskroom/google-cloud-sdk/latest/google-cloud-sdk</cloudSdkPath>
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.3.2</version>
<configuration>
<!-- deploy configuration -->
</configuration>
</plugin>
<plugin>
<groupId>com.google.cloud.tools</groupId>
<artifactId>endpoints-framework-maven-plugin</artifactId>
<version>1.0.2</version>
<configuration>
<!-- plugin configuration -->
<hostname>project-id.appspot.com</hostname>
</configuration>
<executions>
<execution>
<goals>
<goal>discoveryDocs</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
Here is my web.xml file
<?xml version="1.0" encoding="UTF-8"?>
<web-app version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" 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">
<!-- Endpoints web.xml -->
<!-- [START web] -->
<servlet>
<display-name>Remote API Servlet</display-name>
<servlet-name>RemoteApiServlet</servlet-name>
<servlet-class>com.google.apphosting.utils.remoteapi.RemoteApiServlet</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>Grader</servlet-name>
<servlet-class>com.softquest.apollo.servlets.Grader</servlet-class>
</servlet>
<servlet>
<servlet-name>SheetHandler</servlet-name>
<servlet-class>com.softquest.apollo.servlets.SheetHandler</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>RemoteApiServlet</servlet-name>
<url-pattern>/remote_api</url-pattern>
</servlet-mapping>
<!-- Score Sheet Servlet -->
<!-- Remote Api Servlet -->
<servlet>
<servlet-name>EndpointsServlet</servlet-name>
<servlet-class>com.google.api.server.spi.EndpointsServlet</servlet-class>
<init-param>
<param-name>services</param-name>
<param-value>com.softquest.apollo.services.UserServices</param-value>
</init-param>
</servlet>
<!-- Payment Response Servlet -->
<servlet>
<servlet-name>PaymentResponseServlet</servlet-name>
<servlet-class>com.softquest.apollo.servlets.PaymentResponseServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>PaymentResponseServlet</servlet-name>
<url-pattern>/PaymentResponse</url-pattern>
</servlet-mapping>
<!-- Payment Response Servlet-->
<servlet-mapping>
<servlet-name>EndpointsServlet</servlet-name>
<url-pattern>/_ah/api/*</url-pattern>
</servlet-mapping>
<!-- Objectify filter registration -->
<filter>
<filter-name>ObjectifyFilter</filter-name>
<filter-class>com.googlecode.objectify.ObjectifyFilter</filter-class>
</filter>
<filter-mapping>
<filter-name>ObjectifyFilter</filter-name>
<url-pattern>/*</url-pattern>
</filter-mapping>
<!-- Setup ServletContextListener to start up objectify entities on application -->
<servlet>
<servlet-name>BackEndStarter</servlet-name>
<servlet-class>com.softquest.apollo.BackEndStarter</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>BackEndStarter</servlet-name>
<url-pattern>/backend/starter</url-pattern>
</servlet-mapping>
<!-- Migration servlet -->
<servlet>
<servlet-name>MigrationServlet</servlet-name>
<servlet-class>com.softquest.apollo.servlets.MigrationServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MigrationServlet</servlet-name>
<url-pattern>/migration/*</url-pattern>
</servlet-mapping>
<!-- Migration Servlet-->
<!-- Migration Handler Servlet -->
<servlet>
<servlet-name>MigrationHandler</servlet-name>
<servlet-class>com.softquest.apollo.servlets.MigrationHandler</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>MigrationHandler</servlet-name>
<url-pattern>/migration-handler/*</url-pattern>
</servlet-mapping>
<!-- End of Migration handler Servlet-->
<!-- Setup web.xml to start up context listener -->
<servlet-mapping>
<servlet-name>Grader</servlet-name>
<url-pattern>/Grader</url-pattern>
</servlet-mapping>
<servlet-mapping>
<servlet-name>SheetHandler</servlet-name>
<url-pattern>/SheetHandler</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
I get this error when trying to call the api discovery doc, I have traced it to a null pointer error on line 72 of the
com.google.api.server.spi.EndpointsServlet file
if (!dispatcher.dispatch(method, path, context)) {
response.setStatus(HttpServletResponse.SC_NOT_FOUND);
response.getWriter().append("Not Found");
}
I am guessing the error is released to some third party library probably still using any of the older cloud endpoint maven dependencies or plugins. So I would remove all the dependencies from my pom.xml and try to deploy.
UPDATE:
I was able to fix the API discovery error, it was caused by a reflection error that had to do with the Google Guava Library, while the migration Doc had stated that Version 19 would work, it didn't, upgrading to version 20 and above fixed that for me, now I am getting error 404 on all the endpoints. I would write an answer when I am able to fix this.
Im getting the same problem on an endpoint that hasn't been changed in months, nothing is appearing in the logs either. I assume its probably an app engine problem.
EDIT
I fixed our problem, though you mention the you've attempted to update to the new Cloud Endpoint v2.0 and you are still having the problem it turns out for our project following the migration steps from v1.1 to v2 fixed the problem https://cloud.google.com/endpoints/docs/frameworks/python/migrating.
The docs say v1.1 was to be turned off August 2nd, I guess they have just got round to it
I have successfully migrated to Endpoints V2 after series of hit and trial method.
App Engine project developed on Android Studio has following structure-
project
app
backend
build.gradle
I have to change build.gradle in all 3 places. Where project is root project, app is android app, backend is App Engine app. All of these have thier own build.gradlew.
Let's change one by one.
/app/build.gradle (Make changes in the android client)
dependencies {
compile fileTree(dir: 'libs', include: ['*.jar'])
compile 'com.android.support:appcompat-v7:26.+'
// Remove this line
//compile project(path: ':micirclews', configuration: 'android-endpoints')
}
Apply the endpoints plugin after the android plugin
apply plugin: 'com.google.cloud.tools.endpoints-framework-client'
/backend/build.gradle (Make changes in the backend/appengine module)
buildscript {
repositories {
mavenCentral()
jcenter()
}
dependencies {
//Remove this
//classpath 'com.google.appengine:gradle-appengine-plugin:1.9.59'
//Add these two lines
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
}
}
Remove this- apply plugin: 'appengine'
Add these two-
apply plugin: 'com.google.cloud.tools.appengine'
apply plugin: 'com.google.cloud.tools.endpoints-framework-server'
dependencies {
//Remove these 3 lines-
//appengineSdk 'com.google.appengine:appengine-java-sdk:1.9.59'
//compile 'com.google.appengine:appengine-endpoints:1.9.59'
//compile 'com.google.appengine:appengine-endpoints-deps:1.9.59'
//Add these 2 lines-
compile 'com.google.endpoints:endpoints-framework:2.0.9'
compile 'javax.inject:javax.inject:1'
.....
}
// delete this whole block, it's configuration for the older plugin
// appengine {
// downloadSdk = true
// appcfg {
// oauth2 = true
// }
// endpoints {
// getClientLibsOnBuild = true
// getDiscoveryDocsOnBuild = true
// }
// }
/build.gradle (Make changes in the root's build.gradle)
buildscript {
repositories {
jcenter()
}
dependencies {
classpath 'com.android.tools.build:gradle:2.3.3'
//Add these 2 lines
classpath 'com.google.cloud.tools:endpoints-framework-gradle-plugin:1.0.2'
classpath 'com.google.cloud.tools:appengine-gradle-plugin:1.3.3'
}
}
After making all the changes carefully, Clean the project, Rebuild it and run it. Finally deploy it when everything work perfect.
You may refer the whole process here -
https://github.com/GoogleCloudPlatform/endpoints-framework-gradle-plugin/blob/master/ANDROID_README.md
As saiyr stated in the comments, Google Cloud Endpoints v1.1 has been completely deprecated and has stopped serving traffic and that is the reason for the errors I was having.
I solved this problem by migrating to cloud endpoints v2, the process is as easy as following the guide in the migration docs but here are some issues I had with Migration and how I fixed it.
Google guava library has to be updated to a version greater than version 19, using version 19 or lower could result in the application throwing reflection errors when handling requests.
If you have multiple service classes they have to be added to the web.xml file as service parameters while declaring the com.google.api.server.spi.EndpointsServlet Servlet.
for some reasons listing only one service class worked for me in cloud endpoint 1.0 Api docs and routes were generated for all the service classes I had without declaring everyone of them explicitly under the com.google.api.server.spi.SystemServiceServlet Servlet, I think it has something to do with Objectify filters though. See the Docs for more info
Since the Google App Engine Java 7 runtime is deprecated too, I decided to migrate to Java 8 but unfortunately the library I used to abstract the process of connecting to datastore (Objectify) appears not to work with the Java 8 runtime, I would look into this later, but reverting back to Java 7 runtime worked for me and the application is back up and running.
Update: The issue I faced migrating to Java 8 runtime had nothing to do with Objectify, the library I used for encrypting passwords (BCrypt) was the issue, it just did not work on the Google App Engine Java 8 runtime, I had to switch to the Encryption library in spring security.

CXF Working on jboss EAP 6

Currently working on getting a CXF web service up and running on JBOSS EAP 6. I currently have it running and working for the most part but every time there is a verification issue I get the following error.
08:58:49,180 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[default-host].[/data-api].[CXFServlet]] (http-/0.0.0.0:8080-2) JBWEB000236: Servlet.service() for servlet CXFServlet threw exception: java.lang.NoSuchMethodError: javax.ws.rs.InternalServerErrorException.validate(Ljavax/ws/rs/core/Response;Ljavax/ws/rs/core/Response$Status;)Ljavax/ws/rs/core/Response;
I am assuming it is a version conflict but I have already excluded the JBoss jaxrs subsystem. Has anyone else had this issue?
jboss-deployment-structure.xml:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure xmlns="urn:jboss:deployment-structure:1.2">
<deployment>
<exclude-subsystems>
<subsystem name="resteasy" />
<subsystem name="jaxrs" />
<subsystem name="webservices" />
</exclude-subsystems>
<exclusions>
<module name="javax.ws.rs.api"/>
<module name="org.apache.cxf"/>
<module name="org.apache.cxf.impl"/>
</exclusions>
</deployment>
</jboss-deployment-structure>
web.xml
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd" id="WebApp_ID" version="3.0">
<display-name>data-api</display-name>
<welcome-file-list>
<!-- Should implement a welcome page at some point -->
<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>
<servlet-name>CXFServlet</servlet-name>
<servlet-class>org.apache.cxf.jaxrs.servlet.CXFNonSpringJaxrsServlet</servlet-class>
<init-param>
<param-name>javax.ws.rs.Application</param-name>
<param-value>com.data.api.rest.ConfigApplication</param-value>
</init-param>
<init-param>
<param-name>jaxrs.application.address.ignore</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CXFServlet</servlet-name>
<url-pattern>/rest/*</url-pattern>
</servlet-mapping>
</web-app>
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>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.11</version>
<scope>test</scope>
</dependency>
<!-- Hibernate -->
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
<version>4.3.6.Final</version>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-validator</artifactId>
<version>5.1.2.Final</version>
</dependency>
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-bundle</artifactId>
<version>2.7.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-xc</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>org.codehaus.jackson</groupId>
<artifactId>jackson-jaxrs</artifactId>
<version>1.9.13</version>
</dependency>
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
<version>5.1.31</version>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-checkstyle-plugin</artifactId>
</plugin>
<plugin>
<groupId>com.googlecode.maven-java-formatter-plugin</groupId>
<artifactId>maven-java-formatter-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<configuration>
<overlays>
</overlays>
<archive>
<manifestEntries>
<Dependencies>org.apache.httpcomponents</Dependencies>
</manifestEntries>
</archive>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.jboss.as.plugins</groupId>
<artifactId>jboss-as-maven-plugin</artifactId>
</plugin>
</plugins>
</build>
</project>
This is the easiest solution to exclude JAX-RS API in your WAR only using jboss-deployment-structure.xml (without having to modify the Jboss standalone.xml):
exclude the module javaee.api completely
re-import the module javaee.api and exclude the JAX-RS classes
That's it!
Verified on Jboss EAP 6.2
jboss-deployment-structure.xml
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
<dependencies>
<!-- Exclude JAX-RS: 2. re-import the javaee.api and exclude the JAX-RS classes -->
<module name="javaee.api" >
<imports>
<exclude path="javax/ws/**" />
</imports>
</module>
</dependencies>
<exclusions>
<!-- Exclude JAX-RS: 1. exclude the javaee.api completely -->
<module name="javaee.api" />
</exclusions>
</deployment>
</jboss-deployment-structure>
This brings the HTTP 500 without any stacktrace/NoSuchMethodExceptions to the invoker and clean Jackson Exceptions in the Jboss log file:
Caused by: com.fasterxml.jackson.databind.JsonMappingException: Can not deserialize instance of byte out of VALUE_STRING token
Also see this for the way to the solution.
In case you still have troubles with the Jboss-supplied JAX-RS subsystem (e.g. when trying to generate CXF Swagger-API I got a
java.lang.LinkageError: ClassCastException: attempting to castjar:file:/c:/jboss//modules/system/layers/base/javax/ws/rs/api/main/jboss-jaxrs-api_1.1_spec-1.0.1.Final-redhat-2.jar!/javax/ws/rs/ext/RuntimeDelegate.class to vfs:/c:/jboss/bin/content/myapp.war/WEB-INF/lib/javax.ws.rs-api-2.0.1.jar/javax/ws/rs/ext/RuntimeDelegate.class), then you can also exclude the whole jaxrs-subsystem:
<?xml version="1.0" encoding="UTF-8"?>
<jboss-deployment-structure>
<deployment>
...
<exclude-subsystems>
<subsystem name="jaxrs" />
</exclude-subsystems>
</deployment>
</jboss-deployment-structure>

camel cxf glassfish BusException: No DestinationFactory was found for the namespace http://cxf.apache.org/transports/http

I have a camel route fronted with a CXF Web Service consumer (from). I'm deploying in Glassfish 4.0 and this works fine when using the servlet spec 2.4. I now need to enhance the route by adding some persistence along the way which is being done with JPA. Doing this requires an upgrade to servlet spec 2.5+ (I've gone to 3.0)
When the servlet spec is changed to 2.5+ the following error occurs on deployment: java.lang.IllegalStateException: The lifecycle method [finalizeConfig] must not throw a checked exception. Most solutions to this say to remove cxf-rt-transports-http-jetty-2.7.11.jar.
When the jetty jar is removed, the deployment error becomes: java.io.IOException: Could not find destination factory for transport http://schemas.xmlsoap.org/soap/http
Solutions to this, such as CXF BusException No DestinationFactory for namespace http://cxf.apache.org/transports/http OR org.apache.cxf.BusException: No DestinationFactory was found for the namespace http://schemas.xmlsoap.org/soap/http/ say to import the cxf-servlet.xml file which then requires the inclusion of the jar cxf-rt-transports-http-2.7.11.jar (I removed this when I removed the jetty jar). Including these files then gives the following deployment error: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus.
The solutions for this error all say to include the jar cxf-rt-transports-http-jetty-2.7.11.jar. This puts me back where I started having to remove it due to the servlet spec upgrade.
I've been able to create a small project to demonstrate this and have included the contents below. I've also tried deploying on Glassfish 4.1 and various combinations of different jar versions (CXF 3.0 excluding the 2.7 jars from camel etc) but I'm still unable to deploy the app in Glassfish.
I'm able to run this with the maven camel plugin 'mvm camel:run' (this requires de-scoping the cxf-rt-transports-http*.jar files from test. Of course this works because I'm outside the glassfish container.
Any help would be greatly appreciated.
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.example</groupId>
<artifactId>camel-cxf-gf</artifactId>
<packaging>war</packaging>
<version>0.1</version>
<name>Camel with CXF in GF</name>
<properties>
<camel-version>2.13.1</camel-version>
<cxf-version>2.7.11</cxf-version>
<buildNumber>0.1</buildNumber>
</properties>
<dependencies>
<dependency>
<groupId>org.springframework</groupId>
<artifactId>spring-web</artifactId>
<version>4.0.6.RELEASE</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-cxf</artifactId>
<version>${camel-version}</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- cxf using slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.5</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.5</version>
</dependency>
<!-- using Jetty with CXF -->
<!-- "The Google" says to exclude this when deploying to Glassfish (test scope only) -->
<!-- To run with mvn camel:run, comment out the test scope on BOTH cxf-rt dependencies -->
<!-- However, if present for GF deploy, you get the error: The lifecycle method [finalizeConfig] must not throw a checked exception -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
<!-- "The Google" says to exclude this (test scope only) -->
<!-- To run with mvn camel:run, comment out the test scope on BOTH cxf-rt dependencies -->
<!-- If present for GF deploy, you get the error: java.io.IOException: Cannot find any registered HttpDestinationFactory from the Bus -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http</artifactId>
<version>${cxf-version}</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>2.5.1</version>
<configuration>
<source>1.7</source>
<target>1.7</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-resources-plugin</artifactId>
<version>2.6</version>
<configuration>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<!-- allows the route to be executed via 'mvn camel:run', NOTE: must comment out the test scope on the cxf-rt-transports dependencies above.... -->
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>${camel-version}</version>
<configuration>
<fileApplicationContextUri>
classpath:META-INF/applicationContext.xml
</fileApplicationContextUri>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.3</version>
<configuration>
<webXml>web/WEB-INF/web.xml</webXml>
<failOnMissingWebXml>true</failOnMissingWebXml>
<archive>
<manifestEntries>
<Build-Version>${project.version}</Build-Version>
<Build-Revision>${buildNumber}</Build-Revision>
<Build-Date>${maven.build.timestamp}</Build-Date>
</manifestEntries>
</archive>
</configuration>
</plugin>
</plugins>
</build>
</project>
web.xml:
<web-app 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_3_0.xsd" version="3.0">
<display-name>Camel CXF, JMS Web Application</display-name>
<!-- location of spring xml files -->
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>classpath:META-INF/applicationContext.xml</param-value>
</context-param>
<!-- the listener that kick-starts Spring -->
<listener>
<listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
</listener>
</web-app>
The CXF Service:
package com.example;
import javax.jws.WebMethod;
import javax.jws.WebParam;
import javax.jws.WebResult;
import javax.jws.WebService;
#WebService(serviceName = "HelloMessage", targetNamespace = "http://example.com/")
public interface HelloMessageEndpoint {
#WebMethod(operationName = "sayHello")
#WebResult(name = "messageAnswer", targetNamespace = "http://example.com/", partName = "messageAnswer")
public String sayHello(#WebParam(name = "name") String name);
}
My applicationContext.xml which contains the Spring DSL camel route (under resources/META-INF):
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:cxf="http://camel.apache.org/schema/cxf"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd
">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<!-- This doesn't seem to make a difference -->
<!--<import resource="classpath:META-INF/cxf/cxf-extension-camel.xml"/>-->
<!-- When cxf-rt-transports-http is removed (test scope) cxf-servlet.xml is no longer available -->
<!--<import resource="classpath:META-INF/cxf/cxf-servlet.xml"/>-->
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<cxf:cxfEndpoint id="helloMessageEndpoint"
address="http://0.0.0.0:9000/HelloWS/"
serviceClass="com.example.HelloMessageEndpoint"
endpointName="HelloMessageEndpoint"
serviceName="HelloMessage"
loggingFeatureEnabled="false"/>
<camelContext id="messageContext" streamCache="true" xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="cxf:bean:helloMessageEndpoint"/>
<log loggingLevel="INFO" message="====> CXF Message Body: ${body}"/>
</route>
</camelContext>
</beans>
As you are using address="http://0.0.0.0:9000/HelloWS/", not the relative path, cxf-rt-transports-http-jetty-2.7.11.jar is need. If you want to use the servlet transport you need to deploy the CXFServlet in you web.xml first, and setup the address of to be relative path, then you should be able to access the CXF endpoint there.

Resources