Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
Bill, I sent a pull request last evening. A couple of issues I noticed: - your source says 3.0.5.Final, I was expecting 3.0.6-SNAPSHOT or something like that. Makes me a little bit scared to build it. Not sure if your poms didn't get updated in your release. - You have some failing tests. I'm going to see if I can fix those as well. On Tue, Nov 26, 2013 at 7:16 PM, Bill Burke wrote: > Submit a pull request, i'll take a look > > > On 11/26/2013 7:05 PM, John D. Ament wrote: >> >> Bill, >> >> Actually from looking at the current impl, I have a fairly small >> trivial change. It would only work in CDI 1.1 though. I could >> probably implement it using reflection to avoid the compilation >> change, if you're interested in taking the contribution. This would >> use standard CDI look up in an SE environment. >> >> John >> >> On Tue, Nov 26, 2013 at 6:06 PM, Bill Burke wrote: >>> >>> >>> >>> On 11/26/2013 4:17 PM, Christian Helmbold wrote: > John D. Ament schrieb am 20:23 Dienstag, > 26.November 2013: >> >> >> I assumed this would happen, based on Bill's email. You're right. This happend after adding the following line to my startup code: deployment.setInjectorFactoryClass(org.jboss.resteasy.cdi.CdiInjectorFactory.class.getName()); > you'll probably > need to extend the CdiInjectorFactory to use your own BeanManager. I wonder why http://docs.jboss.org/resteasy/docs/3.0.5.Final/userguide/html_single/index.html#d4e2034 seems to be so simple. Sounds like Weld and RESTEasy are simply not built for what I want to do! The philosophie seems to be: use the whole application server or use something else. My idea was to create a small configuration which could be restarted very fast during development. I've done something similar with Guice and Jersey. But Wildfly should start pretty fast, so this could be better than trying to do the configuration myself. >>> >>> I would dive into this, but I don' thave the cycles at this time. Its >>> just >>> a matter of gettin Weld initialized in a SE environment, and then >>> tweaking >>> the CdiInjectorFactory. >>> >>> >>> There is a Resteasy Guice adapter too. >>> >>> >>> >>> -- >>> Bill Burke >>> JBoss, a division of Red Hat >>> http://bill.burkecentral.com > > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
Submit a pull request, i'll take a look On 11/26/2013 7:05 PM, John D. Ament wrote: > Bill, > > Actually from looking at the current impl, I have a fairly small > trivial change. It would only work in CDI 1.1 though. I could > probably implement it using reflection to avoid the compilation > change, if you're interested in taking the contribution. This would > use standard CDI look up in an SE environment. > > John > > On Tue, Nov 26, 2013 at 6:06 PM, Bill Burke wrote: >> >> >> On 11/26/2013 4:17 PM, Christian Helmbold wrote: >>> >>> >>> >>> >>> >>> John D. Ament schrieb am 20:23 Dienstag, 26.November 2013: > > I assumed this would happen, based on Bill's email. >>> >>> >>> You're right. This happend after adding the following line to my startup >>> code: >>> >>> >>> deployment.setInjectorFactoryClass(org.jboss.resteasy.cdi.CdiInjectorFactory.class.getName()); >>> you'll probably need to extend the CdiInjectorFactory to use your own BeanManager. >>> >>> >>> I wonder why >>> http://docs.jboss.org/resteasy/docs/3.0.5.Final/userguide/html_single/index.html#d4e2034 >>> seems to be so simple. >>> >>> Sounds like Weld and RESTEasy are simply not built for what I want to do! >>> The philosophie seems to be: use the whole application server or use >>> something else. My idea was to create a small configuration which could be >>> restarted very fast during development. I've done something similar with >>> Guice and Jersey. But Wildfly should start pretty fast, so this could be >>> better than trying to do the configuration myself. >>> >> >> I would dive into this, but I don' thave the cycles at this time. Its just >> a matter of gettin Weld initialized in a SE environment, and then tweaking >> the CdiInjectorFactory. >> >> >> There is a Resteasy Guice adapter too. >> >> >> >> -- >> Bill Burke >> JBoss, a division of Red Hat >> http://bill.burkecentral.com -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
Bill, Actually from looking at the current impl, I have a fairly small trivial change. It would only work in CDI 1.1 though. I could probably implement it using reflection to avoid the compilation change, if you're interested in taking the contribution. This would use standard CDI look up in an SE environment. John On Tue, Nov 26, 2013 at 6:06 PM, Bill Burke wrote: > > > On 11/26/2013 4:17 PM, Christian Helmbold wrote: >> >> >> >> >> >> >>> John D. Ament schrieb am 20:23 Dienstag, >>> 26.November 2013: I assumed this would happen, based on Bill's email. >> >> >> You're right. This happend after adding the following line to my startup >> code: >> >> >> deployment.setInjectorFactoryClass(org.jboss.resteasy.cdi.CdiInjectorFactory.class.getName()); >> >>> you'll probably >>> need to extend the CdiInjectorFactory to use your own BeanManager. >> >> >> I wonder why >> http://docs.jboss.org/resteasy/docs/3.0.5.Final/userguide/html_single/index.html#d4e2034 >> seems to be so simple. >> >> Sounds like Weld and RESTEasy are simply not built for what I want to do! >> The philosophie seems to be: use the whole application server or use >> something else. My idea was to create a small configuration which could be >> restarted very fast during development. I've done something similar with >> Guice and Jersey. But Wildfly should start pretty fast, so this could be >> better than trying to do the configuration myself. >> > > I would dive into this, but I don' thave the cycles at this time. Its just > a matter of gettin Weld initialized in a SE environment, and then tweaking > the CdiInjectorFactory. > > > There is a Resteasy Guice adapter too. > > > > -- > Bill Burke > JBoss, a division of Red Hat > http://bill.burkecentral.com -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
On 11/26/2013 4:17 PM, Christian Helmbold wrote: > > > > > >> John D. Ament schrieb am 20:23 Dienstag, >> 26.November 2013: >>> I assumed this would happen, based on Bill's email. > > You're right. This happend after adding the following line to my startup code: > > deployment.setInjectorFactoryClass(org.jboss.resteasy.cdi.CdiInjectorFactory.class.getName()); > >> you'll probably >> need to extend the CdiInjectorFactory to use your own BeanManager. > > I wonder why > http://docs.jboss.org/resteasy/docs/3.0.5.Final/userguide/html_single/index.html#d4e2034 > seems to be so simple. > > Sounds like Weld and RESTEasy are simply not built for what I want to do! The > philosophie seems to be: use the whole application server or use something > else. My idea was to create a small configuration which could be restarted > very fast during development. I've done something similar with Guice and > Jersey. But Wildfly should start pretty fast, so this could be better than > trying to do the configuration myself. > I would dive into this, but I don' thave the cycles at this time. Its just a matter of gettin Weld initialized in a SE environment, and then tweaking the CdiInjectorFactory. There is a Resteasy Guice adapter too. -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
> John D. Ament schrieb am 20:23 Dienstag, 26.November > 2013: > > I assumed this would happen, based on Bill's email. You're right. This happend after adding the following line to my startup code: deployment.setInjectorFactoryClass(org.jboss.resteasy.cdi.CdiInjectorFactory.class.getName()); > you'll probably > need to extend the CdiInjectorFactory to use your own BeanManager. I wonder why http://docs.jboss.org/resteasy/docs/3.0.5.Final/userguide/html_single/index.html#d4e2034 seems to be so simple. Sounds like Weld and RESTEasy are simply not built for what I want to do! The philosophie seems to be: use the whole application server or use something else. My idea was to create a small configuration which could be restarted very fast during development. I've done something similar with Guice and Jersey. But Wildfly should start pretty fast, so this could be better than trying to do the configuration myself. Christian -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
I assumed this would happen, based on Bill's email. you'll probably need to extend the CdiInjectorFactory to use your own BeanManager. On Tue, Nov 26, 2013 at 1:58 PM, Christian Helmbold wrote: > Thank you. After adding one more dependency (javax.servlet-api), I get the > following error, when I try to start my RESTEasy/Weld configuration: > > Exception in thread "main" java.lang.RuntimeException: Unable to instantiate > InjectorFactory implementation. > at > org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:156) > at > org.jboss.resteasy.plugins.server.netty.NettyJaxrsServer.start(NettyJaxrsServer.java:130) > at com.example.jaxrscdi.App.run(App.java:25) > at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) > at > sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) > at > sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) > at java.lang.reflect.Method.invoke(Method.java:606) > at > org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93) > at > org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266) > at > org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253) > at > org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232) > at > org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169) > at > org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165) > at > org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119) > at > org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112) > at org.jboss.weld.event.EventImpl.fire(EventImpl.java:83) > at org.jboss.weld.environment.se.Weld.initialize(Weld.java:153) > at org.jboss.weld.environment.se.StartMain.go(StartMain.java:41) > at org.jboss.weld.environment.se.StartMain.main(StartMain.java:52) > Caused by: java.lang.NullPointerException > at > org.jboss.resteasy.cdi.CdiInjectorFactory.lookupBeanManager(CdiInjectorFactory.java:155) > at > org.jboss.resteasy.cdi.CdiInjectorFactory.(CdiInjectorFactory.java:45) > at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) > at > sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) > at > sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) > at java.lang.reflect.Constructor.newInstance(Constructor.java:526) > at java.lang.Class.newInstance(Class.java:374) > at > org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:148) > ... 18 more > > > Any idea? > > Regards, > Christian > > > -- > Rapidly troubleshoot problems before they affect your business. Most IT > organizations don't have a clear picture of how application performance > affects their revenue. With AppDynamics, you get 100% visibility into your > Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! > http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk > ___ > Resteasy-users mailing list > Resteasy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/resteasy-users -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
Thank you. After adding one more dependency (javax.servlet-api), I get the following error, when I try to start my RESTEasy/Weld configuration: Exception in thread "main" java.lang.RuntimeException: Unable to instantiate InjectorFactory implementation. at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:156) at org.jboss.resteasy.plugins.server.netty.NettyJaxrsServer.start(NettyJaxrsServer.java:130) at com.example.jaxrscdi.App.run(App.java:25) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:57) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:606) at org.jboss.weld.injection.MethodInjectionPoint.invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:93) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:266) at org.jboss.weld.event.ObserverMethodImpl.sendEvent(ObserverMethodImpl.java:253) at org.jboss.weld.event.ObserverMethodImpl.notify(ObserverMethodImpl.java:232) at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:169) at org.jboss.weld.event.ObserverNotifier.notifyObserver(ObserverNotifier.java:165) at org.jboss.weld.event.ObserverNotifier.notifyObservers(ObserverNotifier.java:119) at org.jboss.weld.event.ObserverNotifier.fireEvent(ObserverNotifier.java:112) at org.jboss.weld.event.EventImpl.fire(EventImpl.java:83) at org.jboss.weld.environment.se.Weld.initialize(Weld.java:153) at org.jboss.weld.environment.se.StartMain.go(StartMain.java:41) at org.jboss.weld.environment.se.StartMain.main(StartMain.java:52) Caused by: java.lang.NullPointerException at org.jboss.resteasy.cdi.CdiInjectorFactory.lookupBeanManager(CdiInjectorFactory.java:155) at org.jboss.resteasy.cdi.CdiInjectorFactory.(CdiInjectorFactory.java:45) at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method) at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:57) at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45) at java.lang.reflect.Constructor.newInstance(Constructor.java:526) at java.lang.Class.newInstance(Class.java:374) at org.jboss.resteasy.spi.ResteasyDeployment.start(ResteasyDeployment.java:148) ... 18 more Any idea? Regards, Christian -- Rapidly troubleshoot problems before they affect your business. Most IT organizations don't have a clear picture of how application performance affects their revenue. With AppDynamics, you get 100% visibility into your Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro! http://pubads.g.doubleclick.net/gampad/clk?id=84349351&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users
Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?
I've never tried using CDI in Java SE. Really depend on the implementation of CDI I suppose. You'd have to manually set up CDI, then set the deployment.setInjectorFactoryClass(org.jboss.resteasy.cdi.CdiInjectoryFactory.class.getName()); Also, our impl only works with Weld. On 11/25/2013 3:49 PM, Christian Helmbold wrote: > Hi! > > > How can I setup RESTEasy (3.0.5) with CDI and Netty in a Java SE environment? > > Simply putting the resteasy-cdi module on the class path doesn't work (as > suggested in > http://docs.jboss.org/resteasy/docs/3.0.5.Final/userguide/html_single/index.html#d4e2034). > > Here is my startup class: > > @Singleton > public class App { > >public void printHello( >@Observes ContainerInitialized event, @Parameters List > parameters) >throws Exception { > NettyJaxrsServer netty = new NettyJaxrsServer(); > netty.setDeployment(new ResteasyDeployment()); > netty.setPort(8000); > netty.setRootResourcePath(""); > netty.setSecurityDomain(null); > netty.start(); >} > } > > I have a root resource in my example project which should be discovered by > weld automatically. But if I load the resource I get: > javax.ws.rs.NotFoundException: Could not find resource for full path: > http://localhost:8000/ > > I'm using the following libs: > > > What do I have to do to setup RESTEasy with CDI and Netty (or Undertow would > be fine too)? > > > -- > Shape the Mobile Experience: Free Subscription > Software experts and developers: Be at the forefront of tech innovation. > Intel(R) Software Adrenaline delivers strategic insight and game-changing > conversations that shape the rapidly evolving mobile landscape. Sign up now. > http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk > ___ > Resteasy-users mailing list > Resteasy-users@lists.sourceforge.net > https://lists.sourceforge.net/lists/listinfo/resteasy-users > -- Bill Burke JBoss, a division of Red Hat http://bill.burkecentral.com -- Shape the Mobile Experience: Free Subscription Software experts and developers: Be at the forefront of tech innovation. Intel(R) Software Adrenaline delivers strategic insight and game-changing conversations that shape the rapidly evolving mobile landscape. Sign up now. http://pubads.g.doubleclick.net/gampad/clk?id=63431311&iu=/4140/ostg.clktrk ___ Resteasy-users mailing list Resteasy-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/resteasy-users