With your help the setup is now working without query Parameters. When I add 
the following lines to servicemix.xml with XPath:

<property name="query" value="SELECT * FROM user WHERE SecondName like $name" />
...
                 <property name="queryParams">
                    <list>
                      <bean 
class="org.spagic.smx.components.jdbcquery.QueryParameterConfig" >
                        <property name="placeHolder" value="name" />
                        <property name="outputParam" value="TRUE" />
                        <property name="xpath" value="/queryConfig/name" />
                        <property name="paramType" value="java.lang.String" />
                      </bean>
                    </list>
                  </property>

 I get always the following exception:

17:06:32,515 | WARN  | pool-flow.seda.myJdbcQueryadvJdbcDatasource2-thread-2 | 
FileComponent            | icemix.file.FilePollerEndpoint  389 | Message in 
file C:\Projects\SimpleJDBC\poller\input.xml could not be handled successfully: 
java.io.IOException: Stream closed
javax.xml.transform.TransformerException: java.io.IOException: Stream closed
        at 
org.apache.xalan.transformer.TransformerIdentityImpl.transform(TransformerIdentityImpl.java:505)
        at 
org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:125)
        at 
org.apache.servicemix.jbi.jaxp.SourceTransformer.toResult(SourceTransformer.java:103)
        at 
org.apache.servicemix.jbi.jaxp.SourceTransformer.toString(SourceTransformer.java:140)
        at 
org.apache.servicemix.jbi.jaxp.SourceTransformer.contentToString(SourceTransformer.java:161)
        at 
org.spagic.smx.components.jdbcquery.JDBCAdvancedQueryComponent.transform(JDBCAdvancedQueryComponent.java:147)
        at 
org.apache.servicemix.components.util.TransformComponentSupport.onMessageExchange(TransformComponentSupport.java:71)
        at 
org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:620)
        at 
org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
        at 
org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:168)
        at 
org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
        at 
java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
        at java.lang.Thread.run(Thread.java:595)

My input file looks like this:
<?xml version="1.0" encoding="UTF-8"?>
<queryConfig>
<name>Sevcik</name>
</queryConfig>

Is there an error in my XPath? Any other idea? Thanks in advance.

Berndt
--
Dipl.-Ing. Berndt Sevcik
TU Wien
Institut für Computertechnik
Gußhausstraße 27-29/384 - 1040 Wien
Tel.: +43 1 58801 38436
Mail: [EMAIL PROTECTED]
URL: http://www.ict.tuwien.ac.at



-----Ursprüngliche Nachricht-----
Von: subh [mailto:[EMAIL PROTECTED]
Gesendet: Mittwoch, 26. November 2008 16:21
An: [email protected]
Betreff: Re: AW: Advanced JDBC by Spargic


Here you go..

Servicemix.xml
++++++++++++

<bean id="athenaPricingDS"
class="org.springframework.jndi.JndiObjectFactoryBean">
<property name="jndiName" value="java:comp/env/jdbc/athenaPricingDB"/>
</bean>

<sm:activationSpec componentName="jdbcPricingService"
service="athena:jdbcPricingService" destinationService="athena:echoService">
<sm:component>
<bean
class="org.spagic.smx.components.jdbcstore.JDBCStoreProcedureComponent">
<property name="connConfig">
<bean class="org.spagic.smx.components.jdbcquery.JDBCConnectionConfig">
<property name="datasource" ref="athenaPricingDS"/>
</bean>
</property>
<property name="queryConfig">
<bean class="org.spagic.smx.components.jdbcquery.JDBCQueryConfig">
<property name="query" value="{call
COMMON_PRICE_DATA.processPrices($priceFeedCode, $priceFeedOption,
$processStart)}" />
<property name="enrichMessage" value="false" />
<property name="xmlEnvelope" value="" />
<property name="rowsXmlEnvelope" value="payload"/>
<property name="rowXmlEnvelope" value="pricefeed"/>
<property name="queryParams">
<list>
<bean class="org.spagic.smx.components.jdbcquery.QueryParameterConfig" >
<property name="placeHolder" value="priceFeedCode" />
<property name="outputParam" value="false" />
<property name="xpath" value="/payload/pricefeed/priceFeedCode" />
<property name="paramType" value="java.lang.String" />
</bean>
<bean class="org.spagic.smx.components.jdbcquery.QueryParameterConfig" >
<property name="placeHolder" value="priceFeedOption" />
<property name="outputParam" value="false" />
<property name="xpath" value="/payload/pricefeed/priceFeedOption" />
<property name="paramType" value="java.lang.String" />
</bean>
<bean class="org.spagic.smx.components.jdbcquery.QueryParameterConfig" >
<property name="placeHolder" value="processStart" />
<property name="outputParam" value="false" />
<property name="xpath" value="/payload/pricefeed/processStart" />
<property name="paramType" value="java.lang.String" />
</bean>
</list>
</property>
</bean>
</property>
</bean>
</sm:component>
</sm:activationSpec>
</sm:activationSpecs>
</sm:container>

Jndi.xml
+++++++

<entry key="java:comp/env/jdbc/athenaPricingDB">
  <bean class="org.springframework.jdbc.datasource.DriverManagerDataSource">
        <property name="driverClassName" 
value="oracle.jdbc.driver.OracleDriver"/>
        <property name="url" value="jdbc:oracle:thin:@10.11.1.41:1521:DB03"/>
        <property name="username" value="PRICING_APP"/>
        <property name="password" value="PRICING_APP"/>
  </bean>
</entry>

And you can invoke this service, e.g., from a file poller, xbean below

<file:poller service="athena:pricingFilePoller"
        endpoint="toFtpPoller"
        targetService="athena:jdbcPricingService"
        file="file:PriceFeeds"
        period="40000"
        delay = "20000" >
        <property name="filter">
            <bean class="org.apache.commons.io.filefilter.WildcardFilter">
                <constructor-arg value="*.xml" />
            </bean>
        </property>
</file:poller>

Rgds
subh


Berndt Sevcik wrote:
>
>
> Is it possible to post the full working configuration including the
> servicemix.xml, jndi.xml and the pom.xml file of the SU?
>
> Thanks in advance.
>
> Berndt
>
>
> -----Ursprüngliche Nachricht-----
> Von: subh [mailto:[EMAIL PROTECTED]
> Gesendet: Donnerstag, 20. November 2008 03:34
> An: [email protected]
> Betreff: Re: Advanced JDBC by Spargic
>
>
> Just to let you know, I got it working. I was not using the xpath
> properly.
>
> anyways, thanks for looking
>
>
> subh wrote:
>>
>> Hi,
>>
>> I am trying to use the Advanced JDBC Component by Spagic to call a SP. I
>> have configured the component as below
>>
>> <sm:activationSpec componentName="jdbcPricingService"
>> service="myesb:jdbcPricingService"
>> destinationService="myesb:echoService">
>> <sm:component>
>> <bean
>> class="org.spagic.smx.components.jdbcstore.JDBCStoreProcedureComponent">
>> <property name="connConfig">
>> <bean class="org.spagic.smx.components.jdbcquery.JDBCConnectionConfig">
>> <!-- <property name="databaseVendor" value="MySQL" /> -->
>> <property name="datasource" ref="pricingDS"/>
>> </bean>
>> </property>
>> <property name="queryConfig">
>> <bean class="org.spagic.smx.components.jdbcquery.JDBCQueryConfig">
>> <property name="query" value="{call payment($paymentAmount, $sellerId)}"
>> />
>> <property name="enrichMessage" value="FALSE" />
>> <property name="xmlEnvelope" value="store-results" />
>> <property name="queryParams">
>> <list>
>> <bean class="org.spagic.smx.components.jdbcquery.QueryParameterConfig" >
>> <property name="placeHolder" value="paymentAmount" />
>> <property name="outputParam" value="TRUE" />
>> <!-- <property name="XPath" value="null" /> -->
>> <property name="paramType" value="java.lang.String" />
>> </bean>
>> <bean class="org.spagic.smx.components.jdbcquery.QueryParameterConfig" >
>> <property name="placeHolder" value="sellerId" />
>> <property name="outputParam" value="TRUE" />
>> <!-- <property name="XPath" value="null" /> -->
>> <property name="paramType" value="java.lang.String" />
>> </bean>
>> </list>
>> </property>
>> </bean>
>> </property>
>> </bean>
>> </sm:component>
>> </sm:activationSpec>
>>
>> As you can see, my SP needs 2 params ($paymentAmount, $sellerId), I would
>> like to know how could I pass these params while calling this component.
>> If I pass them as
>>
>> <?xml version="1.0" encoding="UTF-8"?>
>> <queryConfig>
>> <paymentAmount>100</paymentAmount>
>> <sellerId>1</sellerId>
>> </queryConfig>
>>
>> I get the following error
>>
>> ERROR
>> ======
>>
>> DEBUG - SedaQueue                      -
>> [EMAIL PROTECTED] dequeued
>> exchange: InOnly[
>>   id: ID:10.30.9.159-11db6eca25c-11:13
>>   status: Active
>>   role: provider
>>   service: {http://com.mycompany.myesb/esb}jdbcPricingService
>>   endpoint: jdbcPricingService
>>   in: <?xml version="1.0" encoding="UTF-8"?><queryConfig>
>> <paymentAmount>100</paymentAmount>
>> <sellerId>1</sellerId>
>> </queryConfig>
>> ]
>> DEBUG - DeliveryChannelImpl            - Send
>> ID:10.30.9.159-11db6eca25c-11:13 in DeliveryChannel{jdbcPricingService}
>> DEBUG - SecuredBroker                  - send exchange with secure broker
>> DEBUG - SedaFlow                       - Called Flow send
>> DEBUG - SedaQueue                      -
>> [EMAIL PROTECTED] dequeued
>> exchange: InOnly[
>>   id: ID:10.30.9.159-11db6eca25c-11:13
>>   status: Error
>>   role: consumer
>>   service: {http://com.mycompany.myesb/esb}jdbcPricingService
>>   endpoint: jdbcPricingService
>>   in: <?xml version="1.0" encoding="UTF-8"?><queryConfig>
>> <paymentAmount>100</paymentAmount>
>> <sellerId>1</sellerId>
>> </queryConfig>
>>   error: java.lang.NullPointerException
>> ]
>> DEBUG - DeliveryChannelImpl            - Notifying exchange
>> ID:10.30.9.159-11db6eca25c-11:13(14e7ecf) in
>> DeliveryChannel{servicemix-file} from processInboundSynchronousEx
>> change
>> DEBUG - DeliveryChannelImpl            - Notified:
>> ID:10.30.9.159-11db6eca25c-11:13(14e7ecf) in
>> DeliveryChannel{servicemix-file} from sendSync
>> ERROR - FileComponent                  - Failed to process file:
>> PriceFeeds\TestJDBC.xml. Reason: java.lang.NullPointerException
>> java.lang.NullPointerException
>>         at java.lang.StringBuffer.<init>(StringBuffer.java:104)
>>         at
>> org.apache.commons.dbutils.QueryRunner.rethrow(QueryRunner.java:347)
>>         at
>> org.spagic.smx.components.jdbcstore.NewStoreProcedureRunner.call(NewStoreProcedureRunner.java:77)
>>         at
>> org.spagic.smx.components.jdbcstore.JDBCStoreProcedureComponent.transform(JDBCStoreProcedureComponent.java:92)
>>         at
>> org.apache.servicemix.components.util.TransformComponentSupport.onMessageExchange(TransformComponentSupport.java:71)
>>         at
>> org.apache.servicemix.jbi.messaging.DeliveryChannelImpl.processInBound(DeliveryChannelImpl.java:610)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.AbstractFlow.doRouting(AbstractFlow.java:172)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaFlow.doRouting(SedaFlow.java:167)
>>         at
>> org.apache.servicemix.jbi.nmr.flow.seda.SedaQueue$1.run(SedaQueue.java:134)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java:650)
>>         at
>> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:675)
>>         at java.lang.Thread.run(Thread.java:595)
>>
>> Will appreciate any help.
>>
>> rgds
>> subh
>>
>>
>> Berndt Sevcik wrote:
>>>
>>> I try to use the Advanced JDBC Component by Spargic in Servicemix. When
>>> I
>>> deploy the Component I get the following error:
>>> <
>>> loc-message>org.springframework.beans.factory.parsing.BeanDefinitionParsingException:
>>> Configuration problem: Class that bean class
>>> [org.spagic.smx.components.jdbcquery.JDBCAdvancedQueryComponent] depends
>>> on not found
>>> Offending resource: file
>>> [C:\apache-servicemix-3.2.2\data\smx\service-assemblies\tutorial-jdbc-sa\version_20\sus\servicemix-lwcontainer\tutorial-adv_jdbc-su\servicemix.xml]
>>> Bean ''; nested exception is java.lang.NoClassDefFoundError:
>>> org/springframework/jdbc/CannotGetJdbcConnectionException</loc-message>
>>>
>>> Has someone an idea? In the following the steps I have done to configure
>>> it.
>>>
>>> First I copied:
>>> commons-dbutils-1.1.jar and mysql-connector-java-5.0.7-bin.jar to the
>>> lib/ directory
>>> and spagic-advanced-jdbc-2.3.0.jar to the lib/optional directory of
>>> Servicemix (like in Spagic).
>>>
>>> In jndi.xml I added:
>>>   <entry key="java:comp/env/jdbc/servicemixDB">
>>>     <!-- <bean id="mysql-ds"
>>> class="org.springframework.jdbc.datasource.DriverManagerDataSource"> -->
>>>         <bean id="mysql-ds"
>>> class="org.apache.commons.dbcp.BasicDataSource">
>>>         <property name="driverName" value="com.mysql.jdbc.Driver"/>
>>>         <property name="url" value="jdbc:mysql://localhost/NameInfo"/>
>>>         <property name="user" value="user"/>
>>>         <property name="password" value="password"/>
>>>     </bean>
>>>   </entry>
>>>
>>> Then I created a servicemix.xml file that looks like this:
>>> <beans xmlns:sm="http://servicemix.apache.org/config/1.0";
>>>        xmlns:foo="http://servicemix.apache.org/foo";
>>>        xmlns="http://www.springframework.org/schema/beans";
>>>        xmlns:xsi="http://http://www.w3.org/2001/XMLSchema-instance";
>>>        xsi:schemaLocation="http://servicemix.apache.org/config/1.0
>>> http://servicemix.apache.org/schema/servicemix-core-3.2.2.xsd
>>>        http://www.springframework.org/schema/beans
>>> http://www.springframework.org/schema/beans/spring-beans-2.0.xsd";>
>>>
>>>   <!-- This is the Spring configuration of a datasource defined in
>>> SERVICE_MIX_HOME/conf/jndi.xml -->
>>>   <bean id="mySql"
>>> class="org.springframework.jndi.JndiObjectFactoryBean">
>>>     <property name="jndiName" value="java:comp/env/jdbc/servicemixDB"/>
>>>   </bean>
>>>
>>>   <classpath>
>>>     <location>.</location>
>>>   </classpath>
>>>
>>>
>>>   <sm:serviceunit id="jbi">
>>>       <!-- Put lw components here -->
>>>       <!-- Note that JDBC Endpoint declare a property ref to the
>>> dataSource defined by the bean above -->
>>>       <!-- ####################### myJDBCdbAndrea
>>> ######################## -->
>>>           <sm:activationSpecs>
>>>         <sm:activationSpec componentName="myJdbcQueryadvJdbcDatasource2"
>>> service="foo:myJdbcQueryadvJdbcDatasource2"
>>> destinationService="foo:myScreenOutputadvJdbcDatasource2">
>>>           <sm:component>
>>>             <bean
>>> class="org.spagic.smx.components.jdbcquery.JDBCAdvancedQueryComponent">
>>>               <property name="connConfig">
>>>                 <bean
>>> class="org.spagic.smx.components.jdbcquery.JDBCConnectionConfig">
>>>                   <property name="datasource" ref="mysql"/>
>>>                 </bean>
>>>               </property>
>>>               <property name="queryConfig">
>>>                 <bean
>>> class="org.spagic.smx.components.jdbcquery.JDBCQueryConfig">
>>>                   <property name="query" value="SELECT * FROM user where
>>> SecondName like $name" />
>>>                   <property name="enrichMessage" value="TRUE" />
>>>                   <property name="xmlEnvelope" value="Customer" />
>>>                   <property name="queryParams">
>>>                     <list>
>>>                       <bean
>>> class="org.spagic.smx.components.jdbcquery.QueryParameterConfig" >
>>>                         <property name="placeHolder" value="name" />
>>>                         <property name="outputParam" value="FALSE" />
>>>                         <property name="XPath"
>>> value="/nameinfo/givenName" />
>>>                         <property name="paramType"
>>> value="java.lang.String" />
>>>                       </bean>
>>>                     </list>
>>>                   </property>
>>>                 </bean>
>>>               </property>
>>>             </bean>
>>>           </sm:component>
>>>         </sm:activationSpec>
>>>       </sm:activationSpecs>
>>>   </sm:serviceunit>
>>>
>>> </beans>
>>>
>>> With mvn install I created my Service Assembly.
>>>
>>> --
>>> Dipl.-Ing. Berndt Sevcik
>>> TU Wien
>>> Institut für Computertechnik
>>> Gußhausstraße 27-29/384 - 1040 Wien
>>> Tel.: +43 1 58801 38436
>>> Mail: [EMAIL PROTECTED]
>>> URL: http://www.ict.tuwien.ac.at
>>>
>>>
>>>
>>>
>>>
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/Advanced-JDBC-by-Spargic-tp20538155p20593965.html
> Sent from the ServiceMix - User mailing list archive at Nabble.com.
>
>
>

--
View this message in context: 
http://www.nabble.com/Advanced-JDBC-by-Spargic-tp20538155p20702669.html
Sent from the ServiceMix - User mailing list archive at Nabble.com.

Reply via email to