2014-04-18 28 views
0

我正在使用下面定義的camel環境將消息從activemq路由到ibmmq,我使用jms服務將消息從一個隊列發送到另一...我正在嘗試將Apache Camel與IBM MQ連接,但是我收到了一個Maven插件錯誤

<bean class="org.springframework.beans.factory.config.MethodInvokingFactoryBean" 
    p:staticMethod="com.ibm.mq.MQEnvironment.addConnectionPoolToken"/> 

<camel:camelContext id="camel" xmlns="http://camel.apache.org/schema/spring"> 
    <camel:route> 
     <camel:from uri="activemq:queue:TestAMQ1"/> 
     <camel:to uri="websphere-mq:TestWMQ"/> 
    </camel:route> 
</camel:camelContext> 

<bean id="wasmq" class="org.apache.camel.component.jms.JmsComponent"> 
    <property name="connectionFactory"> 
     <bean class="com.ibm.mq.jms.MQQueueConnectionFactory"> 
      <property name="transportType"> 
       <util:constant static-field="com.ibm.mq.jms.JMSC.MQJMS_TP_CLIENT_MQ_TCPIP" /> 
      </property> 
      <property name="hostName" value="10.0.0.1" /> 
      <property name="port" value="1414" /> 
      <property name="queueManager" value="Sample_QM" /> 
      <property name="channel" value="SYSTEM.DEF.SVRCONN" /> 
      <property name="useConnectionPooling" value="true" /> 
     </bean> 
    </property> 
</bean> 

pom.xml包含以下IBM依賴條件...

<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>com.java.amq</groupId> 
    <artifactId>mq</artifactId> 
    <version>0.0.1-SNAPSHOT</version> 
    <name>javamq</name> 
    <description>amq</description> 

    <properties> 
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> 
    </properties> 

    <dependencies> 
     <dependency> 
      <groupId>org.glassfish.main.javaee-api</groupId> 
      <artifactId>javax.jms</artifactId> 
      <version>3.1.2.2</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.camel</groupId> 
      <artifactId>camel-spring</artifactId> 
      <version>2.13.0</version> 
     </dependency> 
     <dependency> 
      <groupId>com.ibm.mq</groupId> 
      <artifactId>com.ibm.mq</artifactId> 
      <version>7.0.1.3</version> 
     </dependency>  
     <dependency> 
      <groupId>com.ibm.mq</groupId> 
      <artifactId>com.ibm.mqjms</artifactId> 
      <version>7.0.1.3</version> 
     </dependency> 
     <dependency> 
      <groupId>com.ibm.dhbcore</groupId> 
      <artifactId>com.ibm.dhbcore</artifactId> 
      <version>DH610-GOLD</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.camel</groupId> 
      <artifactId>camel-jms</artifactId> 
      <version>2.5.0</version> 
     </dependency> 
     <dependency> 
      <groupId>org.apache.camel</groupId> 
      <artifactId>camel-maven-plugin</artifactId> 
      <version>2.13.0</version> 
     </dependency>   
    </dependencies> 

    <build> 
     <defaultGoal>install</defaultGoal> 
     <plugins> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-compiler-plugin</artifactId> 
       <version>2.5.1</version> 
       <configuration> 
        <source>1.6</source> 
        <target>1.6</target> 
       </configuration> 
      </plugin> 
      <plugin> 
       <groupId>org.apache.maven.plugins</groupId> 
       <artifactId>maven-resources-plugin</artifactId> 
       <version>2.4.3</version> 
       <configuration> 
        <encoding>UTF-8</encoding> 
       </configuration> 
      </plugin> 
     </plugins> 
    </build> 
</project> 

我這是在運行駱駝背景下所面臨的錯誤....

