title: Spring @Autowired not working - BeanCreationException
body: <p>When I try to deploy file on server error occurs. I'm confused, because this code  was working.</p>
  
  <p><strong>Exception</strong></p>
  
  <pre><code>    Failed to enable lec2ear-1.0.ear.
  
  Unexpected HTTP response: 500
  
  Request
  {
      "address" =&gt; [("deployment" =&gt; "lecture_7")],
      "operation" =&gt; "deploy"
  }
  
  Response
  
  Internal Server Error
  {
      "outcome" =&gt; "failed",
      "failure-description" =&gt; {"JBAS014671: Failed services" =&gt; {"jboss.undertow.deployment.default-server.default-host./mart-parent" =&gt; "org.jboss.msc.service.StartException in service jboss.undertow.deployment.default-server.default-host./mart-parent: Failed to start service
      Caused by: java.lang.RuntimeException: org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'storageController': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ru.menkin.ea.lec4.model.services.ICategoryService ru.menkin.ea.lec5.controllers.StorageController._categoryService; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoryService': Injection of autowired dependencies failed; nested exception is org.springframework.beans.factory.BeanCreationException: Could not autowire field: private ru.menkin.ea.lec4.model.repositories.CategoryRepository ru.menkin.ea.lec4.model.services.CategoryService.categoryRepository; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'categoryRepository': Cannot resolve reference to bean 'jpaMappingContext' while setting bean property 'mappingContext'; nested exception is org.springframework.beans.factory.BeanCreationException: Error creating bean with name 'jpaMappingContext': Invocation of init method failed; nested exception is javax.persistence.PersistenceException: Exception [EclipseLink-4002] (Eclipse Persistence Services - 2.5.1.v20130918-f2b9fc5): org.eclipse.persistence.exceptions.DatabaseException
  Internal Exception: java.sql.SQLException: javax.resource.ResourceException: IJ000453: Unable to get managed connection for java:jboss/recipeDs
  Error Code: 0
  </code></pre>
  
  <p><strong>ICategoryService</strong></p>
  
  <pre><code>public interface ICategoryService
  {
      public Category create(Category category);
      public Category delete(int id) throws Exception;
      public List&lt;Category&gt; findAll();
      public Category update(Category category) throws Exception;
      public Category findById(int id);
  }
  </code></pre>
  
  <p><strong>his implementation</strong></p>
  
  <pre><code>public class CategoryService implements ICategoryService
  {
      @Autowired
      private CategoryRepository categoryRepository;
  ...
  </code></pre>
  
  <p><strong>Controller</strong></p>
  
  <pre><code>@Controller
  @RequestMapping(value = "/rest")
  public class StorageController extends BaseController {
      @Autowired
      @Qualifier("categoryService")
      private ICategoryService _categoryService;
  ...
  </code></pre>
  
  <p><strong>database.xml</strong></p>
  
  <pre><code>&lt;djpa:repositories base-package="ru.menkin.ea.lec4.model" /&gt;
  
  &lt;bean id="categoryService" class="ru.menkin.ea.lec4.model.services.CategoryService" /&gt;
  </code></pre>
  
  <p><strong>beans.xml</strong></p>
  
  <pre><code>&lt;context:annotation-config /&gt;
  &lt;context:component-scan base-package="ru.menkin.ea" /&gt;
  </code></pre>
  
  <p>Where my mistake?</p>