Hi everyone,

I just starting to try using deltaspike.
To begin I create a EAR Project using the tutorial 
(https://vaadin.com/wiki/-/wiki/Main/Implementing+Enterprise+Web+applications+with+Vaadin),
 and deploying on a Wildfly 10.1 .
This is made of three components:
• Common – where I keep my entities
• Backend – used for the EJB and where I try to use the Deltaspike
• UI – using Vaadin (I think that this is irrelevant for my problem)

On the “Backend”, I add this to my pom.xml:
        …
                <dependency>
                                
<groupId>org.apache.deltaspike.distribution</groupId>
                                <artifactId>distributions-bom</artifactId>
                                <version>1.7.1</version>
                                <type>pom</type>
                                <scope>import</scope>
                        </dependency>
                </dependencies>
        …
                <dependency>
                        <groupId>org.apache.deltaspike.core</groupId>
                        <artifactId>deltaspike-core-api</artifactId>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>org.apache.deltaspike.core</groupId>
                        <artifactId>deltaspike-core-impl</artifactId>
                        <scope>runtime</scope>
                </dependency>
                <dependency>
                        <groupId>org.apache.deltaspike.modules</groupId>
                        <artifactId>deltaspike-data-module-api</artifactId>
                        <scope>compile</scope>
                </dependency>
                <dependency>
                        <groupId>org.apache.deltaspike.modules</groupId>
                        <artifactId>deltaspike-data-module-impl</artifactId>
                        <scope>runtime</scope>
                </dependency>

And exposed the entity manager:
        public class CdiConfig {
        @Produces
        @Dependent
        @PersistenceContext(unitName = "proto2")
        public EntityManager entityManager;
        }

Next, I created a simple entity:
@Entity
@Table(name = "customers")
public class Customer {
        private String contactPerson;
        private String email; 
        << Setters and Getters add>>
        …

And an generic repository to host common methods:
public interface GenericRepository<T> extends EntityRepository<T, Long> {
        public T findById(Long id);
}

Last, I created a specific eepository for the customer entity:
@RequestScoped
@Repository(forEntity = Customer.class)
public interface CustomerRepository extends GenericRepository<Customer> {
        public QueryResult<Customer> findByNameLikeIgnoreCase(String filter);
}

The problem is that when I deploy the .ear file, I get this errors:
12:15:30,686 WARN  [org.jboss.modules] (MSC service thread 1-3) Failed to 
define class org.rna.vaadin.proto2.ejb.dao.GenericRepository in Module 
"deployment.proto2.ear.backend.jar:main" from Service Module Loader: 
java.lang.NoClassDefFoundError: Failed to link 
org/rna/vaadin/proto2/ejb/dao/GenericRepository (Module 
"deployment.proto2.ear.backend.jar:main" from Service Module Loader): 
org/apache/deltaspike/data/api/EntityRepository
        at sun.reflect.GeneratedConstructorAccessor39.newInstance(Unknown 
Source)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
…
And,
12:15:30,686 WARN  [org.jboss.modules] (MSC service thread 1-3) Failed to 
define class org.rna.vaadin.proto2.ejb.dao.CustomerRepository in Module 
"deployment.proto2.ear.backend.jar:main" from Service Module Loader: 
java.lang.NoClassDefFoundError: Failed to link 
org/rna/vaadin/proto2/ejb/dao/CustomerRepository (Module 
"deployment.proto2.ear.backend.jar:main" from Service Module Loader): Failed to 
link org/rna/vaadin/proto2/ejb/dao/GenericRepository (Module 
"deployment.proto2.ear.backend.jar:main" from Service Module Loader): 
org/apache/deltaspike/data/api/EntityRepository
        at sun.reflect.GeneratedConstructorAccessor39.newInstance(Unknown 
Source)
        at 
sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
        at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
        at 
org.jboss.modules.ModuleClassLoader.defineClass(ModuleClassLoader.java:446)
        at 
org.jboss.modules.ModuleClassLoader.loadClassLocal(ModuleClassLoader.java:274)
…

For simplicity, I didn’t write here the remaining JPA or project settings.

What am I doing wrong? Or did I missed something?

Thank you in advance

Ricardo

Reply via email to