How to import spring configuration file in custom part

How to import spring configuration file in custom part

Dear Matthias,

In order working with database, I created entity and DAO files in custom part of my phishl7 project. For example, I created PatientInt entity and PatientIntRepository file.
I created the folder META-INF in custom folder and put the application-context.xml file, persistence.xml file there.

My problem is I don't know how to configure to make mule esb will initialize the spring bean in custom part when the project is started, then I can use @Autowired to use spring bean in MFN_M01Processor.

I went to workflow file: wf_phis_hl7.xml file and put: spring:import resource="classpath*:custom/META-INF/application-context.xml"

But there is error when the project is started:

Code:


org.xml.sax.SAXParseException: cvc-complex-type.2.4.a: Invalid content was found starting with element 'spring:import'. One 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-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-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":invoke, "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.
    at org.apache.xerces.util.ErrorHandlerWrapper.createSAXParseException(Unknown Source)
    at org.apache.xerces.util.ErrorHandlerWrapper.error(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.XMLErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator$XSIErrorReporter.reportError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.reportSchemaError(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.handleStartElement(Unknown Source)
    at org.apache.xerces.impl.xs.XMLSchemaValidator.emptyElement(Unknown Source)
    at org.apache.xerces.impl.XMLNSDocumentScannerImpl.scanStartElement(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl$FragmentContentDispatcher.dispatch(Unknown Source)
    at org.apache.xerces.impl.XMLDocumentFragmentScannerImpl.scanDocument(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XML11Configuration.parse(Unknown Source)
    at org.apache.xerces.parsers.XMLParser.parse(Unknown Source)
    at org.apache.xerces.parsers.DOMParser.parse(Unknown Source)
    at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(Unknown Source)
    at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReader.java:388)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:334)
    at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.java:302)
    at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDefinitionReader.java:174)
    at org.mule.config.spring.MuleApplicationContext.loadBeanDefinitions(MuleApplicationContext.java:112)
    at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefreshableApplicationContext.java:131)
    at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationContext.java:522)
    at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:436)
    at org.mule.config.spring.SpringRegistry.doInitialise(SpringRegistry.java:89)
    at org.mule.registry.AbstractRegistry.initialise(AbstractRegistry.java:109)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.createSpringRegistry(SpringXmlConfigurationBuilder.java:116)
    at org.mule.config.spring.SpringXmlConfigurationBuilder.doConfigure(SpringXmlConfigurationBuilder.java:73)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.config.builders.AutoConfigurationBuilder.autoConfigure(AutoConfigurationBuilder.java:101)
    at org.mule.config.builders.AutoConfigurationBuilder.doConfigure(AutoConfigurationBuilder.java:57)
    at org.mule.config.builders.AbstractConfigurationBuilder.configure(AbstractConfigurationBuilder.java:46)
    at org.mule.config.builders.AbstractResourceConfigurationBuilder.configure(AbstractResourceConfigurationBuilder.java:78)
    at org.mule.context.DefaultMuleContextFactory.createMuleContext(DefaultMuleContextFactory.java)
    at org.mule.module.launcher.application.DefaultMuleApplication.init(DefaultMuleApplication.java:208)
    at org.mule.module.launcher.application.ApplicationWrapper.init(ApplicationWrapper.java:64)
    at org.mule.module.launcher.DefaultMuleDeployer.deploy(DefaultMuleDeployer.java:46)
    at org.mule.module.launcher.DeploymentService.guardedDeploy(DeploymentService.java:398)
    at org.mule.module.launcher.DeploymentService.start(DeploymentService.java:181)
    at org.mule.module.launcher.MuleContainer.start(MuleContainer.java:157)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
    at java.lang.reflect.Method.invoke(Unknown Source)
    at org.mule.module.reboot.MuleContainerWrapper.start(MuleContainerWrapper.java:56)
    at org.tanukisoftware.wrapper.WrapperManager$12.run(WrapperManager.java:2788)

Please find my source code here

Thanks and best regards,
Dzung

Administrator has disabled public posting. Please login or register in order to proceed.

Re: How to import spring configuration file in custom part

Dear Dzung,

as far as I remember there is actually a possibility for mule to load spring beans, but you can't just put it anywhere in the file. Instead you have to stay in their XSD schema.

Unfortunately I can not download the file that you linked to from google. Just attach the configuration please, perhaps I can help you if I see the code. In any other case I'd like to refer you to the mule documentation. I'm almost certain they have a section about spring in there.

Best regards,
Matthias

Administrator has disabled public posting. Please login or register in order to proceed.

Re: How to import spring configuration file in custom part

Dear Matthias,

When you click to the google link of my source code, you can see the File in the top left corner, when you click File, you can see the Download file, then you can download the file, or you can use hotkey: CTRL + S

Please see my picture.


/images/agorapro/attachments/1195/mini_download-phishl7.png

Thanks and best regards,
Dzung

Administrator has disabled public posting. Please login or register in order to proceed.

Re: How to import spring configuration file in custom part

Dear Dzung,

I am actually aware of this, but the processing takes some time, so please just attach the files that we need directly to your post. This makes handling the requests easier.

I will have a look at it later one and let you know if I find anything.

Best regards,
Matthias

Administrator has disabled public posting. Please login or register in order to proceed.

Re: How to import spring configuration file in custom part

Dear Dzung,

here is the result you are looking for (from google):

http://forum.mulesoft.org/mulesoft/topi … config_xml

As I already said: this is mule specific, so please consult their documentation first, when you try to add custom code to the XML file.

Best regards,
Matthias

Administrator has disabled public posting. Please login or register in order to proceed.

Re: How to import spring configuration file in custom part

Dear Matthias,

Thank you for your link, I understand about the importing in mule esb now.

Thanks and best regards,
Dzung

Administrator has disabled public posting. Please login or register in order to proceed.

Board Info

Board Stats
 
Total Topics:
119
Total Polls:
0
Total Posts:
800
User Info
 
Total Users:
877
Newest User:
sramasam
Members Online:
0
Guests Online:
10

Online: 
There are no members online