我收到错误 运行main时发生错误:org.apache.camel.test.blueprint.Main当我运行blueprint.xml 时 我的blueprint.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"
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">
<camelContext xmlns="http://camel.apache.org/schema/spring">
<route>
<from uri="file:input?delete=true"/>
<to uri="file:output"/>
</route>
</camelContext>
</beans>
我的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.ericsson</groupId>
<artifactId>mm-demo</artifactId>
<packaging>bundle</packaging>
<version>1.0.0-SNAPSHOT</version>
<name>Camel Blueprint Route</name>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<fabric8.profile>file-collection</fabric8.profile>
<fabric8.parentProfiles>feature-camel</fabric8.parentProfiles>
<fabric8.features>camel</fabric8.features>
</properties>
<repositories>
<repository>
<id>release.fusesource.org</id>
<name>FuseSource Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
<repository>
<id>ea.fusesource.org</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>release.fusesource.org</id>
<name>FuseSource Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/repositories/releases</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
<pluginRepository>
<id>ea.fusesource.org</id>
<name>FuseSource Community Early Access Release Repository</name>
<url>http://repo.fusesource.com/nexus/content/groups/ea</url>
<snapshots>
<enabled>false</enabled>
</snapshots>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>
</pluginRepositories>
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.15.1.redhat-620133</version>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-blueprint</artifactId>
<version>2.15.1.redhat-620133</version>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.10</version>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.10</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17</version>
</dependency>
<!-- Testing & Camel Plugin -->
</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.8</source>
<target>1.8</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>
<!-- to generate the MANIFEST-FILE of the bundle -->
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>2.3.7</version>
<extensions>true</extensions>
<executions>
<execution>
<id>bundle-manifest</id>
<phase>process-classes</phase>
<goals>
<goal>manifest</goal>
</goals>
</execution>
</executions>
<configuration>
<instructions>
<Bundle-SymbolicName>file-collection</Bundle-SymbolicName>
<Private-Package>com.ericsson.file.collection.*</Private-Package>
<Import-Package>*</Import-Package>
</instructions>
</configuration>
</plugin>
<!-- to run the example using mvn camel:run -->
<plugin>
<groupId>org.apache.camel</groupId>
<artifactId>camel-maven-plugin</artifactId>
<version>2.15.1.redhat-620133</version>
<configuration>
<useBlueprint>true</useBlueprint>
</configuration>
</plugin>
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>1.2.0.redhat-133</version>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<!--This plugin's configuration is used to store Eclipse m2e settings
only. It has no influence on the Maven build itself. -->
<plugin>
<groupId>org.eclipse.m2e</groupId>
<artifactId>lifecycle-mapping</artifactId>
<version>1.0.0</version>
<configuration>
<lifecycleMappingMetadata>
<pluginExecutions>
<pluginExecution>
<pluginExecutionFilter>
<groupId>org.apache.felix</groupId>
<artifactId>
maven-bundle-plugin
</artifactId>
<versionRange>
[2.3.7,)
</versionRange>
<goals>
<goal>manifest</goal>
</goals>
</pluginExecutionFilter>
<action>
<ignore></ignore>
</action>
</pluginExecution>
</pluginExecutions>
</lifecycleMappingMetadata>
</configuration>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>
我收到这样的错误:
[INFO] Scanning for projects...
[INFO]
[INFO] ------------------------------------------------------------------------
[INFO] Building Camel Blueprint Route 1.0.0-SNAPSHOT
[INFO] ------------------------------------------------------------------------
[INFO]
[INFO] >>> camel-maven-plugin:2.15.1.redhat-620133:run (default-cli) > test-compile @ mm-demo >>>
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ mm-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:compile (default-compile) @ mm-demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-bundle-plugin:2.3.7:manifest (bundle-manifest) @ mm-demo ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ mm-demo ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 0 resource
[INFO]
[INFO] --- maven-compiler-plugin:2.5.1:testCompile (default-testCompile) @ mm-demo ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] <<< camel-maven-plugin:2.15.1.redhat-620133:run (default-cli) < test-compile @ mm-demo <<<
[INFO]
[INFO] --- camel-maven-plugin:2.15.1.redhat-620133:run (default-cli) @ mm-demo ---
[INFO] Using org.apache.camel.test.blueprint.Main to initiate a CamelContext
[INFO] Starting Camel ...
[mel.test.blueprint.Main.main()] MainSupport INFO Apache Camel 2.15.1.redhat-620133 starting
[mel.test.blueprint.Main.main()] Activator INFO Camel activator starting
[mel.test.blueprint.Main.main()] Activator INFO Camel activator started
[mel.test.blueprint.Main.main()] BlueprintExtender INFO No quiesce support is available, so blueprint components will not participate in quiesce operations
[ Blueprint Extender: 1] BlueprintContainerImpl INFO Bundle file-collection is waiting for namespace handlers [http://www.springframework.org/schema/beans, http://camel.apache.org/schema/spring]
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN Test bundle headers: Bundle-ManifestVersion=2, Bundle-Name=System Bundle, Bundle-SymbolicName=de.kalpatec.pojosr.framework, Bundle-Vendor=kalpatec, Bundle-Version=0.2.1
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.TypeConverterLoader], bundle: org.apache.camel.camel-spring [8], symbolicName: org.apache.camel.camel-spring
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.ComponentResolver], bundle: org.apache.camel.camel-spring [8], symbolicName: org.apache.camel.camel-spring
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.packageadmin.PackageAdmin], bundle: de.kalpatec.pojosr.framework [0], symbolicName: de.kalpatec.pojosr.framework
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.blueprint.container.BlueprintContainer], bundle: org.apache.camel.camel-blueprint [6], symbolicName: org.apache.camel.camel-blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.TypeConverterLoader], bundle: org.apache.camel.camel-core [3], symbolicName: org.apache.camel.camel-core
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.TypeConverterLoader], bundle: de.kalpatec.pojosr.framework [0], symbolicName: de.kalpatec.pojosr.framework
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.cm.ConfigurationListener, org.apache.felix.fileinstall.ArtifactListener, org.apache.felix.fileinstall.ArtifactInstaller], bundle: org.apache.felix.fileinstall [30], symbolicName: org.apache.felix.fileinstall
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.LanguageResolver], bundle: org.apache.camel.camel-spring [8], symbolicName: org.apache.camel.camel-spring
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.cm.ManagedServiceFactory], bundle: org.apache.felix.fileinstall [30], symbolicName: org.apache.felix.fileinstall
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.DataFormatResolver], bundle: org.apache.camel.camel-core [3], symbolicName: org.apache.camel.camel-core
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.ComponentResolver], bundle: org.apache.camel.camel-core [3], symbolicName: org.apache.camel.camel-core
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.url.URLStreamHandlerService], bundle: org.apache.felix.fileinstall [30], symbolicName: org.apache.felix.fileinstall
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.proxy.ProxyManager], bundle: org.apache.aries.proxy.impl [20], symbolicName: org.apache.aries.proxy.impl
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.blueprint.container.BlueprintContainer], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.framework.hooks.bundle.EventHook], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.startlevel.StartLevel], bundle: de.kalpatec.pojosr.framework [0], symbolicName: de.kalpatec.pojosr.framework
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.camel.spi.LanguageResolver], bundle: org.apache.camel.camel-core [3], symbolicName: org.apache.camel.camel-core
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.osgi.service.cm.ConfigurationAdmin], bundle: org.apache.felix.configadmin [29], symbolicName: org.apache.felix.configadmin
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.felix.cm.PersistenceManager], bundle: org.apache.felix.configadmin [29], symbolicName: org.apache.felix.configadmin
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.services.ParserService], bundle: org.apache.aries.blueprint [18], symbolicName: org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] CamelBlueprintHelper WARN ServiceReference: [org.apache.aries.blueprint.NamespaceHandler], bundle: org.apache.camel.camel-blueprint [6], symbolicName: org.apache.camel.camel-blueprint
[mel.test.blueprint.Main.main()] BlueprintExtender INFO Destroying BlueprintContainer for bundle file-collection
[mel.test.blueprint.Main.main()] BlueprintExtender INFO Destroying BlueprintContainer for bundle org.apache.aries.blueprint
[mel.test.blueprint.Main.main()] BlueprintExtender INFO Destroying BlueprintContainer for bundle org.apache.camel.camel-blueprint
[mel.test.blueprint.Main.main()] Activator INFO Camel activator stopping
[mel.test.blueprint.Main.main()] Activator INFO Camel activator stopped
[mel.test.blueprint.Main.main()] CamelBlueprintHelper INFO Deleting work directory target/bundles/1446540879356
[ERROR] *************************************
[ERROR] Error occurred while running main from: org.apache.camel.test.blueprint.Main
[ERROR]
java.lang.reflect.InvocationTargetException
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
at java.lang.reflect.Method.invoke(Method.java:497)
at org.apache.camel.maven.RunMojo$1.run(RunMojo.java:488)
at java.lang.Thread.run(Thread.java:745)
Caused by: java.lang.RuntimeException: Gave up waiting for service (objectClass=org.apache.camel.CamelContext)
at org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:240)
at org.apache.camel.test.blueprint.CamelBlueprintHelper.getOsgiService(CamelBlueprintHelper.java:202)
at org.apache.camel.test.blueprint.Main.doStart(Main.java:104)
at org.apache.camel.support.ServiceSupport.start(ServiceSupport.java:61)
at org.apache.camel.main.MainSupport.run(MainSupport.java:150)
at org.apache.camel.main.MainSupport.run(MainSupport.java:354)
at org.apache.camel.test.blueprint.Main.main(Main.java:81)
... 6 more
[ERROR] *************************************
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 40.261 s
[INFO] Finished at: 2015-11-03T14:25:10+05:30
[INFO] Final Memory: 19M/260M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.apache.camel:camel-maven-plugin:2.15.1.redhat-620133:run (default-cli) on project mm-demo: null: MojoExecutionException: InvocationTargetException: Gave up waiting for service (objectClass=org.apache.camel.CamelContext) -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[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/MojoExecutionException
答案 0 :(得分:0)
在pom.xml中添加以下插件存储库:
<pluginRepository>
<id>redhat</id>
<url>https://maven.repository.redhat.com/ga/</url>
<releases>
<enabled>true</enabled>
</releases>
</pluginRepository>