Re: [Resteasy-users] How to setup RESTEasy with CDI and Netty?

2013-11-26 Thread Christian Helmbold
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.init(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=84349351iu=/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?

2013-11-26 Thread Christian Helmbold





 John D. Ament john.d.am...@gmail.com 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=84349351iu=/4140/ostg.clktrk
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users


[Resteasy-users] How to setup RESTEasy with CDI and Netty?

2013-11-25 Thread Christian Helmbold
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 ListString 
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=63431311iu=/4140/ostg.clktrk
___
Resteasy-users mailing list
Resteasy-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/resteasy-users