Hi Team,
I have a simple Camel CXF example running, which is based from the Camel In
Action examples provided.
I am able to build and run successfully. But here is the problem I am
coming across.
I am building the war and then deploying in the JBoss AS which is running
at localhost:8080. But meanwhile even Jetty server is strating up and
creating the Bind problems and causing :
HTTP ERROR: 404
Problem accessing /camel-cxf/index.jsp. Reason:
NOT_FOUND
Powered by Jetty://
Now except for my wsdl, nothing comes up.
For example:
I get the following one fine.
http://localhost:8080/camel-cxf/web-services/order?wsdl
But when I try to access all the reaming pages like;
http://localhost:8080/camel-cxf/index.jsp
http://localhost:8080/
I get the following error.
HTTP ERROR:
Problem accessing /camel-cxf/index.jsp. Reason:
NOT_FOUND
Powered by Jetty://
My question:
How do I avoid Jetty to start the server along with the webservice, when my
Jboss is already running?
Here is my
1) META-INF/spring/camel-cfg.xml:
<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-2.5.xsd
http://camel.apache.org/schema/cxf
http://camel.apache.org/schema/cxf/camel-cxf.xsd">
<import resource="classpath:META-INF/cxf/cxf.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-soap.xml"/>
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>
<cxf:cxfEndpoint id="orderEndpoint"
address="http://localhost:8080/camel-cxf/web-services/order"
serviceClass="camelinaction.order.OrderEndpoint"/>
</beans>
2) META-INF/spring/camel-route.xml:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:camel="http://camel.apache.org/schema/spring"
xsi:schemaLocation="
http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans-2.5.xsd
http://camel.apache.org/schema/spring
http://camel.apache.org/schema/spring/camel-spring.xsd">
<import resource="classpath:META-INF/spring/camel-cxf.xml" />
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<!-- route starts from the cxf webservice, see camel-cxf.xml for
details -->
<from uri="cxf:bean:orderEndpoint" />
<to uri="seda:incomingOrders" />
<!-- and then create the OK reply for the webservice which is still
waiting for a reply -->
<transform>
<constant>OK. Successful!</constant>
</transform>
</route>
<!-- test route -->
<route>
<from uri="seda:incomingOrders" />
<to uri="mock:end"/>
</route>
</camelContext>
</beans>
3) WEB_INF/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_2_5.xsd" id="WebApp_ID"
version="2.5">
<description>
Apache Camel Web Console
</description>
<display-name>Camel Console</display-name>
<context-param>
<param-name>contextConfigLocation</param-name>
<param-value>
classpath:META-INF/spring/camel-route.xml
</param-value>
</context-param>
<servlet>
<servlet-name>Context servlet</servlet-name>
<servlet-class>org.springframework.web.context.ContextLoaderServlet</servlet-class>
<load-on-startup>2</load-on-startup>
</servlet>
<servlet>
<servlet-name>CamelServlet</servlet-name>
<servlet-class>
org.apache.camel.component.servlet.CamelHttpTransportServlet
</servlet-class>
<init-param>
<param-name>matchOnUriPrefix</param-name>
<param-value>true</param-value>
</init-param>
<load-on-startup>4</load-on-startup>
</servlet>
<servlet-mapping>
<servlet-name>CamelServlet</servlet-name>
<url-pattern>/web-services/*</url-pattern>
</servlet-mapping>
</web-app>
4) POM file:
<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>camel-proj</groupId>
<artifactId>camel-cxf</artifactId>
<version>0.0.1-SNAPSHOT</version>
<packaging>war</packaging>
<name>Simple CXF project using spring configuration</name>
<properties>
<camel-version>2.2.0</camel-version>
<cxf-version>2.2.7</cxf-version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
</properties>
<dependencies>
<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.16</version>
</dependency>
<!-- cxf using slf4j -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.5.8</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.5.8</version>
</dependency>
<!-- using Jetty with CXF -->
<dependency>
<groupId>org.apache.cxf</groupId>
<artifactId>cxf-rt-transports-http-jetty</artifactId>
<version>2.2.8</version>
</dependency><!--
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<version>${camel-version}</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.8.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-servlet</artifactId>
<version>2.1.0</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>javax.xml</groupId>
<artifactId>jaxp-api</artifactId>
<version>1.4.2</version>
<type>jar</type>
<scope>compile</scope>
</dependency>
</dependencies>
<build>
<finalName>camel-cxf</finalName>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>1.5</source>
<target>1.5</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-eclipse-plugin</artifactId>
<configuration>
<projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
<wtpmanifest>true</wtpmanifest>
<wtpapplicationxml>true</wtpapplicationxml>
<wtpversion>2.0</wtpversion>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
5) OrderEndpoint.java
package camelinaction.order;
import javax.jws.WebService;
@WebService
public interface OrderEndpoint {
public String order(String partName, int amount, String customerName);
}
I would really appreciate some direction, even though it may be simple
answer.
I was thinking the import statement is causing the jetty to run, when when I
take it off, I am getting errors.
<import resource="classpath:META-INF/cxf/cxf-extension-http-jetty.xml"/>
--
View this message in context:
http://camel.465427.n5.nabble.com/Camel-Cxf-example-Jetty-Server-starting-while-JBoss-already-Running-tp2843017p2843017.html
Sent from the Camel - Users mailing list archive at Nabble.com.