You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@camel.apache.org by "黄颜木 (JIRA)" <ji...@apache.org> on 2015/05/22 12:12:17 UTC
[jira] [Updated] (CAMEL-8792)
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to
invoke method:
[ https://issues.apache.org/jira/browse/CAMEL-8792?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
黄颜木 updated CAMEL-8792:
-----------------------
Description:
1. when just use sqlComponents ,its okay.
2. I try to just run the sql one times,so add timer//foo?repeatCount=1
error happend.
my code goes here:
<beans xmlns="http://www.springframework.org/schema/beans"
19 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
20 xmlns:camel="http://camel.apache.org/schema/spring"
21 xsi:schemaLocation="
22 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
23 http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
24
25 <!-- this is the JDBC data source which uses an Oracle database -->
26 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
27 <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
28 <property name="url" value="jdbc:oracle:thin:@192.168.250.160:1521:test"/>
29 <property name="username" value="ifsapp"/>
30 <property name="password" value="ifsapp1"/>
31 </bean>
32
33 <!-- configure the Camel SQL component to use the JDBC data source -->
34 <bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
35 <property name="dataSource" ref="dataSource"/>
36 </bean>
37
38 <!-- ofbiz remote dispatcher -->
39 <bean id="ofbizDispatcher" class="com.ofbizian.OfbizDispatcher">
40 <constructor-arg ref="remoteDispatcher"/>
41 </bean>
42
43 <bean id="categoryBean" class="com.ofbizian.CategoryBean"/>
44
45 <!-- here is Camel configured with a number of routes -->
46 <camelContext xmlns="http://camel.apache.org/schema/spring">
47 <!-- use Camel property placeholder loaded from the given file -->
48 <propertyPlaceholder id="placeholder" location="classpath:sql.properties"/>
49
50 <!-- ofbiz remote deispatcher -->
51 <proxy id="remoteDispatcher" serviceInterface="org.ofbiz.service.rmi.RemoteDispatcher" serviceUrl="direct:ofbiz"/>
52
53 <route id="encoderCategory-route">
54 <!-- 仅运行一次-->
55 <from uri="timer://foo?repeatCount=1"/>
56 <to uri="sql:{{sql.selectCategory}}?outputClass=com.ofbizian.CategoryBean"/>
57 <log message="${in.body.mainid} :: ${in.body.typename} :: ${in.body.typeparent}"/>
58 <setHeader headerName="Ofbiz.ServiceName">
59 <constant>createEncoderCategory</constant>
60 </setHeader>
61 <setHeader headerName="Ofbiz.Param.productCategoryId">
62 <simple>${in.body.mainid}</simple>
63 </setHeader>
64 <setHeader headerName="Ofbiz.Param.categoryName">
65 <simple>${in.body.typename}</simple>
66 </setHeader>
67 <setHeader headerName="Ofbiz.Param.parentProductCategoryId">
68 <simple>${in.body.typeparent}</simple>
69 </setHeader>
70 <setHeader headerName="Ofbiz.Param.primaryParentCategoryId">
71 <simple>${in.body.typeparent}</simple>
72 </setHeader>
73 <setHeader headerName="Ofbiz.Param.productCategoryTypeId">
74 <constant>CATALOG_CATEGORY</constant>
75 </setHeader>
76 <process ref="ofbizDispatcher"/>
77 </route>
78 <route>
79 <from uri="direct:ofbiz"/>
80 <to uri="rmi://192.168.36.20:1099/RMIDispatcher"/>
81 <log message="ofbiz create note:${body}"/>
82 </route>
83 <!-- END SNIPPET: e2 -->
84 </camelContext>
85 </beans>
-------------------------------------------------------------------------------
CategoryBean.java
1 package com.ofbizian;
2
3 public class CategoryBean{
4 private String mainid;
5 private String typename;
6 private String typeparent;
7 private String typecategory;
8
9 public String getMainid(){
10 return mainid;
11 }
12
13 public void setMainid(String mainid){
14 this.mainid=mainid;
15 }
16
17 public String getTypename(){
18 return typename;
19 }
20
21 public void setTypename(String typename){
22 this.typename=typename;
23 }
24
25 public String getTypeparent(){
26 return typeparent;
27 }
28
29 public void setTypeparent(String typeparent){
30 this.typeparent=typeparent;
31 }
32
33 public String getTypecategory(){
34 return typecategory;
35 }
36
37 public void setTypecategory(){
38 this.typecategory=typecategory;
39 }
40 }
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[encoderCategory-ro] [encoderCategory-ro] [timer://foo?repeatCount=1 ] [ 1256]
[encoderCategory-ro] [to1 ] [sql:select MAINID,TYPENAME,TYPEPARENT,TYPECATEGORY from spg_material_type whe] [ 1162]
[encoderCategory-ro] [log1 ] [log ] [ 81]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id ID-localhost-localdomain-59312-1432288083959-0-2
ExchangePattern InOnly
Headers {breadcrumbId=ID-localhost-localdomain-59312-1432288083959-0-1, CamelRedelivered=false, CamelRedeliveryCounter=0, CamelSqlRowCount=16, firedTime=Fri May 22 17:48:06 CST 2015}
BodyType java.util.ArrayList
Body [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e]
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: .mainid on null due to: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: mainid on null due to: org.apache.camel.component.bean.MethodNotFoundException: Method with name: mainid not found on bean: [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e] of type: java.util.ArrayList. Exchange[Message: [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e]]
at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:117)
was:
1. when just use sqlComponents ,its okay.
2. I try to just run the sql one times,so add timer//foo?repeatCount=1
error happend. with the messager below...
Message History
---------------------------------------------------------------------------------------------------------------------------------------
RouteId ProcessorId Processor Elapsed (ms)
[encoderCategory-ro] [encoderCategory-ro] [timer://foo?repeatCount=1 ] [ 1256]
[encoderCategory-ro] [to1 ] [sql:select MAINID,TYPENAME,TYPEPARENT,TYPECATEGORY from spg_material_type whe] [ 1162]
[encoderCategory-ro] [log1 ] [log ] [ 81]
Exchange
---------------------------------------------------------------------------------------------------------------------------------------
Exchange[
Id ID-localhost-localdomain-59312-1432288083959-0-2
ExchangePattern InOnly
Headers {breadcrumbId=ID-localhost-localdomain-59312-1432288083959-0-1, CamelRedelivered=false, CamelRedeliveryCounter=0, CamelSqlRowCount=16, firedTime=Fri May 22 17:48:06 CST 2015}
BodyType java.util.ArrayList
Body [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e]
]
Stacktrace
---------------------------------------------------------------------------------------------------------------------------------------
org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: .mainid on null due to: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: mainid on null due to: org.apache.camel.component.bean.MethodNotFoundException: Method with name: mainid not found on bean: [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e] of type: java.util.ArrayList. Exchange[Message: [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e]]
at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:117)
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method:
> ----------------------------------------------------------------------------------------
>
> Key: CAMEL-8792
> URL: https://issues.apache.org/jira/browse/CAMEL-8792
> Project: Camel
> Issue Type: Bug
> Components: camel-core, camel-sql
> Affects Versions: 2.15.2
> Environment: windows7 jdk1.7
> Reporter: 黄颜木
>
> 1. when just use sqlComponents ,its okay.
> 2. I try to just run the sql one times,so add timer//foo?repeatCount=1
> error happend.
> my code goes here:
> <beans xmlns="http://www.springframework.org/schema/beans"
> 19 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
> 20 xmlns:camel="http://camel.apache.org/schema/spring"
> 21 xsi:schemaLocation="
> 22 http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd
> 23 http://camel.apache.org/schema/spring http://camel.apache.org/schema/spring/camel-spring.xsd">
> 24
> 25 <!-- this is the JDBC data source which uses an Oracle database -->
> 26 <bean id="dataSource" class="org.apache.commons.dbcp.BasicDataSource" destroy-method="close">
> 27 <property name="driverClassName" value="oracle.jdbc.driver.OracleDriver"/>
> 28 <property name="url" value="jdbc:oracle:thin:@192.168.250.160:1521:test"/>
> 29 <property name="username" value="ifsapp"/>
> 30 <property name="password" value="ifsapp1"/>
> 31 </bean>
> 32
> 33 <!-- configure the Camel SQL component to use the JDBC data source -->
> 34 <bean id="sql" class="org.apache.camel.component.sql.SqlComponent">
> 35 <property name="dataSource" ref="dataSource"/>
> 36 </bean>
> 37
> 38 <!-- ofbiz remote dispatcher -->
> 39 <bean id="ofbizDispatcher" class="com.ofbizian.OfbizDispatcher">
> 40 <constructor-arg ref="remoteDispatcher"/>
> 41 </bean>
> 42
> 43 <bean id="categoryBean" class="com.ofbizian.CategoryBean"/>
> 44
> 45 <!-- here is Camel configured with a number of routes -->
> 46 <camelContext xmlns="http://camel.apache.org/schema/spring">
> 47 <!-- use Camel property placeholder loaded from the given file -->
> 48 <propertyPlaceholder id="placeholder" location="classpath:sql.properties"/>
> 49
> 50 <!-- ofbiz remote deispatcher -->
> 51 <proxy id="remoteDispatcher" serviceInterface="org.ofbiz.service.rmi.RemoteDispatcher" serviceUrl="direct:ofbiz"/>
> 52
> 53 <route id="encoderCategory-route">
> 54 <!-- 仅运行一次-->
> 55 <from uri="timer://foo?repeatCount=1"/>
> 56 <to uri="sql:{{sql.selectCategory}}?outputClass=com.ofbizian.CategoryBean"/>
> 57 <log message="${in.body.mainid} :: ${in.body.typename} :: ${in.body.typeparent}"/>
> 58 <setHeader headerName="Ofbiz.ServiceName">
> 59 <constant>createEncoderCategory</constant>
> 60 </setHeader>
> 61 <setHeader headerName="Ofbiz.Param.productCategoryId">
> 62 <simple>${in.body.mainid}</simple>
> 63 </setHeader>
> 64 <setHeader headerName="Ofbiz.Param.categoryName">
> 65 <simple>${in.body.typename}</simple>
> 66 </setHeader>
> 67 <setHeader headerName="Ofbiz.Param.parentProductCategoryId">
> 68 <simple>${in.body.typeparent}</simple>
> 69 </setHeader>
> 70 <setHeader headerName="Ofbiz.Param.primaryParentCategoryId">
> 71 <simple>${in.body.typeparent}</simple>
> 72 </setHeader>
> 73 <setHeader headerName="Ofbiz.Param.productCategoryTypeId">
> 74 <constant>CATALOG_CATEGORY</constant>
> 75 </setHeader>
> 76 <process ref="ofbizDispatcher"/>
> 77 </route>
> 78 <route>
> 79 <from uri="direct:ofbiz"/>
> 80 <to uri="rmi://192.168.36.20:1099/RMIDispatcher"/>
> 81 <log message="ofbiz create note:${body}"/>
> 82 </route>
> 83 <!-- END SNIPPET: e2 -->
> 84 </camelContext>
> 85 </beans>
> -------------------------------------------------------------------------------
> CategoryBean.java
> 1 package com.ofbizian;
> 2
> 3 public class CategoryBean{
> 4 private String mainid;
> 5 private String typename;
> 6 private String typeparent;
> 7 private String typecategory;
> 8
> 9 public String getMainid(){
> 10 return mainid;
> 11 }
> 12
> 13 public void setMainid(String mainid){
> 14 this.mainid=mainid;
> 15 }
> 16
> 17 public String getTypename(){
> 18 return typename;
> 19 }
> 20
> 21 public void setTypename(String typename){
> 22 this.typename=typename;
> 23 }
> 24
> 25 public String getTypeparent(){
> 26 return typeparent;
> 27 }
> 28
> 29 public void setTypeparent(String typeparent){
> 30 this.typeparent=typeparent;
> 31 }
> 32
> 33 public String getTypecategory(){
> 34 return typecategory;
> 35 }
> 36
> 37 public void setTypecategory(){
> 38 this.typecategory=typecategory;
> 39 }
> 40 }
>
> Message History
> ---------------------------------------------------------------------------------------------------------------------------------------
> RouteId ProcessorId Processor Elapsed (ms)
> [encoderCategory-ro] [encoderCategory-ro] [timer://foo?repeatCount=1 ] [ 1256]
> [encoderCategory-ro] [to1 ] [sql:select MAINID,TYPENAME,TYPEPARENT,TYPECATEGORY from spg_material_type whe] [ 1162]
> [encoderCategory-ro] [log1 ] [log ] [ 81]
> Exchange
> ---------------------------------------------------------------------------------------------------------------------------------------
> Exchange[
> Id ID-localhost-localdomain-59312-1432288083959-0-2
> ExchangePattern InOnly
> Headers {breadcrumbId=ID-localhost-localdomain-59312-1432288083959-0-1, CamelRedelivered=false, CamelRedeliveryCounter=0, CamelSqlRowCount=16, firedTime=Fri May 22 17:48:06 CST 2015}
> BodyType java.util.ArrayList
> Body [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e]
> ]
> Stacktrace
> ---------------------------------------------------------------------------------------------------------------------------------------
> org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: .mainid on null due to: org.apache.camel.language.bean.RuntimeBeanExpressionException: Failed to invoke method: mainid on null due to: org.apache.camel.component.bean.MethodNotFoundException: Method with name: mainid not found on bean: [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e] of type: java.util.ArrayList. Exchange[Message: [com.ofbizian.CategoryBean@bbf16e, com.ofbizian.CategoryBean@e79a45, com.ofbizian.CategoryBean@14135cf, com.ofbizian.CategoryBean@33d7d7, com.ofbizian.CategoryBean@19f6fa4, com.ofbizian.CategoryBean@5a8b48, com.ofbizian.CategoryBean@6e273a, com.ofbizian.CategoryBean@1d1627e, com.ofbizian.CategoryBean@1997685, com.ofbizian.CategoryBean@343d90, com.ofbizian.CategoryBean@1b5c453, com.ofbizian.CategoryBean@6c45d2, com.ofbizian.CategoryBean@5bf9e7, com.ofbizian.CategoryBean@73ed80, com.ofbizian.CategoryBean@ed93a9, com.ofbizian.CategoryBean@179565e]]
> at org.apache.camel.language.bean.BeanExpression.evaluate(BeanExpression.java:117)
--
This message was sent by Atlassian JIRA
(v6.3.4#6332)