2017-05-27 117 views
0

这是一个非常基本的Spring Camel应用程序。使用CXF:Server和Maven:骆驼插件。 我不能用骆驼启动骆驼上下文:以某种方式运行。骆驼不开始使用骆驼:运行maven插件

另外,不确定只是给cxf:服务器的端口就足够了。

<?xml version="1.0" encoding="UTF-8"?> 
<beans xmlns="http://www.springframework.org/schema/beans" 
    xmlns:cxf="http://camel.apache.org/schema/cxf" 
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd    http://camel.apache.org/schema/cxf http://camel.apache.org/schema/cxf/camel-cxf.xsd    http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd"> 
    <cxf:rsServer address=""/route" id="rsServer" serviceClass="org.naren.ResourceObject"/> 
    <bean class="org.naren.OrchestrationProcess" id="orchestrationProcess"/> 
    <bean class="org.naren.OrchestrationRoute" id="routeBuilder"/> 
    <camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> 
     <routeBuilder ref="routeBuilder"/> 
    </camelContext> 
</beans> 

POM:

<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> 
    <groupId>TEG.iCoE</groupId> 
    <artifactId>MSA</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>Orch</name> 
    <description>Orchestrator</description> 

    <properties> 
     <camel.version>2.14.1</camel.version> 
     <cxf.version>3.0.2</cxf.version> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.apache.camel</groupId> 
      <artifactId>camel-cxf</artifactId> 
      <version>${camel.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.cxf</groupId> 
      <artifactId>cxf-rt-transports-http-jetty</artifactId> 
      <version>${cxf.version}</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-api</artifactId> 
      <version>1.6.4</version> 
     </dependency> 
     <dependency> 
      <groupId>org.slf4j</groupId> 
      <artifactId>slf4j-log4j12</artifactId> 
      <version>1.6.4</version> 
     </dependency> 
    </dependencies> 

    <repositories> 
     <repository> 
      <id>fusesource.releases</id> 
      <name>FuseSource Release Repository</name> 
      <url>http://repository.jboss.org/nexus/content/repositories/fs-releases</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
     <repository> 
      <id>fusesource-ea.releases</id> 
      <name>FuseSource EA Release Repository</name> 
      <url>http://repository.jboss.org/nexus/content/repositories/ea</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </repository> 
    </repositories> 
    <pluginRepositories> 
     <pluginRepository> 
      <id>fusesource.releases</id> 
      <name>FuseSource Release Repository</name> 
      <url>http://repository.jboss.org/nexus/content/repositories/fs-releases</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </pluginRepository> 
     <pluginRepository> 
      <id>fusesource-ea.releases</id> 
      <name>FuseSource EA Release Repository</name> 
      <url>http://repository.jboss.org/nexus/content/repositories/ea</url> 
      <releases> 
       <enabled>true</enabled> 
      </releases> 
      <snapshots> 
       <enabled>false</enabled> 
      </snapshots> 
     </pluginRepository> 
    </pluginRepositories> 



    <build> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.3.2</version> 
       <configuration> 
        <source>1.7</source> 
        <target>1.7</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.camel</groupId> 
       <artifactId>camel-maven-plugin</artifactId> 
       <version>${camel.version}</version> 
       <configuration> 
        <applicationContextUri>src\main\resources\spring\*.xml</applicationContextUri> 
       </configuration> 

      </plugin> 
     </plugins> 

    </build> 

</project> 

骆驼:运行启动,但只打印3日志和CXF:服务器端口永远不会启动:

[INFO] --- camel-maven-plugin:2.14.1:run (default-cli) @ MSA --- 
[INFO] Using org.apache.camel.spring.Main to initiate a CamelContext 
[INFO] Starting Camel ... 
org.apache.camel.spring.Main.main() INFO [org.apache.camel.main.MainSupport] - Apache Camel 2.14.1 starting 
org.apache.camel.spring.Main.main() INFO [org.springframework.context.support.ClassPathXmlApplicationContext] - Refreshing org[email protected]833bfc: startup date [Sat May 27 13:43:20 IST 2017]; root of context hierarchy 
org.apache.camel.spring.Main.main() INFO [org.springframework.beans.factory.support.DefaultListableBeanFactory] - Pre-instantiating singletons in org.s[email protected]e83d14: defining beans []; root of factory hierarchy 
+0

也许你还没有配置正确的日志记录,比如在log4j.properties文件 –

回答

1

请检查您的Spring配置文件位于“ src \ main \ resources \ META-INF \ spring“文件夹,然后从camel-maven-plugin中删除”configuration“标签,如下所示:

 <plugin> 
      <groupId>org.apache.camel</groupId> 
      <artifactId>camel-maven-plugin</artifactId> 
      <version>${camel.version}</version> 
     </plugin> 

注重在你的地址属性“CXF:rsServer”有语法错误,必须如下更正为:

address=""/route" ===> address="/route"