title: The XMLInputFactory does not recognize the property "reuse-instance" : Spring MVC, JUnit, RAD & Web sphere server
body: <p>I have a <code>Spring MVC project(contains Controller &amp; jsp files)</code> and <code>DAO project(Contains DB operation related files)</code> &amp; both the project are configured using annotations. MVC project depends on DAO project. Now, I am writing JUnit test for MVC and DAO projects. Hence I have created a separate 'Test project' in which I have added MVC project as dependency<code>(Java Build Path -&gt; Projects tab -&gt; Add -&gt; MVC Project &amp; ok)</code> and included all needed jar files (JUnit &amp; spring-test.jar). I am using <code>RAD IDE, Spring 3, JUnit4 &amp; Websphere application server (version 7)</code>.  </p>
  
  <p>My project structure:  </p>
  
  <pre><code>MVCProject (Depends on DAOProject --&gt; Web App project)
      |
       WebContent
          |
           WEB-INF
              |
               spring-context.xml
  
  DAOProject (Java project)
      |
       src  
  
  
  TestProject(Depends on MVCProject --&gt; Java project)
      |
       src 
          |
           com.xyz.dao.test
              |
               DAOImplTest.java
          |
           config
              |
               test-spring-context.xml
  </code></pre>
  
  <p>I copied contents of spring-context.xml file into test-spring-context.xml.
  Below is my JUnit test project code,  </p>
  
  <pre><code>@RunWith(SpringJUnit4ClassRunner.class)
  @ContextConfiguration(locations = {"classpath:config/test-spring-context.xml"})
  public class DAOImplTest {
  
      @Autowired
      private DAO dao;
  
      String id = null;
  
      /**
       * Test method for {@link com.xyz.core.dao.DAOImpl#getById(java.lang.String)}.
       */
      @Test
      public void testGetById() {
  
          id = "Test12345";
          try {
              dao.getById(id);
          } catch (Exception e) {         
              e.printStackTrace();
          }
      }
  }  
  </code></pre>
  
  <p>I am getting following error when try to run test case (<code>The XMLInputFactory does not recognize the property "reuse-instance"</code>).  </p>
  
  <pre><code>Caused by: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'imageHandler' defined in file [D:\Workspace\MVCProjectName\WebContent\WEB-INF\classes\com\xyz\web\webservice\ImageHandlerImpl.class]: Instantiation of bean failed; nested exception is org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xyz.webservice.ImageHandlerImpl]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: The XMLInputFactory does not recognize the property "reuse-instance".
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:965)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBeanInstance(AbstractAutowireCapableBeanFactory.java:911)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.doCreateBean(AbstractAutowireCapableBeanFactory.java:485)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.createBean(AbstractAutowireCapableBeanFactory.java:456)
      at org.springframework.beans.factory.support.AbstractBeanFactory$1.getObject(AbstractBeanFactory.java:291)
      at org.springframework.beans.factory.support.DefaultSingletonBeanRegistry.getSingleton(DefaultSingletonBeanRegistry.java:222)
      at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:288)
      at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:194)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.autowireResource(CommonAnnotationBeanPostProcessor.java:435)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.getResource(CommonAnnotationBeanPostProcessor.java:409)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor$ResourceElement.getResourceToInject(CommonAnnotationBeanPostProcessor.java:541)
      at org.springframework.beans.factory.annotation.InjectionMetadata$InjectedElement.inject(InjectionMetadata.java:147)
      at org.springframework.beans.factory.annotation.InjectionMetadata.inject(InjectionMetadata.java:84)
      at org.springframework.context.annotation.CommonAnnotationBeanPostProcessor.postProcessPropertyValues(CommonAnnotationBeanPostProcessor.java:297)
      ... 64 more
  Caused by: org.springframework.beans.BeanInstantiationException: Could not instantiate bean class [com.xyz.webservice.ImageHandlerImpl]: Constructor threw exception; nested exception is java.lang.IllegalArgumentException: The XMLInputFactory does not recognize the property "reuse-instance".
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:141)
      at org.springframework.beans.factory.support.SimpleInstantiationStrategy.instantiate(SimpleInstantiationStrategy.java:74)
      at org.springframework.beans.factory.support.AbstractAutowireCapableBeanFactory.instantiateBean(AbstractAutowireCapableBeanFactory.java:958)
      ... 77 more
  Caused by: java.lang.IllegalArgumentException: The XMLInputFactory does not recognize the property "reuse-instance".
      at com.ibm.xml.xlxp.api.stax.msg.StAXMessageProvider.throwIllegalArgumentException(StAXMessageProvider.java:42)
      at com.ibm.xml.xlxp.api.stax.XMLInputFactoryImpl.setProperty(XMLInputFactoryImpl.java:1870)
      at org.apache.axiom.util.stax.dialect.SJSXPDialect.makeThreadSafe(SJSXPDialect.java:65)
      at org.apache.axiom.om.util.StAXUtils$8.run(StAXUtils.java:544)
      at java.security.AccessController.doPrivileged(AccessController.java:229)
      at org.apache.axiom.om.util.StAXUtils.newXMLInputFactory(StAXUtils.java:517)
      at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory_perClassLoader(StAXUtils.java:588)
      at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:171)
      at org.apache.axiom.om.util.StAXUtils.getXMLInputFactory(StAXUtils.java:136)
      at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:223)
      at org.apache.axiom.om.util.StAXUtils.createXMLStreamReader(StAXUtils.java:217)
      at org.apache.axis2.util.XMLUtils.toOM(XMLUtils.java:555)
      at org.apache.axis2.deployment.DescriptionBuilder.buildOM(DescriptionBuilder.java:93)
      at org.apache.axis2.deployment.AxisConfigBuilder.populateConfig(AxisConfigBuilder.java:76)
      at org.apache.axis2.deployment.DeploymentEngine.populateAxisConfiguration(DeploymentEngine.java:640)
      at org.apache.axis2.deployment.FileSystemConfigurator.getAxisConfiguration(FileSystemConfigurator.java:105)
      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContext(ConfigurationContextFactory.java:60)
      at org.apache.axis2.context.ConfigurationContextFactory.createConfigurationContextFromFileSystem(ConfigurationContextFactory.java:174)
      at org.apache.axis2.jaxws.ClientConfigurationFactory.getClientConfigurationContext(ClientConfigurationFactory.java:51)
      at org.apache.axis2.jaxws.description.impl.DescriptionFactoryImpl.createServiceDescription(DescriptionFactoryImpl.java:74)
      at org.apache.axis2.jaxws.description.DescriptionFactory.createServiceDescription(DescriptionFactory.java:67)
      at org.apache.axis2.jaxws.spi.ServiceDelegate.&lt;init&gt;(ServiceDelegate.java:84)
      at org.apache.axis2.jaxws.spi.Provider.createServiceDelegate(Provider.java:45)
      at javax.xml.ws.Service.&lt;init&gt;(Service.java:57)
      at com.xyz.handler.broker.ImageHandlerService.&lt;init&gt;(ImageHandlerService.java:39)
      at com.xyz.handler.broker.ImageHandlerProxy$Descriptor.&lt;init&gt;(ImageHandlerProxy.java:21)
      at com.xyz.handler.broker.ImageHandlerProxy.&lt;init&gt;(ImageHandlerProxy.java:69)
      at com.xyz.webservice.ImageHandlerImpl.&lt;init&gt;(ImageHandlerImpl.java:30)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
      at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:80)
      at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:57)
      at java.lang.reflect.Constructor.newInstance(Constructor.java:539)
      at org.springframework.beans.BeanUtils.instantiateClass(BeanUtils.java:126)
      ... 79 more
  </code></pre>
  
  <p>Kindly help me resolving this issue.<br>
  Thanks in Advance.</p>