[prev in list] [next in list] [prev in thread] [next in thread] 

List:       openejb-user
Subject:    Re: [PRIVATE] ApplicationComposer 7.0.0 and @Jars
From:       Romain Manni-Bucau <rmannibucau () gmail ! com>
Date:       2015-12-23 21:15:58
Message-ID: CACLE=7Mf8p7-ufwf9y25uzoSfCMTDxNFUbn4akO6GBuq5ooHpw () mail ! gmail ! com
[Download RAW message or body]


Thank you very much for the sample project made it easy to fix:
https://issues.apache.org/jira/browse/TOMEE-1685


Romain Manni-Bucau
@rmannibucau <https://twitter.com/rmannibucau> |  Blog
<http://rmannibucau.wordpress.com> | Github <https://github.com/rmannibucau> |
LinkedIn <https://www.linkedin.com/in/rmannibucau> | Tomitriber
<http://www.tomitribe.com>

2015-12-23 18:51 GMT+01:00 Romain Manni-Bucau <rmannibucau@gmail.com>:

> you can locate it, @Descriptor(name="persistence.xml",
> path="../jpa/src/main/resources/META-INF/persistence.xml")
> 
> alternative would be to use @PersistenceUnitDefinition in a scanned bean
> (in value):
> https://git1-us-west.apache.org/repos/asf?p=tomee.git;a=blob;f=container/openejb-cor \
> e/src/test/java/org/apache/openejb/configuration/PersistenceUnitDefinitionTest.java; \
> h=81a8041fb7258a956e94590be18c1e09fdcbbc0e;hb=0040c793bd294ef1ad32c1337b5b54ae3863bdea
>  
> 
> Romain Manni-Bucau
> @rmannibucau <https://twitter.com/rmannibucau> |  Blog
> <http://rmannibucau.wordpress.com> | Github
> <https://github.com/rmannibucau> | LinkedIn
> <https://www.linkedin.com/in/rmannibucau> | Tomitriber
> <http://www.tomitribe.com>
> 
> 2015-12-23 18:44 GMT+01:00 Yann BLAZART <
> yann.blazart@externe.bnpparibas.com>:
> 
> > @Descriptor(s) work only if the descriptor is directly in the project.
> > 
> > When I want to have a separate module for JPA for exemple, it doesn't
> > work. I just retested.
> > 
> > -----Original Message-----
> > From: Romain Manni-Bucau [mailto:rmannibucau@gmail.com]
> > Sent: mercredi 23 décembre 2015 18:39
> > To: users@tomee.apache.org
> > Subject: Re: [PRIVATE] ApplicationComposer 7.0.0 and @Jars
> > 
> > @Descriptor(s) should allow you to setup JPA and keep it a simple webapp
> > (single module)
> > 
> > 
> > Romain Manni-Bucau
> > @rmannibucau <https://twitter.com/rmannibucau> |  Blog <
> > http://rmannibucau.wordpress.com> | Github <
> > https://github.com/rmannibucau> | LinkedIn <
> > https://www.linkedin.com/in/rmannibucau> | Tomitriber <
> > http://www.tomitribe.com>
> > 
> > 2015-12-23 18:30 GMT+01:00 Yann BLAZART <
> > yann.blazart@externe.bnpparibas.com
> > > > 
> > 
> > > Well, I have more information.
> > > 
> > > In CdiScanner I can see the classes in BeanInfo beans.
> > > 
> > > But just after the following condition is true :
> > > 
> > > } else if (ejbJar.webapp && !appInfo.webAppAlone) {
> > > continue;
> > > }
> > > 
> > > (CdiScanner: 118)
> > > So the classes are not take in care...
> > > 
> > > Is it because I have a module for my persistenceUnit ? So What can I
> > > do to include the metrics-cdi jar ?
> > > 
> > > 
> > > 
> > > From: Yann BLAZART
> > > Sent: mercredi 23 décembre 2015 18:17
> > > To: users@tomee.apache.org
> > > Subject: [PRIVATE] ApplicationComposer 7.0.0 and @Jars
> > > 
> > > Hello, I want to make unit test with metrics-cdi.
> > > 
> > > This lib have a CDI extension. So in my ApplicationComposer I have to
> > > embed it with the @Jars.
> > > 
> > > 
> > > If I make a simple test like in the simple project attached, it
> > > start, I have a bug with a Singleton scope, this is not a problem
> > > because the Author will correct it this evening.
> > > 
> > > But When I try to make a more complexe test in my real project, the
> > > classe MetricProducer is not found, it seems the jar is not scanned
> > correctly.
> > > 
> > > My "real" code :
> > > 
> > > 
> > > @RunWith(ApplicationComposer.class)
> > > @Classes(
> > > cdi = true,
> > > innerClassesAsBean = true,
> > > cdiInterceptors = {RequiredNewInterceptor.class,
> > > RequiredInterceptor.class},
> > > value = {
> > > LoggerProducer.class,
> > > TxRunner.class,
> > > HazelCastProducer.class,
> > > ExtractIDService.class,
> > > FeedsPUEntityManagerProducer.class,
> > > HZCService.class,
> > > FeedsFlowMapStore.class,
> > > FeedsFlowRawMapStore.class,
> > > FeedsFlowSourceMapStore.class,
> > > GenericQStore.class,
> > > GenericQStoreFactory.class,
> > > FeedsQProducer.class,
> > > DBReporterService.class,
> > > MetricsCDIProducer.class,
> > > ComponentIDCardProducer.class
> > > 
> > > }
> > > 
> > > )
> > > @Jars(value = "metrics-cdi")
> > > public class FeedsQProducerTest extends
> > > AbstractApplicationComposerHelper { ...
> > > 
> > > @Module
> > > @PersistenceRootUrl(value = "") // must use value="" (BUG) public
> > > Persistence generateFeedsPU() throws Exception {
> > > return super.createPersistenceFromFile(FeedsFlow.class);
> > > }
> > > 
> > > @Configuration
> > > public Properties config() {
> > > Properties properties = new Properties();
> > > this.addDataSourceInProperties(properties, "feedsDS");
> > > this.overridePersistenceUnitProperties("feedsPU", properties,
> > > PersistenceUnitXmlProperties.SCHEMA_GEN_DATABASE_ACTION,
> > > "drop-and-create");
> > > return properties;
> > > }
> > > 
> > > 
> > > 
> > > And the stack trace :
> > > 
> > > INFO - All injection points were validated successfully.
> > > SEVERE - CDI Beans module deployment failed
> > > org.apache.webbeans.exception.WebBeansDeploymentException: Error while
> > > sending SystemEvent to a CDI Extension!
> > > org.apache.webbeans.portable.events.discovery.AfterDeploymentValidatio
> > > nImpl@36aab105
> > > <mailto:
> > > org.apache.webbeans.portable.events.discovery.AfterDeploymentValidatio
> > > nImpl@36aab105
> > > > 
> > > at
> > > 
> > org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:697)
> > 
> > > at
> > > 
> > org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:485)
> > > at
> > > 
> > org.apache.webbeans.container.BeanManagerImpl.fireLifecycleEvent(BeanManagerImpl.java:480)
> > 
> > > at
> > > 
> > org.apache.webbeans.config.BeansDeployer.fireAfterDeploymentValidationEvent(BeansDeployer.java:670)
> > 
> > > at
> > > org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:283)
> > > at
> > > 
> > org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:202)
> > 
> > > at
> > > 
> > org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:180)
> > 
> > > at
> > > org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:41)
> > > at
> > > 
> > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:894)
> > 
> > > at
> > > 
> > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:694)
> > 
> > > at
> > > 
> > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:690)
> > 
> > > at
> > > 
> > org.apache.openejb.testing.ApplicationComposers.deployApp(ApplicationComposers.java:720)
> > 
> > > at
> > > 
> > org.apache.openejb.testing.ApplicationComposers.before(ApplicationComposers.java:384)
> > 
> > > at
> > > 
> > org.apache.openejb.testing.ApplicationComposers.evaluate(ApplicationComposers.java:1043)
> > 
> > > at
> > > 
> > org.apache.openejb.junit.DeployApplication.evaluate(DeployApplication.java:40)
> > > at
> > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> > > at
> > > 
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> > > at
> > > 
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> > > at
> > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > > at
> > > org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> > > at
> > > org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> > > at
> > > org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> > > at
> > > org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> > > at
> > > 
> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> > > at
> > > org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> > > at
> > > org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> > > at
> > > 
> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
> > 
> > > at
> > > 
> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
> > 
> > > at
> > > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
> > > at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > > 
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > > at
> > > 
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > 
> > > at
> > java.lang.reflect.Method.invoke(Method.java:483)
> > > at
> > > com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> > > Caused by: org.apache.webbeans.exception.WebBeansException:
> > > java.lang.reflect.InvocationTargetException
> > > at
> > > 
> > org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:318)
> > > at
> > > 
> > org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:676)
> > 
> > > ... 33 more
> > > Caused by: java.lang.reflect.InvocationTargetException
> > > at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > > 
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > > at
> > > 
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > 
> > > at
> > java.lang.reflect.Method.invoke(Method.java:483)
> > > at
> > > 
> > org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:347)
> > > at
> > > 
> > org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke(ContainerEventObserverMethodImpl.java:82)
> > 
> > > at
> > > 
> > org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:312)
> > > ... 34 more
> > > Caused by: java.lang.NullPointerException: bean parameter may not be
> > null
> > > at
> > > org.apache.webbeans.util.Asserts.assertNotNull(Asserts.java:52)
> > > at
> > > 
> > org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:708)
> > 
> > > at
> > > 
> > org.apache.webbeans.container.InjectableBeanManager.getReference(InjectableBeanManager.java:165)
> > 
> > > at
> > > 
> > io.astefanutti.metrics.cdi.MetricsExtension.getBeanInstance(MetricsExtension.java:123)
> > 
> > > at
> > > 
> > io.astefanutti.metrics.cdi.MetricsExtension.configuration(MetricsExtension.java:99)
> > 
> > > ... 41 more
> > > 
> > > javax.enterprise.inject.spi.DeploymentException: couldn't start owb
> > > context
> > > 
> > > at
> > > 
> > org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:182)
> > 
> > > at
> > > org.apache.openejb.cdi.CdiBuilder.build(CdiBuilder.java:41)
> > > at
> > > 
> > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:894)
> > 
> > > at
> > > 
> > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:694)
> > 
> > > at
> > > 
> > org.apache.openejb.assembler.classic.Assembler.createApplication(Assembler.java:690)
> > 
> > > at
> > > 
> > org.apache.openejb.testing.ApplicationComposers.deployApp(ApplicationComposers.java:720)
> > 
> > > at
> > > 
> > org.apache.openejb.testing.ApplicationComposers.before(ApplicationComposers.java:384)
> > 
> > > at
> > > 
> > org.apache.openejb.testing.ApplicationComposers.evaluate(ApplicationComposers.java:1043)
> > 
> > > at
> > > 
> > org.apache.openejb.junit.DeployApplication.evaluate(DeployApplication.java:40)
> > > at
> > > org.junit.runners.ParentRunner.runLeaf(ParentRunner.java:325)
> > > at
> > > 
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:78)
> > > at
> > > 
> > org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit4ClassRunner.java:57)
> > > at
> > > org.junit.runners.ParentRunner$3.run(ParentRunner.java:290)
> > > at
> > > org.junit.runners.ParentRunner$1.schedule(ParentRunner.java:71)
> > > at
> > > org.junit.runners.ParentRunner.runChildren(ParentRunner.java:288)
> > > at
> > > org.junit.runners.ParentRunner.access$000(ParentRunner.java:58)
> > > at
> > > org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java:268)
> > > at
> > > 
> > org.junit.internal.runners.statements.RunBefores.evaluate(RunBefores.java:26)
> > > at
> > > org.junit.runners.ParentRunner.run(ParentRunner.java:363)
> > > at
> > > org.junit.runner.JUnitCore.run(JUnitCore.java:137)
> > > at
> > > 
> > com.intellij.junit4.JUnit4IdeaTestRunner.startRunnerWithArgs(JUnit4IdeaTestRunner.java:117)
> > 
> > > at
> > > 
> > com.intellij.rt.execution.junit.JUnitStarter.prepareStreamsAndStart(JUnitStarter.java:234)
> > 
> > > at
> > > com.intellij.rt.execution.junit.JUnitStarter.main(JUnitStarter.java:74)
> > > at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > > 
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > > at
> > > 
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > 
> > > at
> > java.lang.reflect.Method.invoke(Method.java:483)
> > > at
> > > com.intellij.rt.execution.application.AppMain.main(AppMain.java:144)
> > > Caused by: org.apache.openejb.OpenEJBRuntimeException:
> > > org.apache.webbeans.exception.WebBeansDeploymentException: Error while
> > > sending SystemEvent to a CDI Extension!
> > > org.apache.webbeans.portable.events.discovery.AfterDeploymentValidatio
> > > nImpl@36aab105
> > > <mailto:
> > > org.apache.webbeans.portable.events.discovery.AfterDeploymentValidatio
> > > nImpl@36aab105
> > > > 
> > > at
> > > 
> > org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:206)
> > 
> > > at
> > > 
> > org.apache.openejb.cdi.ThreadSingletonServiceImpl.initialize(ThreadSingletonServiceImpl.java:180)
> > 
> > > ... 27 more
> > > Caused by: org.apache.webbeans.exception.WebBeansDeploymentException:
> > > Error while sending SystemEvent to a CDI Extension!
> > > org.apache.webbeans.portable.events.discovery.AfterDeploymentValidatio
> > > nImpl@36aab105
> > > <mailto:
> > > org.apache.webbeans.portable.events.discovery.AfterDeploymentValidatio
> > > nImpl@36aab105
> > > > 
> > > at
> > > 
> > org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:697)
> > 
> > > at
> > > 
> > org.apache.webbeans.container.BeanManagerImpl.fireEvent(BeanManagerImpl.java:485)
> > > at
> > > 
> > org.apache.webbeans.container.BeanManagerImpl.fireLifecycleEvent(BeanManagerImpl.java:480)
> > 
> > > at
> > > 
> > org.apache.webbeans.config.BeansDeployer.fireAfterDeploymentValidationEvent(BeansDeployer.java:670)
> > 
> > > at
> > > org.apache.webbeans.config.BeansDeployer.deploy(BeansDeployer.java:283)
> > > at
> > > 
> > org.apache.openejb.cdi.OpenEJBLifecycle.startApplication(OpenEJBLifecycle.java:202)
> > 
> > > ... 28 more
> > > Caused by: org.apache.webbeans.exception.WebBeansException:
> > > java.lang.reflect.InvocationTargetException
> > > at
> > > 
> > org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:318)
> > > at
> > > 
> > org.apache.webbeans.event.NotificationManager.fireEvent(NotificationManager.java:676)
> > 
> > > ... 33 more
> > > Caused by: java.lang.reflect.InvocationTargetException
> > > at
> > > sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> > > at
> > > 
> > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
> > > at
> > > 
> > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
> > 
> > > at
> > java.lang.reflect.Method.invoke(Method.java:483)
> > > at
> > > 
> > org.apache.webbeans.event.ObserverMethodImpl.invoke(ObserverMethodImpl.java:347)
> > > at
> > > 
> > org.apache.webbeans.event.ContainerEventObserverMethodImpl.invoke(ContainerEventObserverMethodImpl.java:82)
> > 
> > > at
> > > 
> > org.apache.webbeans.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:312)
> > > ... 34 more
> > > Caused by: java.lang.NullPointerException: bean parameter may not be
> > null
> > > at
> > > org.apache.webbeans.util.Asserts.assertNotNull(Asserts.java:52)
> > > at
> > > 
> > org.apache.webbeans.container.BeanManagerImpl.getReference(BeanManagerImpl.java:708)
> > 
> > > at
> > > 
> > org.apache.webbeans.container.InjectableBeanManager.getReference(InjectableBeanManager.java:165)
> > 
> > > at
> > > 
> > io.astefanutti.metrics.cdi.MetricsExtension.getBeanInstance(MetricsExtension.java:123)
> > 
> > > at
> > > 
> > io.astefanutti.metrics.cdi.MetricsExtension.configuration(MetricsExtension.java:99)
> > 
> > > ... 41 more
> > > 
> > > 
> > > The code in the extension :
> > > 
> > > 
> > > private static <T> T getBeanInstance(BeanManager manager, Class<T>
> > clazz) {
> > > Bean<?> bean = manager.resolve(manager.getBeans(clazz));
> > > return (T) manager.getReference(bean, clazz,
> > > manager.createCreationalContext(bean));
> > > }
> > > 
> > > bean is null...
> > > 
> > > Any idea why it works in the little project ? Or any suggestion for me
> > > to find ?
> > > 
> > > I run in debug, I saw that ApplicationComposer is looking well the
> > > Jar, but when it comes in CdiScanner, no more beans....
> > > 
> > > Regards
> > > 
> > > 
> > > This message and any attachments (the "message") is intended solely
> > > for the intended addressees and is confidential.
> > > If you receive this message in error,or are not the intended
> > > recipient(s), please delete it and any copies from your systems and
> > > immediately notify the sender. Any unauthorized view, use that does
> > > not comply with its purpose, dissemination or disclosure, either whole
> > > or partial, is prohibited. Since the internet cannot guarantee the
> > > integrity of this message which may not be reliable, BNP PARIBAS (and
> > > its subsidiaries) shall not be liable for the message if modified,
> > > changed or falsified.
> > > Do not print this message unless it is necessary,consider the
> > environment.
> > > 
> > > 
> > > ----------------------------------------------------------------------
> > > ------------------------------------------------------------
> > > 
> > > Ce message et toutes les pieces jointes (ci-apres le "message") sont
> > > etablis a l'intention exclusive de ses destinataires et sont
> > > confidentiels.
> > > Si vous recevez ce message par erreur ou s'il ne vous est pas destine,
> > > merci de le detruire ainsi que toute copie de votre systeme et d'en
> > > avertir immediatement l'expediteur. Toute lecture non autorisee, toute
> > > utilisation de ce message qui n'est pas conforme a sa destination,
> > > toute diffusion ou toute publication, totale ou partielle, est
> > > interdite. L'Internet ne permettant pas d'assurer l'integrite de ce
> > > message electronique susceptible d'alteration, BNP Paribas (et ses
> > > filiales) decline(nt) toute responsabilite au titre de ce message dans
> > > l'hypothese ou il aurait ete modifie, deforme ou falsifie.
> > > N'imprimez ce message que si necessaire, pensez a l'environnement.
> > > 
> > 
> 
> 



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic