title: Unable to inject resource - most probably incorrect InjectionServices SPI implementation CDI
body: <p>I am following one of the pluralsight tutorials about Java EE. But I encountered problem with testing my app with Arquillian. 
  Mayble github will help more (<a href="https://github.com/NoWishGranted/personal" rel="nofollow noreferrer">https://github.com/NoWishGranted/personal</a>)
  When I did run test case with eclipse i get following stack: </p>
  
  <pre><code>Jul 15, 2018 2:30:01 PM org.jboss.weld.bootstrap.WeldStartup &lt;clinit&gt;
  INFO: WELD-000900: 2.3.5 (Final)
  Jul 15, 2018 2:30:02 PM org.jboss.weld.injection.AbstractResourceInjection getResourceReference
  WARN: WELD-000834: Unable to inject resource - most probably incorrect InjectionServices SPI implementation: private javax.persistence.EntityManager com.personal.bookstore.repository.BookRepository.em
      at com.personal.bookstore.repository.BookRepository.em(BookRepository.java:0)
  </code></pre>
  
  <p>I suspect that i could have some errors with persistence.xml file, but I don't know if thats true or not. (I am using wildfly and h2 database)</p>
  
  <p>persistence.xml</p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt;
  &lt;persistence xmlns="http://java.sun.com/xml/ns/persistence"
      xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
      xsi:schemaLocation="http://java.sun.com/xml/ns/persistence
  http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
      version="2.0"&gt;
  
  
      &lt;persistence-unit name="bookStorePU" transaction-type="JTA"&gt;
          &lt;properties&gt;
              &lt;property
                  name="javax.persistence.schema-generation.database.action"
                  value="drop-and-create" /&gt;
              &lt;property
                  name="javax.persistence.schema-generation.scripts.action"
                  value="drop-and-create" /&gt;
              &lt;property
                  name="javax.persistence.schema-generation.scripts.create-target"
                  value="bookStoreCreate.ddl" /&gt;
              &lt;property
                  name="javax.persistence.schema-generation.scripts.drop-target"
                  value="bookStoreDrop.ddl" /&gt;
          &lt;/properties&gt;
      &lt;/persistence-unit&gt;
  &lt;/persistence&gt; 
  </code></pre>
  
  <p>Book model, without every possible mapping:</p>
  
  <pre><code>@Entity
  public class Book {
  
      @Id 
      @GeneratedValue(strategy = GenerationType.IDENTITY)
      private Long id;
  
      @Column(length=200)
      private String title;
  
      @Column(length=200)
      private String description;
  
      @Column(name="unit_cost")
      private Float unitCost;
  
      private String isbn;
  
      @Column(name="publication_date")
      @Temporal(TemporalType.DATE)
      private Date publicationDate;
  
      @Column(name="number_of_pages")
      private Integer numberOfPages;
  
      private String imageUrl;
  
      private Language language;
  
  
      public Book(){
      }
  
      public Long getId() {
          return id;
      }
  
      public void setId(Long id) {
          this.id = id;
      }
  
      public String getTitle() {
          return title;
      }
  
      public void setTitle(String title) {
          this.title = title;
      }
  
      public String getDescription() {
          return description;
      }
  
      public void setDescription(String description) {
          this.description = description;
      }
  
      public Float getUnitCost() {
          return unitCost;
      }
  
      public void setUnitCost(Float unitCost) {
          this.unitCost = unitCost;
      }
  
      public String getIsbn() {
          return isbn;
      }
  
      public void setIsbn(String isbn) {
          this.isbn = isbn;
      }
  
      public Date getPublicationDate() {
          return publicationDate;
      }
  
      public void setPublicationDate(Date publicationDate) {
          this.publicationDate = publicationDate;
      }
  
      public Integer getNumberOfPages() {
          return numberOfPages;
      }
  
      public void setNumberOfPages(Integer numberOfPages) {
          this.numberOfPages = numberOfPages;
      }
  
      public String getImageUrl() {
          return imageUrl;
      }
  
      public void setImageUrl(String imageUrl) {
          this.imageUrl = imageUrl;
      }
  
      public Language getLanguage() {
          return language;
      }
  
      public void setLanguage(Language language) {
          this.language = language;
      }
  
      @Override
      public String toString() {
          return "Book [id=" + id + ", title=" + title + ", description=" + description + ", unitCost=" + unitCost
                  + ", isbn=" + isbn + ", publicationDate=" + publicationDate + ", numberOfPages=" + numberOfPages
                  + ", imageUrl=" + imageUrl + ", language=" + language + "]";
      }
  }
  </code></pre>
  
  <p>BookRepository class</p>
  
  <pre><code>public class BookRepository {
  
      @PersistenceContext(unitName="bookStorePU")
      private EntityManager em;
  
      public Book find(Long id) {
          return em.find(Book.class, id);
      }
  
      @Transactional(TxType.REQUIRED)
      public Book create(Book book) {
          em.persist(book);
          return book;
      }
  
      @Transactional(TxType.REQUIRED)
      public void delete(Long id) {
          em.remove(em.getReference(Book.class, id));
      }
  
      public List&lt;Book&gt; findAll(){
          TypedQuery&lt;Book&gt; createQuery = em.createQuery("SELECT b from Book b order by b.title", Book.class);
          return createQuery.getResultList();
      }
  
      public Long countAll() {
          TypedQuery&lt;Long&gt; createQuery = em.createQuery("SELECT count(b) from Book b", Long.class);
          return createQuery.getSingleResult();
      }
  }
  </code></pre>
  
  <p>Test case class</p>
  
  <pre><code>@RunWith(Arquillian.class)
  public class BookRepositoryTest {
  
      @Inject
      private BookRepository bookRepository;
  
      @Test
      public void create() {
          assertEquals(Long.valueOf(0), bookRepository.countAll());
          assertEquals(Long.valueOf(0), bookRepository.findAll());
      }
  
      @Deployment
      public static JavaArchive createDeployment() {
          return ShrinkWrap.create(JavaArchive.class)
                  .addClass(BookRepository.class)
                  .addClass(Book.class)
                  .addClass(Language.class)
                  .addAsManifestResource(EmptyAsset.INSTANCE, "beans.xml");
      }
  
  }
  </code></pre>
  
  <p>pom dependecies</p>
  
  <pre><code>&lt;dependencies&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.spec&lt;/groupId&gt;
              &lt;artifactId&gt;jboss-javaee-7.0&lt;/artifactId&gt;
              &lt;version&gt;1.0.3.Final&lt;/version&gt;
              &lt;type&gt;pom&lt;/type&gt;
              &lt;scope&gt;provided&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;junit&lt;/groupId&gt;
              &lt;artifactId&gt;junit&lt;/artifactId&gt;
              &lt;version&gt;4.8.1&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.arquillian.junit&lt;/groupId&gt;
              &lt;artifactId&gt;arquillian-junit-container&lt;/artifactId&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.arquillian.container&lt;/groupId&gt;
              &lt;artifactId&gt;arquillian-weld-ee-embedded-1.1&lt;/artifactId&gt;
              &lt;version&gt;1.0.0.CR9&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.jboss.weld&lt;/groupId&gt;
              &lt;artifactId&gt;weld-core&lt;/artifactId&gt;
              &lt;version&gt;2.3.5.Final&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
          &lt;dependency&gt;
              &lt;groupId&gt;org.slf4j&lt;/groupId&gt;
              &lt;artifactId&gt;slf4j-simple&lt;/artifactId&gt;
              &lt;version&gt;1.6.4&lt;/version&gt;
              &lt;scope&gt;test&lt;/scope&gt;
          &lt;/dependency&gt;
      &lt;/dependencies&gt;
  </code></pre>