Camel MalformedParameterizedTypeException

时间:2014-02-02 11:30:28

标签: java maven-3 apache-camel

我无法在不抛出异常MalformedParameterizedTypeException的情况下运行空的camel上下文。

这是我的app-context:

<?xml version="1.0" encoding="UTF-8"?>
<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"
xmlns:camel="http://camel.apache.org/schema/spring"
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"
default-init-method="init" default-lazy-init="false">

<!-- Camel Configuration -->
<camel:camelContext id="camel-1"
    xmlns="http://camel.apache.org/schema/spring">

</camel:camelContext>

</beans>

这是我的pom依赖项:

    <?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.mycomp.stuff</groupId>
<artifactId>aggregate-delivery</artifactId>
<packaging>jar</packaging>
<name>aggregate-delivery</name>
<version>0.0.0.0.01</version>

<properties>
    <camel.version>2.12.0</camel.version>
    <spring.version>2.5.6.SEC03</spring.version>
</properties>
<dependencies>
    <dependency>
        <groupId>org.springframework</groupId>
        <artifactId>spring</artifactId>
        <version>${spring.version}</version>
        <exclusions>
        <exclusion>
        <artifactId>commons-logging</artifactId>
        <groupId>commons-logging</groupId>
        </exclusion>
            <exclusion>
        <artifactId>commons-logging-api</artifactId>
        <groupId>commons-logging</groupId>
        </exclusion>
    </exclusions>
    </dependency>
    <!-- Camel -->
    <dependency>
    <groupId>org.apache.camel</groupId>
    <artifactId>camel-core</artifactId>
    <version>${camel.version}</version>
    </dependency>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-spring</artifactId>
            <version>${camel.version}</version>
        </dependency>
    </dependencies>

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

            <configuration>
                <applicationContextUri>META-INF/spring/application-context.xml</applicationContextUri>

            </configuration>
        </plugin>
        <plugin>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <configuration>
                <source>1.6</source>
                <target>1.6</target>
            </configuration>
        </plugin>
    </plugins>
    <pluginManagement>
        <plugins>
            <plugin>
                <artifactId>maven-eclipse-plugin</artifactId>
                <configuration>
                    <wtpversion>2.0</wtpversion>
                    <wtpapplicationxml>true</wtpapplicationxml>
                    <wtpmanifest>true</wtpmanifest>
                    <downloadSources>true</downloadSources>
                    <downloadJavadocs>true</downloadJavadocs>
                    <projectNameTemplate>[artifactId]-[version]</projectNameTemplate>
                    <manifest>${basedir}/src/main/resources/META-INF/MANIFEST.MF</manifest>
                </configuration>
            </plugin>

        </plugins>
    </pluginManagement>
    <finalName>aggregate-delivery</finalName>
</build>

我已经宣布了其他bean,但是我开始收到此错误,我将其删除以查看导致异常的原因。

由于我的骆驼语境中没有任何内容,因此问题不能解决,因为某种方式看起来像是一个骆驼配置问题。

我见过其他帖子说它是lib兼容性问题。我怎样才能弄清楚如何解决这个问题?

我已经将问题减少到带有pom的空骆驼语境。

克劳德你的pom会是什么样子?

欢迎提出所有建议。

谢谢,

安德鲁

1 个答案:

答案 0 :(得分:2)

调用mvn archetype:generate创建一个包含所有必需依赖项的Maven项目:

mvn archetype:generate \
    -DarchetypeGroupId=org.apache.camel.archetypes \
    -DarchetypeArtifactId=camel-archetype-spring  \
    -DarchetypeVersion=2.9.0  \
    -DgroupId=ch.test.camel \
    -DartifactId=cameltest77  \
    -Dversion=0.0.1

可以找到不同原型的列表here