xml - Oracle Data source configuration in MULE -


i've created project using apikit-with-munit example project.

i mavenized project , have 1 app file called api.xml , 1 api-test-suite.xml file. i'm trying add db reference in test , i'm coming across following error when launching tests when launching test maven only.

when launching tests anypoint studio, munit works fine.

i dont't know wrong config... suspect problem related namespaces can point out i'm doing wrong?

failed execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.1.0:test (test) on project testing-apikit-with-munit_1.3.3-1:  execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.1.0:test failed: org.mule.api.config.configurationexception:  configuration problem: failed import bean definitions url location [classpath:api.xml] 

[error] offending resource: url [file:/c:/workspaces/coverage1/testing-apikit-with-munit_1.3.3-1/target/test-classes/api-test-suite.xml]; nested exception org.springframework.beans.factory.xml.xmlbeandefinitionstoreexception: line 40 in xml document class path resource [api.xml] invalid; nested exception org.xml.sax.saxparseexception; linenumber: 40; columnnumber: 101; cvc-complex-type.2.4.a: invalid content found starting element 'db:oracle-config'.

 1 of '{"http://www.springframework.org/schema/beans":beans, "http://www.springframework.org/schema/beans":bean,   "http://www.springframework.org/schema/context":property-placeholder,  "http://www.springframework.org/schema/beans":ref, "http://www.mulesoft.org/schema/mule/core":global-property, "http://www.mulesoft.org/schema/mule/core":configuration,  "http://www.mulesoft.org/schema/mule/core":notifications, "http://www.mulesoft.org/schema/mule/core":abstract-extension,  "http://www.mulesoft.org/schema/mule/core":abstract-shared-extension,  "http://www.mulesoft.org/schema/mule/core":abstract-mixed-content-extension,  "http://www.mulesoft.org/schema/mule/core":abstract-agent, "http://www.mulesoft.org/schema/mule/core":abstract-security-manager,  "http://www.mulesoft.org/schema/mule/core":abstract-transaction-manager, "http://www.mulesoft.org/schema/mule/core":abstract-shared-transaction-manager,  "http://www.mulesoft.org/schema/mule/core":abstract-connector, "http://www.mulesoft.org/schema/mule/core":abstract-shared-connector,  "http://www.mulesoft.org/schema/mule/core":abstract-global-endpoint, "http://www.mulesoft.org/schema/mule/core":abstract-exception-strategy,  "http://www.mulesoft.org/schema/mule/core":abstract-flow-construct, "http://www.mulesoft.org/schema/mule/core":flow, "http://www.mulesoft.org/schema/mule/core":sub-flow,  "http://www.mulesoft.org/schema/mule/core":abstract-model, "http://www.mulesoft.org/schema/mule/core":abstract-interceptor-stack, "http://www.mulesoft.org/schema/mule/core":abstract-filter,  "http://www.mulesoft.org/schema/mule/core":abstract-transformer, "http://www.mulesoft.org/schema/mule/core":processor-chain, "http://www.mulesoft.org/schema/mule/core":custom-processor,  "http://www.mulesoft.org/schema/mule/core":abstract-empty-processor, "http://www.mulesoft.org/schema/mule/core":invoke,  "http://www.mulesoft.org/schema/mule/core":set-payload, "http://www.mulesoft.org/schema/mule/core":abstract-global-intercepting-message-processor,  "http://www.mulesoft.org/schema/mule/core":custom-queue-store, "http://www.mulesoft.org/schema/mule/core":abstract-processing-strategy}' expected. (org.mule.api.lifecycle.initialisationexception) 

my api.xml file:

<?xml version="1.0" encoding="utf-8"?> <mule xmlns:db="http://www.mulesoft.org/schema/mule/db" xmlns:vm="http://www.mulesoft.org/schema/mule/vm" xmlns:dw="http://www.mulesoft.org/schema/mule/ee/dw" xmlns="http://www.mulesoft.org/schema/mule/core"  xmlns:apikit="http://www.mulesoft.org/schema/mule/apikit"  xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"  xmlns:http="http://www.mulesoft.org/schema/mule/http"  xmlns:spring="http://www.springframework.org/schema/beans"  xmlns:tracking="http://www.mulesoft.org/schema/mule/ee/tracking"  xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"  xsi:schemalocation="http://www.mulesoft.org/schema/mule/db http://www.mulesoft.org/schema/mule/db/current/mule-db.xsd                      http://www.mulesoft.org/schema/mule/vm http://www.mulesoft.org/schema/mule/vm/current/mule-vm.xsd                      http://www.mulesoft.org/schema/mule/ee/dw http://www.mulesoft.org/schema/mule/ee/dw/current/dw.xsd                      http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd                      http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd                      http://www.mulesoft.org/schema/mule/apikit http://www.mulesoft.org/schema/mule/apikit/current/mule-apikit.xsd                      http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.1.xsd                      http://www.mulesoft.org/schema/mule/ee/tracking http://www.mulesoft.org/schema/mule/ee/tracking/current/mule-tracking-ee.xsd">   <apikit:config consoleenabled="true" consolepath="console" doc:name="router" name="api-config" raml="api.raml">     <apikit:flow-mapping action="get" flow-ref="get:/munit:api-config" resource="/munit"/>     <apikit:flow-mapping action="post" flow-ref="post:/munit:api-config" resource="/munit"/>     <apikit:flow-mapping action="put" flow-ref="put:/munit:api-config" resource="/munit"/>     <apikit:flow-mapping action="delete" flow-ref="delete:/munit:api-config" resource="/munit"/> </apikit:config>      <!-- configure data source bean --> <spring:beans>     <spring:bean id="dbwebdatasource" class="org.apache.commons.dbcp.basicdatasource">         <spring:property name="driverclassname" value="oracle.jdbc.driver.oracledriver"/>         <spring:property name="url"             value="jdbc:oracle:thin:@server:1111:db"/>         <spring:property name="username"        value="xxxx"/>         <spring:property name="password"         value="xxxx"/>         <spring:property name="initialsize"     value="1"/>         <spring:property name="maxactive"       value="3"/>     </spring:bean> </spring:beans>  <db:oracle-config name="dbweb" datasource-ref="dbwebdatasource" doc:name="dbweb configuration"/>  <http:listener-config doc:name="http listener configuration" host="0.0.0.0" name="http_listener_configuration" port="9090"/>  <apikit:mapping-exception-strategy name="api-apikitglobalexceptionmapping">     <apikit:mapping statuscode="404">         <apikit:exception value="org.mule.module.apikit.exception.notfoundexception"/>         <set-property doc:name="property" propertyname="content-type" value="application/json"/>         <set-payload doc:name="set payload" value="{ &quot;message&quot;: &quot;resource not found&quot; }"/>     </apikit:mapping>     <apikit:mapping statuscode="405">         <apikit:exception value="org.mule.module.apikit.exception.methodnotallowedexception"/>         <set-property doc:name="property" propertyname="content-type" value="application/json"/>         <set-payload doc:name="set payload" value="{ &quot;message&quot;: &quot;method not allowed&quot; }"/>     </apikit:mapping>     <apikit:mapping statuscode="415">         <apikit:exception value="org.mule.module.apikit.exception.unsupportedmediatypeexception"/>         <set-property doc:name="property" propertyname="content-type" value="application/json"/>         <set-payload doc:name="set payload" value="{ &quot;message&quot;: &quot;unsupported media type&quot; }"/>     </apikit:mapping>     <apikit:mapping statuscode="406">         <apikit:exception value="org.mule.module.apikit.exception.notacceptableexception"/>         <set-property doc:name="property" propertyname="content-type" value="application/json"/>         <set-payload doc:name="set payload" value="{ &quot;message&quot;: &quot;not acceptable&quot; }"/>     </apikit:mapping>     <apikit:mapping statuscode="400">         <apikit:exception value="org.mule.module.apikit.exception.badrequestexception"/>         <set-property doc:name="property" propertyname="content-type" value="application/json"/>         <set-payload doc:name="set payload" value="{ &quot;message&quot;: &quot;bad request&quot; }"/>     </apikit:mapping> </apikit:mapping-exception-strategy>  <flow name="api-main">     <http:listener config-ref="http_listener_configuration" doc:name="http" path="api/*"/>      <apikit:router config-ref="api-config" doc:name="apikit router"/>     <exception-strategy doc:name="reference exception strategy" ref="api-apikitglobalexceptionmapping"/> </flow>  <flow name="put:/munit:api-config">     <set-payload doc:name="set payload" value="#['put response']"/> </flow>  <flow name="delete:/munit:api-config">      <set-payload doc:name="set payload" value="#['delete response']"/> </flow>  <flow name="post:/munit:api-config">      <set-payload doc:name="set payload" value="#['post response']"/> </flow>  <flow name="get:/munit:api-config">      <vm:inbound-endpoint exchange-pattern="request-response" path="servicea" doc:name="service a"/>      <db:select config-ref="dbweb" doc:name="select items">         <db:parameterized-query><![cdata[${sql.dbweb.select.items}]]></db:parameterized-query>     </db:select> </flow> 

my api-test-suite.xml file:

<?xml version="1.0" encoding="utf-8"?>  <mule xmlns:http="http://www.mulesoft.org/schema/mule/http"   xmlns="http://www.mulesoft.org/schema/mule/core"    xmlns:doc="http://www.mulesoft.org/schema/mule/documentation"    xmlns:munit="http://www.mulesoft.org/schema/mule/munit"    xmlns:spring="http://www.springframework.org/schema/beans"    xmlns:core="http://www.mulesoft.org/schema/mule/core"    xmlns:xsi="http://www.w3.org/2001/xmlschema-instance"    xsi:schemalocation="http://www.mulesoft.org/schema/mule/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd                       http://www.mulesoft.org/schema/mule/munit http://www.mulesoft.org/schema/mule/munit/current/mule-munit.xsd                       http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-current.xsd                       http://www.mulesoft.org/schema/mule/core http://www.mulesoft.org/schema/mule/core/current/mule.xsd">  <munit:config doc:name="munit configuration" mock-connectors="false" mock-inbounds="false"/> <spring:beans>     <spring:import resource="classpath:api.xml"/> </spring:beans> <http:request-config name="http_request_configuration" host="localhost" port="9090" basepath="api" doc:name="http request configuration"> </http:request-config>  <munit:test name="api-test-get" description="test">     <munit:set payload="#['']" doc:name="set message"/>     <http:request config-ref="http_request_configuration" path="/munit" method="get" doc:name="http"/>     <object-to-string-transformer doc:name="object string"/>     <munit:assert-on-equals message="the http status code not correct!" expectedvalue="#[200]" actualvalue="#[message.inboundproperties['http.status']]" doc:name="assert equals"/>     <munit:assert-payload-equals message="the response payload not correct!" expectedvalue="&quot;get response&quot;" doc:name="assert payload"/> </munit:test>  <munit:test name="api-test-post" description="test">     <munit:set payload="#['']" doc:name="set message"/>     <http:request config-ref="http_request_configuration" path="/munit" method="post" doc:name="http"/>     <object-to-string-transformer doc:name="object string"/>     <munit:assert-on-equals message="the http status code not correct!" expectedvalue="#[201]" actualvalue="#[message.inboundproperties['http.status']]" doc:name="assert equals"/>     <munit:assert-payload-equals message="the response payload not correct!" expectedvalue="&quot;post response&quot;" doc:name="assert payload"/> </munit:test>  <munit:test name="api-test-put" description="test">     <munit:set payload="#['']" doc:name="set message"/>     <http:request config-ref="http_request_configuration" path="/munit" method="put" doc:name="http"/>     <object-to-string-transformer doc:name="object string"/>     <munit:assert-on-equals message="the http status code not correct!" expectedvalue="#[201]" actualvalue="#[message.inboundproperties['http.status']]" doc:name="assert equals"/>     <munit:assert-payload-equals message="the response payload not correct!" expectedvalue="&quot;put response&quot;" doc:name="assert payload"/> </munit:test>  <munit:test name="api-test-delete" description="test">     <munit:set payload="#['']" doc:name="set message"/>     <http:request config-ref="http_request_configuration" path="/munit" method="delete" doc:name="http"/>     <object-to-string-transformer doc:name="object string"/>     <munit:assert-on-equals message="the http status code not correct!" expectedvalue="#[200]" actualvalue="#[message.inboundproperties['http.status']]" doc:name="assert equals"/>     <munit:assert-payload-equals message="the response payload not correct!" expectedvalue="&quot;delete response&quot;" doc:name="assert payload"/> </munit:test> 

i don't know version of mule using assume recent one.

often problem related invalid content when running maven test due missing maven dependency.

in fact of module provided, means present on mule if not in pom application run on standalone server , if deployed. not true when running tests, mule server used in maven tests lightweight 1 without batteries included need specify dependencies.

so short answer probally missing dependency on pom:

<dependency>     <groupid>org.mule.modules</groupid>     <artifactid>mule-module-db</artifactid>     <version>${mule.version}</version>     <scope>provided</scope> </dependency> 

anyway completeness please not oracle configuration has been deprecated , should use instead generic db configuration.

<db:generic-config name="generic_database_configuration" doc:name="generic database configuration" url="asdasdasd"/> 

anyway if still want use deprecated configuration , running mule enterprise edition should note in latest version part of mule-transport-jdbc-ee module therefore in pom should have dependency

<dependency>     <groupid>com.mulesoft.muleesb.transports</groupid>     <artifactid>mule-transport-jdbc-ee</artifactid>     <version>${mule.version}</version>     <scope>provided</scope> </dependency> 

and xml conf like

<jdbc-ee:oracle-data-source name="oracle_data_source" password="" url="jdbc:oracle:thin:@//localhost:1521/[instancename]" transactionisolation="unspecified" doc:name="oracle data source"/> 

hope helps.


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

c - Unrecognised emulation mode: elf_i386 on MinGW32 -