[ERROR] COMPILATION ERROR : 
[INFO] ------------------------------------------------------------- 
[INFO] 1 error 
[INFO] ------------------------------------------------------------- 
[INFO] ------------------------------------------------------------------------ 
[INFO] BUILD FAILURE 
[INFO] ------------------------------------------------------------------------ 
[INFO] Total time: 12.045s 
[INFO] Finished at: Fri Apr 18 11:32:52 IST 2014 
[INFO] Final Memory: 16M/40M 
[INFO] ------------------------------------------------------------------------ 
[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:2.5.1:compile (default-compile) on project mq: Compilation failure 

請在解決此問題的幫助....在此先感謝....

錯誤,當我用MVN駱駝跑我得到:運行-e switch.I我得到的下面的列表錯誤...

[ERROR] No plugin found for prefix 'mvn' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\rahul\.m2\repository), release.fusesource.org (http://repo.fusesource.com/nexus/content/repositories/releases), snapshot.fusesource.org (http://repo.fusesource.com/nexus/content/repositories/snapshots), central (http://repo.maven.apache.org/maven2)] -> [Help 1] 
org.apache.maven.plugin.prefix.NoPluginFoundForPrefixException: No plugin found for prefix 'mvn' in the current project and in the plugin groups [org.apache.maven.plugins, org.codehaus.mojo] available from the repositories [local (C:\Users\rahul\.m2\repository), release.fusesource.org (http://repo.fusesource.com/nexus/content/repositories/releases), snapshot.fusesource.org (http://repo.fusesource.com/nexus/content/repositories/snapshots), central (http://repo.maven.apache.org/maven2)] 
    at org.apache.maven.plugin.prefix.internal.DefaultPluginPrefixResolver.resolve(DefaultPluginPrefixResolver.java:94) 
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.findPluginForPrefix(MojoDescriptorCreator.java:262) 
    at org.apache.maven.lifecycle.internal.MojoDescriptorCreator.getMojoDescriptor(MojoDescriptorCreator.java:222) 
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:106) 
    at org.apache.maven.lifecycle.internal.DefaultLifecycleTaskSegmentCalculator.calculateTaskSegments(DefaultLifecycleTaskSegmentCalculator.java:86) 
    at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:98) 
    at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:320) 
    at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:156) 
    at org.apache.maven.cli.MavenCli.execute(MavenCli.java:537) 
    at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:196) 
    at org.apache.maven.cli.MavenCli.main(MavenCli.java:141) 
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) 
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) 
    at java.lang.reflect.Method.invoke(Unknown Source) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:290) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:230) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:409) 
    at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:352) 
[ERROR] 
[ERROR] Re-run Maven using the -X switch to enable full debug logging. 
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles: 
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/NoPluginFoundForPrefixException 

回答

0

這是一個編譯失敗,你的代碼沒有編譯。 您是否擁有所有必需的依賴關係,您沒有在列表中提到駱駝核心依賴項。

嘗試使用-e選項運行您的maven版本,它可能會提供更有幫助的錯誤消息。

+0

感謝matthew的回覆...我有所有需要的依賴關係...我清除錯誤現在我得到另一個錯誤... – Rahul

+0

[錯誤]未能執行目標org.apache.camel:camel-maven-plugin :2.13.0:run(default-cli)on project mq:null:MojoExecutionException:org/springframework/core/env/EnvironmentCapable:org.springframework.core.env.EnvironmentCapable - > [Help 1] [ERROR] [錯誤]要查看錯誤的完整堆棧跟蹤,請使用-e開關重新運行Maven。 [錯誤]使用-X開關重新運行Maven以啓用完整的調試日誌記錄。 [錯誤] [錯誤]有關錯誤和Possiblel解決方案的詳細信息,請閱讀以下文章: – Rahul

+0

請幫助我解決此問題...謝謝... – Rahul

0

您應該確保對所有Camel依賴項使用相同版本的Camel。您使用了駱駝2.13.0和2.5.0的混合。例如,更改此

<dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-jms</artifactId> 
     <version>2.5.0</version> 
    </dependency> 

<dependency> 
     <groupId>org.apache.camel</groupId> 
     <artifactId>camel-jms</artifactId> 
     <version>2.13.0</version> 
    </dependency> 

您也可以刪除的GlassFish JMS罐子作爲其並不需要(如駱駝的JMS有API包括作爲傳遞依賴)

<dependency> 
     <groupId>org.glassfish.main.javaee-api</groupId> 
     <artifactId>javax.jms</artifactId> 
     <version>3.1.2.2</version> 
    </dependency> 
0

正如我試過的那樣,IBM MQ不允許下載它的依賴關係。以下依賴關係將不起作用:

<dependency> 
     <groupId>com.ibm.mq</groupId> 
     <artifactId>com.ibm.mq</artifactId> 
     <version>7.0.1.3</version> 
    </dependency>  
    <dependency> 
     <groupId>com.ibm.mq</groupId> 
     <artifactId>com.ibm.mqjms</artifactId> 
     <version>7.0.1.3</version> 
    </dependency> 
    <dependency> 
     <groupId>com.ibm.dhbcore</groupId> 
     <artifactId>com.ibm.dhbcore</artifactId> 
     <version>DH610-GOLD</version> 
    </dependency> 

對於那些需要創建本地存儲庫的人員。您將從IBM MQ安裝文件夾{C:\Program Files (x86)\IBM\WebSphere MQ\java\lib}獲取所有這些jar。製作一個自定義本地存儲庫並在其中添加罐子。或者把這些罐子放在圖書館裏。

希望這會起作用。 :)它爲我工作。

相關問題