hi,

for loading configured classes like the one in question, deltaspike uses
the context-class-loader of the current thread.
maybe that's the issue in your case.
you could test it by using a different one in
ClassUtils#getClassLoaderInternal
as far as we have seen, topics like classloading in case of ears aren't
portable (across servers).

regards,
gerhard



2018-07-11 13:35 GMT+02:00 Gofio Code <[email protected]>:

> Hi Gerhard,
>
> thanks a lot for your answer!
>
> As far as I know, the jars inside the ear lib directory are available for
> all the artifacts inside the ear, so there shouldn't be any problem because
> this is the default isolation in wildfly... besides it only happens during
> the deployment when the TransactionStrategy is stablished.
>
> From wildFly doc: (
> http://docs.wildfly.org/13/Admin_Guide.html#ear-subdeployments-isolation)
> - - -
> EAR Subdeployments Isolation
> A flag indicating whether each of the subdeployments within a .ear can
> access classes belonging to another subdeployment within the same .ear. The
> default value is false, which allows the subdeployments to see classes
> belonging to other subdeployments within the .ear.
> - - -
>
> I think that during the deployment, the initialization code of DeltaSpike
> (all its jars are inside ear/lib) reads the TransactionStrategy and tries
> to instantiate this class but it can't find it... even when all the jars
> are in the same place... so it can execute the initializacion code which is
> in a jar inside ear/lib, and this code can't instantiate a class which is
> in the same place... it sounds weird...
>
> On 2018/07/06 17:41:53, Gerhard Petracek <[email protected]> wrote:
>
> > hi,>
>
> >
>
> > please have a look at the wildfly-config for module-isolation.>
>
> >
>
> > regards,>
>
> > gerhard>
>
> >
>
> >
>
> >
>
> > 2018-07-05 11:06 GMT+02:00 Gofio Code <[email protected]>:>
>
> >
>
> > > Dear community,>
>
> > >>
>
> > > I am using DeltaSpike Data Module 1.7.2 (some problem with 1.8.2) in a>
>
> > > project together with JPA and Vaadin 8.4.4. The proyectis deployed to>
>
> > > WildFly 13.0.0.Final by means of a ear file.>
>
> > >>
>
> > > Structure of the ear:>
>
> > >>
>
> > > * EAR File>
>
> > >     |- lib/>
>
> > >     |       |-  deltaspike jars (including>
>
> > > "deltaspike-jpa-module-impl-1.7.2.jar")>
>
> > >     |       `-   persistence.jar     >> includes JPA, deltaspike>
>
> > > Repositories>
>
> > >     |- ejbServices.jar               >> it uses the deltaspike
> Repositories>
>
> > >     `- vaadinApp.war               >> it uses the ejbServices>
>
> > >>
>
> > > If I didn't set any TransactionStrategy it is deployed and I can even
> use a>
>
> > > repository to execute a "findAll()" successfully. But if I set>
>
> > > ContainerManagedTransactionStrategy to ContainerManagedTransactionStr
> ategy>
>
>
> > > I get this exception at deplyment time:>
>
> > >>
>
> > > ------------------------>
>
> > > 08:49:44,060 ERROR [org.jboss.msc.service.fail] (MSC service thread
> 1-2)>
>
> > > MSC000001: Failed to start service>
>
> > > jboss.deployment.unit."gesteven-app-0.0.1-SNAPSHOT.
> ear".WeldStartService:>
>
>
> > > org.jboss.msc.service.StartException in service>
>
> > > jboss.deployment.unit."gesteven-app-0.0.1-SNAPSHOT.
> ear".WeldStartService:>
>
>
> > > Failed to start service>
>
> > >     at>
>
> > > org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(>
>
> > > ServiceControllerImpl.java:1728)>
>
> > >     at>
>
> > > org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(>
>
> > > ServiceControllerImpl.java:1556)>
>
> > >     at>
>
> > > org.jboss.threads.ContextClassLoaderSavingRunnable.run(>
>
> > > ContextClassLoaderSavingRunnable.java:35)>
>
> > >     at>
>
> > > org.jboss.threads.EnhancedQueueExecutor.safeRun(>
>
> > > EnhancedQueueExecutor.java:1985)>
>
> > >     at>
>
> > > org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(>
>
> > > EnhancedQueueExecutor.java:1487)>
>
> > >     at>
>
> > > org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(>
>
> > > EnhancedQueueExecutor.java:1378)>
>
> > >     at java.lang.Thread.run(Thread.java:748)>
>
> > > Caused by: org.jboss.weld.exceptions.DefinitionException: Exception
> List>
>
> > > with 1 exceptions:>
>
> > > Exception 0 :>
>
> > > java.lang.IllegalStateException: Can't find class>
>
> > > org.apache.deltaspike.jpa.impl.transaction.
> ContainerManagedTransactionStr>
>
> > > ategy>
>
> > > which is configured for>
>
> > > org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy>
>
> > >     at>
>
> > > org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension.>
>
> > > activateGlobalAlternatives(ExcludeExtension.java:303)>
>
> > >     at>
>
> > > org.apache.deltaspike.core.impl.exclude.extension.>
>
> > > ExcludeExtension.vetoBeans(ExcludeExtension.java:174)>
>
> > >     at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown Source)>
>
> > >     at>
>
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(>
>
> > > DelegatingMethodAccessorImpl.java:43)>
>
> > >     at java.lang.reflect.Method.invoke(Method.java:498)>
>
> > >     at>
>
> > > org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(>
>
> > > StaticMethodInjectionPoint.java:95)>
>
> > >     at>
>
> > > org.jboss.weld.injection.MethodInvocationStrategy$>
>
> > > SpecialParamPlusBeanManagerStrategy.invoke(
> MethodInvocationStrategy.java:>
>
> > > 144)>
>
> > >     at>
>
> > > org.jboss.weld.event.ObserverMethodImpl.sendEvent(>
>
> > > ObserverMethodImpl.java:330)>
>
> > >     at>
>
> > > org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(>
>
> > > ExtensionObserverMethodImpl.java:123)>
>
> > >     at>
>
> > > org.jboss.weld.event.ObserverMethodImpl.sendEvent(>
>
> > > ObserverMethodImpl.java:308)>
>
> > >     at>
>
> > > org.jboss.weld.event.ObserverMethodImpl.notify(>
>
> > > ObserverMethodImpl.java:286)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.>
>
> > > fireProcessAnnotatedType(ContainerLifecycleEvents.java:203)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.>
>
> > > fireProcessAnnotatedType(ContainerLifecycleEvents.java:174)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.BeanDeployer.processAnnotatedTypes(>
>
> > > BeanDeployer.java:166)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.BeanDeployment.createTypes(>
>
> > > BeanDeployment.java:219)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.WeldStartup.startInitialization(>
>
> > > WeldStartup.java:415)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(>
>
> > > WeldBootstrap.java:79)>
>
> > >     at org.jboss.as.weld.WeldStartService.start(
> WeldStartService.java:95)>
>
>
> > >     at>
>
> > > org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(>
>
> > > ServiceControllerImpl.java:1736)>
>
> > >     at>
>
> > > org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(>
>
> > > ServiceControllerImpl.java:1698)>
>
> > >     at>
>
> > > org.jboss.msc.service.ServiceControllerImpl$ControllerTask.run(>
>
> > > ServiceControllerImpl.java:1556)>
>
> > >     at>
>
> > > org.jboss.threads.ContextClassLoaderSavingRunnable.run(>
>
> > > ContextClassLoaderSavingRunnable.java:35)>
>
> > >     at>
>
> > > org.jboss.threads.EnhancedQueueExecutor.safeRun(>
>
> > > EnhancedQueueExecutor.java:1985)>
>
> > >     at>
>
> > > org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(>
>
> > > EnhancedQueueExecutor.java:1487)>
>
> > >     at>
>
> > > org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(>
>
> > > EnhancedQueueExecutor.java:1378)>
>
> > >     at java.lang.Thread.run(Thread.java:748)>
>
> > >>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.>
>
> > > fireProcessAnnotatedType(ContainerLifecycleEvents.java:210)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.>
>
> > > fireProcessAnnotatedType(ContainerLifecycleEvents.java:174)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.BeanDeployer.processAnnotatedTypes(>
>
> > > BeanDeployer.java:166)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.BeanDeployment.createTypes(>
>
> > > BeanDeployment.java:219)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.WeldStartup.startInitialization(>
>
> > > WeldStartup.java:415)>
>
> > >     at>
>
> > > org.jboss.weld.bootstrap.WeldBootstrap.startInitialization(>
>
> > > WeldBootstrap.java:79)>
>
> > >     at org.jboss.as.weld.WeldStartService.start(
> WeldStartService.java:95)>
>
>
> > >     at>
>
> > > org.jboss.msc.service.ServiceControllerImpl$StartTask.startService(>
>
> > > ServiceControllerImpl.java:1736)>
>
> > >     at>
>
> > > org.jboss.msc.service.ServiceControllerImpl$StartTask.execute(>
>
> > > ServiceControllerImpl.java:1698)>
>
> > >     ... 6 more>
>
> > >     Suppressed: java.lang.IllegalStateException: Can't find class>
>
> > > org.apache.deltaspike.jpa.impl.transaction.
> ContainerManagedTransactionStr>
>
> > > ategy>
>
> > > which is configured for>
>
> > > org.apache.deltaspike.jpa.spi.transaction.TransactionStrategy>
>
> > >         at>
>
> > > org.apache.deltaspike.core.impl.exclude.extension.ExcludeExtension.>
>
> > > activateGlobalAlternatives(ExcludeExtension.java:303)>
>
> > >         at>
>
> > > org.apache.deltaspike.core.impl.exclude.extension.>
>
> > > ExcludeExtension.vetoBeans(ExcludeExtension.java:174)>
>
> > >         at sun.reflect.GeneratedMethodAccessor9.invoke(Unknown
> Source)>
>
> > >         at>
>
> > > sun.reflect.DelegatingMethodAccessorImpl.invoke(>
>
> > > DelegatingMethodAccessorImpl.java:43)>
>
> > >         at java.lang.reflect.Method.invoke(Method.java:498)>
>
> > >         at>
>
> > > org.jboss.weld.injection.StaticMethodInjectionPoint.invoke(>
>
> > > StaticMethodInjectionPoint.java:95)>
>
> > >         at>
>
> > > org.jboss.weld.injection.MethodInvocationStrategy$>
>
> > > SpecialParamPlusBeanManagerStrategy.invoke(
> MethodInvocationStrategy.java:>
>
> > > 144)>
>
> > >         at>
>
> > > org.jboss.weld.event.ObserverMethodImpl.sendEvent(>
>
> > > ObserverMethodImpl.java:330)>
>
> > >         at>
>
> > > org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent(>
>
> > > ExtensionObserverMethodImpl.java:123)>
>
> > >         at>
>
> > > org.jboss.weld.event.ObserverMethodImpl.sendEvent(>
>
> > > ObserverMethodImpl.java:308)>
>
> > >         at>
>
> > > org.jboss.weld.event.ObserverMethodImpl.notify(>
>
> > > ObserverMethodImpl.java:286)>
>
> > >         at>
>
> > > org.jboss.weld.bootstrap.events.ContainerLifecycleEvents.>
>
> > > fireProcessAnnotatedType(ContainerLifecycleEvents.java:203)>
>
> > >         ... 14 more>
>
> > > ------------------------>
>
> > >>
>
> > > I have double checked the ear file and>
>
> > > "deltaspike-jpa-module-impl-1.7.2.jar" is in its lib folder... Why is
> it>
>
> > > saying it can't find the class>
>
> > > org.apache.deltaspike.jpa.impl.transaction.
> ContainerManagedTransactionStr>
>
> > > ategy?????>
>
> > > Any ideas?? Could the TransactionStrategy be declared in a different
> way?>
>
> > >>
>
> > > ** Below is the rest of my configuraion **>
>
> > >>
>
> > > ===========>
>
> > > persistence.jar>
>
> > > ===========>
>
> > >>
>
> > > >> pom.xml dependency:>
>
> > >>
>
> > >     <dependency>>
>
> > >       <groupId>org.apache.deltaspike.modules</groupId>>
>
> > >       <artifactId>deltaspike-data-module-api</artifactId>>
>
> > >       <version>1.7.2</version>>
>
> > >       <scope>compile</scope>>
>
> > >     </dependency>>
>
> > >     <dependency>>
>
> > >       <groupId>org.apache.deltaspike.modules</groupId>>
>
> > >       <artifactId>deltaspike-data-module-impl</artifactId>>
>
> > >       <version>1.7.2</version>>
>
> > >       <scope>runtime</scope>>
>
> > >    </dependency>>
>
> > >>
>
> > >>
>
> > > >> META-INF/apache-deltaspike.properties:>
>
> > > globalAlternatives.org.apache.deltaspike.jpa.spi.transaction.>
>
> > > TransactionStrategy=org.apache.deltaspike.jpa.impl.transaction.>
>
> > > ContainerManagedTransactionStrategy>
>
> > >>
>
> > > >> META-INF/beans.xml:>
>
> > >    this file is empty>
>
> > >>
>
> > > >> META-INF/persistence.xml:>
>
> > > <persistence version="2.1"  xmlns="http://xmlns.jcp.org/
> xml/ns/persistence>
>
> > > ">
>
> > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";>
>
> > > xsi:schemaLocation=">
>
> > > http://xmlns.jcp.org/xml/ns/persistence>
>
> > > http://xmlns.jcp.org/xml/ns/persistence/persistence_2_1.xsd";>>
>
> > >     <persistence-unit name="myapp-persistence" transaction-type="JTA">>
>
> > >         <provider>org.hibernate.jpa.HibernatePersistenceProvider</>
>
> > > provider>>
>
> > >         <jta-data-source>java:jboss/datasources/myAppDS</jta-data-
> source>>
>
>
> > >>
>
> > >         <exclude-unlisted-classes>false</exclude-unlisted-classes>>
>
> > >         <properties>>
>
> > >             <property name="hibernate.dialect">
>
> > > value="org.hibernate.dialect.PostgreSQLDialect" />>
>
> > >         </properties>>
>
> > >     </persistence-unit>>
>
> > > </persistence>>
>
> > > ----------------------------------------->
>
> > >>
>
> > > >> The EntityManager defined in EntityManagerProducer.java:>
>
> > > public class EntityManagerProducer {>
>
> > >     @PersistenceUnit>
>
> > >     private EntityManagerFactory emf;>
>
> > >>
>
> > >     @Produces // you can also make this @RequestScoped>
>
> > >     public EntityManager create()>
>
> > >     {>
>
> > >         return emf.createEntityManager();>
>
> > >     }>
>
> > >>
>
> > >     public void close(@Disposes EntityManager em)>
>
> > >     {>
>
> > >         if (em.isOpen())>
>
> > >         {>
>
> > >             em.close();>
>
> > >         }>
>
> > >     }>
>
> > > }>
>
> > >>
>
> > >>
>
> > > ======================>
>
> > >>
>
> > > It seems to be a classloader problem, but as far as>
>
> > > "deltaspike-jpa-module-impl-1.7.2.jar" is inside the lib folder of the
> ear>
>
> > > file, i can't figure out why it can't find it...>
>
> > >>
>
> > > Any help will be appreciated, thanks in advance!!>
>
> > >>
>
> >
>

Reply via email to