Results 1 to 5 of 5

Thread: importing application context file from jar

  1. #1

    Default importing application context file from jar

    Hi,

    I am referencing a bean which is residing in the jar given in the classpath.
    So I have imported the .xml file only in my config file. But I am getting the below error.
    Please help.

    Code:
    ..............
    <beans:import resource="classpath:spring/applicationContext-services-.xml" />
    .....
    <beans:bean id="accntManager" class="com.test.impl.AccountManagerImpl">		
    		<beans:property name="localCardManager" ref="localCardMngrRef"/>
    	</beans:bean>
    Error stacktrace:-
    Code:
    org.springframework.beans.factory.xml.XmlBeanDefinitionStoreException: Line 42 in XML document from class path resour
    ce [counterJob.xml] is invalid; nested exception is org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matchi
    ng wildcard is strict, but no declaration can be found for element 'property'.
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReade
    r.java:404)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.
    java:342)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.loadBeanDefinitions(XmlBeanDefinitionReader.
    java:310)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDef
    initionReader.java:143)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDef
    initionReader.java:178)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDef
    initionReader.java:149)
            at org.springframework.beans.factory.support.AbstractBeanDefinitionReader.loadBeanDefinitions(AbstractBeanDef
    initionReader.java:212)
            at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicati
    onContext.java:113)
            at org.springframework.context.support.AbstractXmlApplicationContext.loadBeanDefinitions(AbstractXmlApplicati
    onContext.java:80)
            at org.springframework.context.support.AbstractRefreshableApplicationContext.refreshBeanFactory(AbstractRefre
    shableApplicationContext.java:123)
            at org.springframework.context.support.AbstractApplicationContext.obtainFreshBeanFactory(AbstractApplicationC
    ontext.java:422)
            at org.springframework.context.support.AbstractApplicationContext.refresh(AbstractApplicationContext.java:352
    )
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.j
    ava:139)
            at org.springframework.context.support.ClassPathXmlApplicationContext.<init>(ClassPathXmlApplicationContext.j
    ava:83)
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.start(CommandLineJobRunner.java:190)
            at org.springframework.batch.core.launch.support.CommandLineJobRunner.main(CommandLineJobRunner.java:254)
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
            at java.lang.reflect.Method.invoke(Method.java:585)
            at org.codehaus.mojo.exec.ExecJavaMojo$1.run(ExecJavaMojo.java:271)
            at java.lang.Thread.run(Thread.java:595)
    Caused by: org.xml.sax.SAXParseException: cvc-complex-type.2.4.c: The matching wildcard is strict, but no declaration
     can be found for element 'property'.
            at org.apache.xerces.parsers.DOMParser.parse(DOMParser.java:267)
            at org.apache.xerces.jaxp.DocumentBuilderImpl.parse(DocumentBuilderImpl.java:201)
            at org.springframework.beans.factory.xml.DefaultDocumentLoader.loadDocument(DefaultDocumentLoader.java:75)
            at org.springframework.beans.factory.xml.XmlBeanDefinitionReader.doLoadBeanDefinitions(XmlBeanDefinitionReade
    r.java:396)
            ... 21 more

  2. #2
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    Pretty clear imho... You haven't declared the beans namespace as root so there is somewhere a <property in your xml file which should be <beansroperty...
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  3. #3

    Default

    Thanx Marten for your quick response.
    Yes. there was a property without a bean.

    Actually I am confused what is the difference between these two:
    1. beansroperty
    2. property

  4. #4
    Join Date
    Jun 2006
    Location
    The Netherlands
    Posts
    13,632

    Default

    i suggest reading something about xml and how it works.

    if you have defined beans as the root element you don't need to prefix your elements with beans: if you have something als defined as your root namespace (like security for instance) you need to prefix all y our other elements not residing in the root namespace.
    Marten Deinum
    Java Consultant / Pragmatist / Open Source Enthousiast / Author


    Pro Spring MVC: With Web Flow
    Conspect

    Have you read the reference guide.
    Use the [ code ] tags, young padawan

  5. #5

    Default

    OK. Got it.
    Thank you.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •