0

I am preparing maven for building mule application which contains munits. I am getting below error when i "mvn package" the application.

WARN 2016-11-11 09:35:32,415 [main] org.springframework.beans.factory.xml.XmlBeanDefinitionReader: Ignored XML validation warning org.xml.sax.SAXParseException: schema_reference.4: Failed to read schema document 'http://www.mulesoft.org/schema/mule/ws/current/mule-ws.xsd', because 1) could not find the document; 2) the document could not be read; 3) the root element of the document is not . at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source) ~[xercesImpl-2.8.0.jar:?] at org.apache.xerces.util.ErrorHandlerWrapper.warning(Unknown Source) ~[xercesImpl-2.8.0.jar:?]

[ERROR] Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test (test) on project api-system-plm-material: Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: Line 19 in XML document from URL [file:/D:/Mule-Workspace-28thOct/myapplication/target/test-classes/myapplication_flow1.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 105; cvc-complex-type.2.4.a: Invalid content was found starting with element 'ws:consumer-config'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":description, "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}' is expected. (org.mule.api.lifecycle.InitialisationException) -> [Help 1] org.apache.maven.lifecycle.LifecycleExecutionException: Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test (test) on project api-system-plm-material: Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: Line 19 in XML document from URL [file:/D:/Mule-Workspace-28thOct/myapplication/target/test-classes/myapplication_flow1.xml] is invalid; nested exception is org.xml.sax.SAXParseException; lineNumber: 19; columnNumber: 105; cvc-complex-type.2.4.a: Invalid content was found starting with element 'ws:consumer-config'. One of '{"http://www.mulesoft.org/schema/mule/core":annotations, "http://www.mulesoft.org/schema/mule/core":description, "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}' is expected. (org.mule.api.lifecycle.InitialisationException) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:212)

The flow xml it is referring to is:

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 http://www.mulesoft.org/schema/mule/ws http://www.mulesoft.org/schema/mule/ws/current/mule-ws.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/http http://www.mulesoft.org/schema/mule/http/current/mule-http.xsd">

<ws:consumer-config name="Web_Service_Consumer" service="Mat_RFCService" port="MAT_RFC" 
  serviceAddress="${service.address}" 
  wsdlLocation="MAT_WSDL.wsdl" doc:name="Web Service Consumer" connectorConfig="MAT-HTTP-Endpoint"/>

Below is my pom.xml:

<modelVersion>4.0.0</modelVersion>
 <groupId>com.mycompany</groupId>
 <artifactId>myapplication</artifactId>
 <version>1.0.0-SNAPSHOT</version>
 <packaging>mule</packaging>
 <name>Mule myapplication Application</name>
 <properties>
     <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
     <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
     <mule.version>3.8.1</mule.version>
     <mule.tools.version>1.2</mule.tools.version>
     <munit.version>1.2.1</munit.version>
     <mule.munit.support.version>3.8.0</mule.munit.support.version>
     <!-- This is the domain where the app will be 
     deployed: i.e. mydomain.cloudhub.io -->
     <cloudhub.domain>mydomain</cloudhub.domain>
 </properties>
 <build>
     <plugins>
     <plugin>
       <groupId>org.mule.tools.maven</groupId>
       <artifactId>mule-maven-plugin</artifactId>
       <version>2.1.1</version>
       <!-- <configuration>
             <deploymentType>standalone</deploymentType>
             <muleVersion>${mule.version}</muleVersion>
         </configuration> -->
         <configuration>
             <deploymentType>cloudhub</deploymentType>
             <muleVersion>3.8.2</muleVersion>
             <username>username</username>
             <password>mypassword</password>
              <applicationName>myapplication-maven-1.0</applicationName>
              <!-- <businessGroup>engineering\devops</businessGroup> -->
             <target>CloudHub</target>
             <!-- One of: server, serverGroup, cluster -->
             <domain>${cloudhub.domain}</domain>
             <targetType>server</targetType>
             <environment>DEVELOPMENT</environment>
         </configuration>
         <executions>
             <execution>
                 <id>deploy</id>
                 <phase>deploy</phase>
                 <goals>
                     <goal>deploy</goal>
                 </goals>
             </execution>
         </executions>
     </plugin>
        <plugin>
                <groupId>org.mule.tools.maven</groupId>
                <artifactId>mule-app-maven-plugin</artifactId>
                <version>${mule.tools.version}</version>
                <extensions>true</extensions>
                <configuration>
                    <copyToAppsDirectory>true</copyToAppsDirectory>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>build-helper-maven-plugin</artifactId>
                <version>1.7</version>
                <executions>
                    <execution>
                        <id>add-resource</id>
                        <phase>generate-resources</phase>
                        <goals>
                            <goal>add-resource</goal>
                        </goals>
                        <configuration>
                            <resources>
                                <resource>
                                    <directory>src/main/app/</directory>
                                </resource>
                                <resource>
                                    <directory>mappings/</directory>
                                </resource>
                            <resource>
                                    <directory>src/main/api/</directory>
                                </resource>
                            </resources>
                        </configuration>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.mule.tools</groupId>
                <artifactId>maven-mule-plugin</artifactId>
                <extensions>true</extensions>
                <configuration>
                    <excludeMuleDependencies>false</excludeMuleDependencies>
                    <inclusions>
                        <inclusion>
                            <groupId>org.mule.modules</groupId>
                            <artifactId>mule-module-objectstore</artifactId>
                        </inclusion>
                    </inclusions>
                </configuration>
            </plugin>
        <plugin>
                <groupId>com.mulesoft.munit.tools</groupId>
                <artifactId>munit-maven-plugin</artifactId>
                <version>${munit.version}</version>
                <executions>
                    <execution>
                        <id>test</id>
                        <phase>test</phase>
                        <goals>
                            <goal>test</goal>
                        </goals>
                    </execution>
                </executions>
                <configuration>
                    <coverage>
                        <runCoverage>true</runCoverage>
                        <formats>
                            <format>html</format>
                        </formats>
                    </coverage>
                </configuration>
            </plugin>
        </plugins>
        <testResources>
            <testResource>
                <directory>src/test/munit</directory>
            </testResource>
        <testResource>
                <directory>src/test/resources</directory>
            </testResource>
        </testResources>
    </build>

    <!-- Mule Dependencies -->
    <dependencies>
        <!-- Xml configuration -->
        <dependency>
            <groupId>com.mulesoft.muleesb</groupId>
            <artifactId>mule-core-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Xml configuration -->
        <dependency>
            <groupId>com.mulesoft.muleesb.modules</groupId>
            <artifactId>mule-module-spring-config-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Mule Transports -->
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-file</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-http</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.muleesb.transports</groupId>
            <artifactId>mule-transport-jdbc-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>com.mulesoft.muleesb.transports</groupId>
            <artifactId>mule-transport-jms-ee</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.transports</groupId>
            <artifactId>mule-transport-vm</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- Mule Modules -->
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-scripting</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-xml</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
        <!-- for testing -->
        <dependency>
            <groupId>org.mule.tests</groupId>
            <artifactId>mule-tests-functional</artifactId>
            <version>${mule.version}</version>
            <scope>test</scope>
        </dependency>
    <dependency>
            <groupId>org.mule.modules</groupId>
            <artifactId>mule-module-apikit</artifactId>
            <version>${mule.version}</version>
            <scope>provided</scope>
        </dependency>
    <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>mule-munit-support</artifactId>
            <version>${mule.munit.support.version}</version>
            <scope>test</scope>
        </dependency>
    <dependency>
            <groupId>com.mulesoft.munit</groupId>
            <artifactId>munit-runner</artifactId>
            <version>${munit.version}</version>
            <scope>test</scope>
        </dependency>
    <dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-objectstore</artifactId>
        <version>1.3.0</version>
    </dependency>
    <!-- https://mvnrepository.com/artifact/org.mule.modules/mule-module-spring-extras -->
    <dependency>
        <groupId>org.mule.modules</groupId>
        <artifactId>mule-module-spring-extras</artifactId>
        <version>3.8.1</version>
    </dependency>

    </dependencies>

    <repositories>
          <repository>
            <id>Central</id>
            <name>Central</name>
            <url>http://repo1.maven.org/maven2/</url>
            <layout>default</layout>
        </repository>
        <repository>
            <id>mulesoft-releases</id>
            <name>MuleSoft Releases Repository</name>
            <url>http://repository.mulesoft.org/releases/</url>
            <layout>default</layout>
        </repository>
    </repositories>
    <pluginRepositories>
        <pluginRepository>
            <id>mulesoft-release</id>
            <name>mulesoft release repository</name>
            <layout>default</layout>
            <url>http://repository.mulesoft.org/releases/</url>
            <snapshots>
                <enabled>false</enabled>
            </snapshots>
        </pluginRepository>
    </pluginRepositories>

</project>

Any clues will be of great help.

Edit:

After adding dependency as indicated by Dds, i am now caught with the below error: [ERROR] Failed to execute goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test (test) on project myapplication: Execution test of goal com.mulesoft.munit.tools:munit-maven-plugin:1.2.1:test failed: org.mule.api.config.ConfigurationException: Configuration problem: Failed to import bean definitions from URL location [classpath:myapplication-get-id.xml] [ERROR] Offending resource: URL [file:/D:/RamG/Eclipses/Workspaces/Mule-Workspace-28thOct/myapplication/target/test-classes/myapplication-apikit-test.xml]; nested exception is org.springframework.beans.factory.BeanDefinitionStoreException: Unexpected exception parsing XML document from class path resource [myapplication-get-id.xml]; nested exception is org.springframework.beans.FatalBeanException: Invalid NamespaceHandler class [com.mulesoft.weave.mule.config.WeaveNamespaceHandler] for namespace [http://www.mulesoft.org/schema/mule/ee/dw]: problem with handler class file or dependent class; nested exception is java.lang.NoClassDefFoundError: scala/Option (org.mule.api.lifecycle.InitialisationException): scala.Option [ERROR] -> [Help 1] When i browsed for information, i see that one more SO question was posted but not answered. It is referring to dataweave + scala/Option which is same as the error i am getting.

For some reason this dataweave component does not get fully downloaded, particularly the jar file is not downloaded. After some exercise, i have downloaded and copied to the respective .m2 folder manually. But following that i see the above error. So, it either has some dependencies which are not resolved like 'scala/Option"!! I am not sure.

Thanks

Gana
  • 482
  • 3
  • 11
  • 32

1 Answers1

1

Hi there those kind of errors when running from Maven usually indicates a missing dependency in your pom file.

The one containing the web service consumer should be:

<dependency>
  <groupId>org.mule.modules</groupId>
  <artifactId>mule-module-ws</artifactId>
  <version>${mule.version}</version>
  <scope>provided</scope>
</dependency>

Please add that one to you pom and give it a try. HTH

Dds
  • 712
  • 5
  • 7
  • That's really helped me. I will mark as answered. The issue continued with another error: `[DEBUG] BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext java.lang.IllegalStateException: BeanFactory not initialized or already closed - call 'refresh' before accessing beans via the ApplicationContext`. Can you tell me what is this dependency or issue referring to? Thanks – Gana Nov 14 '16 at 06:51
  • 1
    That doesn't look like a missing dependency, but rather like an issue with the mule app/munit test config files. I've not idea really with only that stack trace. I'll advice you to open another question and to try and scope out the issue. It could be that you're loading your app partially (in the spring import) and something may be missing – Dds Nov 14 '16 at 12:30