我无法在Red Hat Fuse 7.2(或7.3)上使用简单的Daffodil方法进行演示
对我的“ DfdlProcessor.java”处理方法的骆驼DSL路由调用如下所示...
from ("wmq:queue:DEV.QUEUE.1")
.process(dfdlProcessor) <<== failure occurs on this call.
.log("received message: \"${body}\"");
...导致此异常消息...
java.lang.ClassNotFoundException: org.apache.daffodil.util.LogWriter not found by org.apache.daffodil.daffodil-io
我简单的dfdlProcessor的“ process()”方法看起来像...
public void process(org.apache.camel.Exchange exchange) throws IOException, Exception {
Message inMessage = exchange.getIn();
System.out.println("**** see if can compile DFDL schema");
Compiler dfdlCompiler = Daffodil.compiler(); <<== failure occurs here.
System.out.println("**** done.");
}
(注意:下面进一步显示了Red Hat Fuse 7.2控制台输出的更多内容,即stacktrace)
我的经验是,Red Hat Fuse在组件/版本方面非常脆弱,尽管我花了很多时间/精力,但不幸的是,我在解决此问题方面没有成功。 < / p>
关于我为什么得到...的任何提示
"java.lang.NoClassDefFoundError: org/apache/daffodil/util/LogWriter"
...异常将不胜感激...-头疼,好像我在pom.xml中提供了正确的依赖关系,并将同一jar放在“ deploy”文件夹中
(此外,请注意,当处理器调用-“。process(dfdlProcessor)”被注释掉(禁用)时,该路由会正常工作。)
红色帽子保险丝7.2
java 8
apache水仙花2.3.0
如有需要,提供以下额外信息
src / main / java / aaa / bbb / ccc / camel / CamelRoute.java
package aaa.bbb.ccc.camel;
import org.apache.camel.CamelContext;
import org.apache.camel.builder.RouteBuilder;
public class CamelRoute extends RouteBuilder {
@Override
public void configure() throws Exception {
CamelContext context = this.getContext();
org.apache.camel.Processor dfdlProcessor = new DfdlProcessor();
from ("wmq:queue:DEV.QUEUE.1")
.process(dfdlProcessor)
.log("received message: \"${body}\"");
}
}
src / main / java / aaa / bbb / ccc / camel / DfdlProcessor.java
package aaa.bbb.ccc.camel;
import org.apache.camel.Message;
import java.io.File;
import java.io.IOException;
import java.net.URL;
import org.apache.daffodil.japi.Daffodil;
public class DfdlProcessor implements org.apache.camel.Processor {
public DfdlProcessor() {
}
@Override
public void process(org.apache.camel.Exchange exchange) throws IOException, Exception {
Message inMessage = exchange.getIn();
System.out.println("**** inMessage.toString()=" + inMessage.toString());
System.out.println("**** see if can compile DFDL schema");
try {
org.apache.daffodil.japi.Compiler dfdlCompiler = Daffodil.compiler();
} catch (Exception e) {
System.err.println("**** Exception thrown by dfdlCompiler.");
}
System.out.println("**** done.");
}
private File getFileFromResources(String fileName) {
ClassLoader classLoader = this.getClass().getClassLoader();
URL resource = classLoader.getResource(fileName);
if (resource == null) {
throw new IllegalArgumentException("file not found!!!");
} else {
return new File(resource.getFile());
}
}
}
src / main / resources / OSGI-INF / blueprint.xml
<?xml version="1.0" encoding="UTF-8"?>
<blueprint xmlns="http://www.osgi.org/xmlns/blueprint/v1.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://www.osgi.org/xmlns/blueprint/v1.0.0
https://www.osgi.org/xmlns/blueprint/v1.0.0/blueprint.xsd
http://camel.apache.org/schema/blueprint
http://camel.apache.org/schema/blueprint/camel-blueprint.xsd">
<bean class="aaa.bbb.ccc.camel.CamelRoute" id="myRouteBuilder"/>
<camelContext id="camelBPContext" xmlns="http://camel.apache.org/schema/blueprint">
<packageScan>
<package>aaa.bbb.ccc.camel</package>
</packageScan>
</camelContext>
<bean class="com.ibm.mq.jms.MQConnectionFactory" id="wmqcf">
<property name="hostName" value="localhost"/>
<property name="port" value="1414"/>
<property name="queueManager" value="QM1"/>
<property name="channel" value="DEV.ADMIN.SVRCONN"/>
<property name="transportType" value="1"/>
</bean>
<bean
class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter" id="wmqcfw">
<property name="targetConnectionFactory" ref="wmqcf"/>
<property name="username" value="admin"/>
<property name="password" value="passw0rd"/>
</bean>
<bean class="org.apache.camel.component.jms.JmsConfiguration" id="wmqcfg">
<property name="connectionFactory" ref="wmqcfw"/>
<property name="concurrentConsumers" value="10"/>
</bean>
<bean class="org.apache.camel.component.jms.JmsComponent" id="wmq">
<property name="configuration" ref="wmqcfg"/>
</bean>
</blueprint>
*** src / main / java / META-INF / beans.xml
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns="http://xmlns.jcp.org/xml/ns/javaee"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee
http://xmlns.jcp.org/xml/ns/javaee/beans_1_1.xsd"
bean-discovery-mode="all">
</beans>
pom.xml
<?xml version="1.0" encoding="UTF-8"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>aaa.bbb.ccc.camel</groupId>
<artifactId>camelfuseDSL_DFDL_short</artifactId>
<version>1.0</version>
<packaging>bundle</packaging>
<name>camelfuseDSL_DFDL_short</name>
<description>camelfuseDSL_DFDL_short</description>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url>
<distribution>repo</distribution>
</license>
</licenses>
<properties>
<version.maven-bundle-plugin>3.2.0</version.maven-bundle-plugin>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<skipTests>true</skipTests>
<timestamp>v${maven.build.timestamp}</timestamp>
<maven.build.timestamp.format>yyyyMMdd.HHmmss</maven.build.timestamp.format>
</properties>
<dependencies>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-log4j12</artifactId>
<version>1.7.22.redhat-2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-api</artifactId>
<version>1.7.22.redhat-2</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
<version>2.21.0</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>com.ibm.mq</groupId>
<artifactId>allclient</artifactId>
<version>9.1.0.0</version>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>1.2.17.redhat-3</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>javax</groupId>
<artifactId>javaee-api</artifactId>
<version>7.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-jms</artifactId>
<version>2.21.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>jaxen</groupId>
<artifactId>jaxen</artifactId>
<version>1.2.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.daffodil</groupId>
<artifactId>daffodil-japi_2.12</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.daffodil</groupId>
<artifactId>daffodil-io_2.12</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.daffodil</groupId>
<artifactId>daffodil-lib_2.12</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.daffodil</groupId>
<artifactId>daffodil-runtime1_2.12</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.daffodil</groupId>
<artifactId>daffodil-core_2.12</artifactId>
<version>2.3.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-collections4</artifactId>
<version>4.0</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.jdom</groupId>
<artifactId>jdom2</artifactId>
<version>2.0.6</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<defaultGoal>install</defaultGoal>
<plugins>
<plugin>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.felix</groupId>
<artifactId>maven-bundle-plugin</artifactId>
<version>${version.maven-bundle-plugin}</version>
<extensions>true</extensions>
<configuration>
<instructions>
<Bundle-SymbolicName>${project.groupId}.${project.artifactId}</Bundle-SymbolicName>
<Export-Package>aaa.bbb.ccc*</Export-Package>
<Import-Package>
com.ibm.mq.jms,
org.apache.camel.builder;version="[2.21,3)",
org.apache.camel.component.jms;version="[2.21,3)",
org.apache.camel.model;version="[2.21,3)",
org.apache.camel;version="[2.21,3)",
org.apache.daffodil.japi*,
org.osgi.service.blueprint;version="[1.0.0,2.0.0)",
org.springframework.jms.connection,
*
</Import-Package>
<Bundle-Version>${project.version}-${timestamp}</Bundle-Version>
<Require-Capability>
osgi.extender; filter:="(osgi.extender=pax.cdi)",
org.ops4j.pax.cdi.extension; filter:="(extension=camel-cdi-extension)"
</Require-Capability>
</instructions>
</configuration>
</plugin>
</plugins>
</build>
</project>
[FUSE_HOME] /部署
驱动器C中的卷是Windows 卷序列号是CC31-A444
C:\ rhf_runtime \ fuse-karaf-7.2.0.fuse-720035-redhat-00001 \ deploy的目录
06/05/2019 06:19 PM <DIR> .
06/05/2019 06:19 PM <DIR> ..
05/03/2019 12:56 PM 792,825 bcpkix-jdk15on.jar
05/03/2019 12:56 PM 4,092,400 bcprov-jdk15on.jar
06/05/2019 06:18 PM 21,733 camelfuseDSL_DFDL_short-1.0.jar
05/03/2019 12:56 PM 8,277,877 com.ibm.mq.allclient.jar
05/03/2019 12:56 PM 43,703 com.ibm.mq.traceControl.jar
05/06/2019 01:32 PM 610,259 commons-collections4-4.0.jar
05/03/2019 12:56 PM 22,769 fscontext.jar
05/03/2019 12:56 PM 58,349 jms.jar
02/14/2019 12:17 PM 2,019,728 org.apache.daffodil.daffodil-core-2.3.0.jar
02/14/2019 12:17 PM 365,020 org.apache.daffodil.daffodil-io-2.3.0.jar
02/14/2019 12:17 PM 68,116 org.apache.daffodil.daffodil-japi-2.3.0.jar
02/14/2019 12:17 PM 1,805,190 org.apache.daffodil.daffodil-lib-2.3.0.jar
02/14/2019 12:17 PM 3,163,852 org.apache.daffodil.daffodil-runtime1-2.3.0.jar
05/03/2019 12:56 PM 77,116 providerutil.jar
14 File(s) 21,418,937 bytes
2 Dir(s) 546,361,458,688 bytes free
捆绑开始
karaf@root()> bundle:list
START LEVEL 100 , List Threshold: 50
ID | State | Lvl | Version | Name
----+-----------+-----+---------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
28 | Active | 80 | 7.2.0.fuse-720035-redhat-00001 | Red Hat Fuse :: Fuse Modules :: Transaction
-
-
-
530 | Active | 90 | 2.0 | JMS API
533 | Active | 90 | 4.0.0 | Apache Commons Collections
536 | Active | 90 | 0.0.0 | providerutil.jar
537 | Active | 90 | 0.0.0 | com.ibm.mq.traceControl.jar
539 | Active | 90 | 0.0.0 | fscontext.jar
541 | Active | 90 | 1.59 | bcpkix
542 | Active | 90 | 0.0.0 | com.ibm.mq.allclient.jar
543 | Active | 90 | 1.59 | bcprov
562 | Active | 90 | 2.3.0 | org.apache.daffodil.daffodil-japi
579 | Active | 90 | 2.3.0 | org.apache.daffodil.daffodil-io
580 | Active | 90 | 2.3.0 | org.apache.daffodil.daffodil-core
581 | Active | 90 | 2.3.0 | org.apache.daffodil.daffodil-lib
582 | Active | 90 | 2.3.0 | org.apache.daffodil.daffodil-runtime1
584 | Active | 90 | 1.0.0.v20190605221819 | camelfuseDSL_DFDL_short
karaf@root()>
部分控制台输出异常/堆栈跟踪
-
-
-
karaf@root()> log:tail
**** inMessage.toString()=JmsMessage[JmsMessageID: ID:414d5120514d3120202020202020202015cef75c02dec222]
**** see if can compile DFDL schema
18:39:35.448 ERROR [Camel (camelBPContext) thread #5 - JmsConsumer[DEV.QUEUE.1]] Failed delivery for (MessageId: ID:414d5120514d3120202020202020202015cef75c02dec222 on ExchangeId: ID-DESKTOP-8BL5O58-1559774328863-0-1). Exhausted after delivery attempt: 1 caught: org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-DESKTOP-8BL5O58-1559774328863-0-1]
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[route1 ] [route1 ] [wmq://queue:DEV.QUEUE.1 ] [ 8]
[route1 ] [process1 ] [Processor@0x3d8390da ] [ 5]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.CamelExecutionException: Exception occurred during execution on the exchange: Exchange[ID-DESKTOP-8BL5O58-1559774328863-0-1]
at org.apache.camel.util.ObjectHelper.wrapCamelExecutionException(ObjectHelper.java:1846) ~[66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.impl.DefaultExchange.setException(DefaultExchange.java:385) ~[66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:66) ~[66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.processor.RedeliveryErrorHandler.process(RedeliveryErrorHandler.java:548) [66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:138) [66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.processor.Pipeline.process(Pipeline.java:101) [66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.processor.CamelInternalProcessor.process(CamelInternalProcessor.java:201) [66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.processor.DelegateAsyncProcessor.process(DelegateAsyncProcessor.java:97) [66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
at org.apache.camel.component.jms.EndpointMessageListener.onMessage(EndpointMessageListener.java:113) [248:org.apache.camel.camel-jms:2.21.0.fuse-720050-redhat-00001]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doInvokeListener(AbstractMessageListenerContainer.java:719) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at org.springframework.jms.listener.AbstractMessageListenerContainer.invokeListener(AbstractMessageListenerContainer.java:679) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at org.springframework.jms.listener.AbstractMessageListenerContainer.doExecuteListener(AbstractMessageListenerContainer.java:649) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.doReceiveAndExecute(AbstractPollingMessageListenerContainer.java:317) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at org.springframework.jms.listener.AbstractPollingMessageListenerContainer.receiveAndExecute(AbstractPollingMessageListenerContainer.java:255) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.invokeListener(DefaultMessageListenerContainer.java:1168) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.executeOngoingLoop(DefaultMessageListenerContainer.java:1160) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at org.springframework.jms.listener.DefaultMessageListenerContainer$AsyncMessageListenerInvoker.run(DefaultMessageListenerContainer.java:1057) [250:org.apache.servicemix.bundles.spring-jms:4.3.17.RELEASE_1]
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142) [?:?]
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617) [?:?]
at java.lang.Thread.run(Thread.java:745) [?:?]
Caused by: java.lang.NoClassDefFoundError: org/apache/daffodil/util/LogWriter
at org.apache.daffodil.japi.Daffodil.compiler(Daffodil.scala) ~[562:org.apache.daffodil.daffodil-japi:2.3.0]
at aaa.bbb.ccc.camel.DfdlProcessor.process(DfdlProcessor.java:24) ~[584:aaa.bbb.ccc.camel.camelfuseDSL_DFDL_short:1.0.0.v20190605221819]
at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63) ~[66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
... 18 more
Caused by: java.lang.ClassNotFoundException: org.apache.daffodil.util.LogWriter not found by org.apache.daffodil.daffodil-io [579]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1639) ~[?:?]
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
at org.apache.felix.framework.BundleWiringImpl.getClassByDelegation(BundleWiringImpl.java:1414) ~[?:?]
at org.apache.felix.framework.BundleWiringImpl.searchImports(BundleWiringImpl.java:1660) ~[?:?]
at org.apache.felix.framework.BundleWiringImpl.findClassOrResourceByDelegation(BundleWiringImpl.java:1590) ~[?:?]
at org.apache.felix.framework.BundleWiringImpl.access$200(BundleWiringImpl.java:80) ~[?:?]
at org.apache.felix.framework.BundleWiringImpl$BundleClassLoader.loadClass(BundleWiringImpl.java:2053) ~[?:?]
at java.lang.ClassLoader.loadClass(ClassLoader.java:357) ~[?:?]
at org.apache.daffodil.japi.Daffodil.compiler(Daffodil.scala) ~[562:org.apache.daffodil.daffodil-japi:2.3.0]
at aaa.bbb.ccc.camel.DfdlProcessor.process(DfdlProcessor.java:24) ~[584:aaa.bbb.ccc.camel.camelfuseDSL_DFDL_short:1.0.0.v20190605221819]
at org.apache.camel.processor.DelegateSyncProcessor.process(DelegateSyncProcessor.java:63) ~[66:org.apache.camel.camel-core:2.21.0.fuse-720050-redhat-00001]
... 18 more
-
-
-