RE: EAR using Deltaspike

2016-09-18 Thread rnaguiar
I sure didn’t. 😊
Vaadin CDI is in place.

Maybe an article updated is needed, or a “Part 2”.

I added exclusions in the UI pom.xml. And work perfectly.

Thank you for your help,
Ricardo


De: Matti Tahvonen

RE: EAR using Deltaspike

2016-09-18 Thread rnaguiar
That is it. As soon as I added them, it worked.

The intent to play with EAR is to have a clear separation between business 
logic , domain objects and UI.
But I will also play with the WAR packaging. Thank you for the advise.


De: John D. Ament

Re: EAR using Deltaspike

2016-09-17 Thread Matti Tahvonen
I hope you are not literally following those instructions as they are rather 
dated. As John said you are probably better of with plain war packaging these 
days. If you are using  Vaadin CDI ( and you should, even though the old wiki 
instructions don't mention), I'd check there are no version collisions with 
Deltaspike. Vaadin CDI depends on an older version, but you can most probably 
exclude its dependencies and use a newer version.

I hope this helps,
Matti

> On 17 Sep 2016, at 4.38,   wrote:
> 
> 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:
>…
>
>org.apache.deltaspike.distribution
>distributions-bom
>1.7.1
>pom
>import
>
>
>…
>
>org.apache.deltaspike.core
>deltaspike-core-api
>compile
>
>
>org.apache.deltaspike.core
>deltaspike-core-impl
>runtime
>
>
>org.apache.deltaspike.modules
>deltaspike-data-module-api
>compile
>
>
>org.apache.deltaspike.modules
>deltaspike-data-module-impl
>runtime
>
> 
> 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 extends EntityRepository {
>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 {
>public QueryResult 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


Re: EAR using Deltaspike

2016-09-17 Thread John D. Ament
Ok, I see you're packaging JARs.  Is DeltaSpike packaged in your lib folder?

And I have to ask - do you need to use EAR packaging?  Your whole
deployment structure is going to be orders of magnitude less complex by
packaging a WAR file, with your dependent JARs in it.

John

On Sat, Sep 17, 2016 at 7:38 AM  wrote:

> 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:
> …
> 
>
> org.apache.deltaspike.distribution
> distributions-bom
> 1.7.1
> pom
> import
> 
> 
> …
> 
> org.apache.deltaspike.core
> deltaspike-core-api
> compile
> 
> 
> org.apache.deltaspike.core
> deltaspike-core-impl
> runtime
> 
> 
> org.apache.deltaspike.modules
> deltaspike-data-module-api
> compile
> 
> 
> org.apache.deltaspike.modules
>
> deltaspike-data-module-impl
> runtime
> 
>
> 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 extends EntityRepository {
> 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 {
> public QueryResult 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
>