To answer: 1. JavaEE application servers are not on our approved software list and I was told that the would not likely be approved in the near future.
2. I don't see how starting with a WAR and using a WebApplicationContext would make any difference in whether injections work... Regardless, it would mean having to separate the application and the server again (Create the WAR, deploy to Jetty) and we are trying to avoid that. Thanks in advance, Deven On Fri, Nov 21, 2014 at 4:22 PM, Jason Porter <[email protected]> wrote: > I have to say I'm not familiar at all with using Jetty this way. Is there a > reason for doing this instead of 1) starting the server and deploying a WAR > or 2) using a WebAppContext? > > On Fri, Nov 21, 2014 at 12:42 PM, Deven Phillips <[email protected] > > > wrote: > > > OK, I think that I have a project which can run, but I am still getting > > NPEs for the injected resource. > > > > On Fri, Nov 21, 2014 at 2:13 PM, Deven Phillips < > [email protected]> > > wrote: > > > > > And by working, I mean it compiles.. I do not mean that the Dependency > > > Injection is working. > > > > > > On Fri, Nov 21, 2014 at 2:13 PM, Deven Phillips < > > [email protected]> > > > wrote: > > > > > >> OK, I created a branch called DeltaSpike which is now working... Sorry > > >> for wasting your time with a broken source tree!! > > >> > > >> Deven > > >> > > >> On Fri, Nov 21, 2014 at 2:04 PM, Deven Phillips < > > [email protected] > > >> > wrote: > > >> > > >>> I've never needed an "Application" class before while using Guice or > > >>> manually configuring JAX-RS with Jetty.. I will check to see if that > > makes > > >>> a difference... > > >>> > > >>> Deven > > >>> > > >>> On Fri, Nov 21, 2014 at 1:37 PM, Jason Porter < > [email protected] > > > > > >>> wrote: > > >>> > > >>>> Maybe I missed something, but why are you going through all the > > trouble > > >>>> of > > >>>> starting the server and setting everything up manually? I still > don't > > >>>> see > > >>>> any JAX-RS config or JAX-RS Application class. > > >>>> > > >>>> On Fri, Nov 21, 2014 at 11:30 AM, Deven Phillips < > > >>>> [email protected]> > > >>>> wrote: > > >>>> > > >>>> > I see what happened... I meant to create a separate branch for a > > >>>> WeldSE > > >>>> > implementation and failed.. Checkout the tag 'deltaspike' > > >>>> > > > >>>> > Deven > > >>>> > > > >>>> > On Fri, Nov 21, 2014 at 1:27 PM, Deven Phillips < > > >>>> [email protected]> > > >>>> > wrote: > > >>>> > > > >>>> > > John, > > >>>> > > > > >>>> > > Have a look at com.zanclus.example.api.GetServerTime > > >>>> > > > > >>>> > > Deven > > >>>> > > > > >>>> > > On Fri, Nov 21, 2014 at 11:41 AM, John D. Ament < > > >>>> [email protected]> > > >>>> > > wrote: > > >>>> > > > > >>>> > >> Deven, > > >>>> > >> > > >>>> > >> Looks like there's no JAX-RS resources in this project... > > >>>> > >> > > >>>> > >> On Fri Nov 21 2014 at 10:08:34 AM Deven Phillips < > > >>>> > >> [email protected]> > > >>>> > >> wrote: > > >>>> > >> > > >>>> > >> > I finally got around to trying to put together an example > > project > > >>>> > which > > >>>> > >> I > > >>>> > >> > could share publicly... > > >>>> > >> > > > >>>> > >> > https://github.com/InfoSec812/JettyJerseyWeldExample > > >>>> > >> > > > >>>> > >> > I'm hoping I can figure out how to get DeltaSpike/Weld to > work > > >>>> > injecting > > >>>> > >> > dependencies into my JAX-RS POJOs... > > >>>> > >> > > > >>>> > >> > On Mon, Nov 17, 2014 at 9:58 AM, Deven Phillips < > > >>>> > >> [email protected]> > > >>>> > >> > wrote: > > >>>> > >> > > > >>>> > >> > > Creating the ServletContextHandler now looks like: > > >>>> > >> > > > > >>>> > >> > > ServletContextHandler handler = new > > >>>> ServletContextHandler(); > > >>>> > >> > > handler.setContextPath("/"); > > >>>> > >> > > handler.addFilter(ProxyAuthFilter.class, "/*", > > >>>> > >> > > EnumSet.allOf(DispatcherType.class)); > > >>>> > >> > > handler.addEventListener(new > > >>>> BeanManagerResourceBindingList > > >>>> > >> > ener()); > > >>>> > >> > > handler.addEventListener(new > > >>>> CdiServletRequestListener()); > > >>>> > >> > > handler.addServlet(new ServletHolder(new > > >>>> > ServletContainer(new > > >>>> > >> > > PackagesResourceConfig(config.restPackage()))), "/*"); > > >>>> > >> > > > > >>>> > >> > > > > >>>> > >> > > And the exception is an NPE in one of my JAX-RS POJOs where > > it > > >>>> tries > > >>>> > >> to > > >>>> > >> > > access a supposedly injected resource. > > >>>> > >> > > > > >>>> > >> > > DEven > > >>>> > >> > > > > >>>> > >> > > On Mon, Nov 17, 2014 at 9:54 AM, Deven Phillips < > > >>>> > >> > [email protected]> > > >>>> > >> > > wrote: > > >>>> > >> > > > > >>>> > >> > >> OK, the @Target exception was a classpath problem and I > have > > >>>> > resolved > > >>>> > >> > it, > > >>>> > >> > >> but I am still getting NullPointerExceptions because > nothing > > >>>> is > > >>>> > >> getting > > >>>> > >> > >> injected into my JAX-RS classes... > > >>>> > >> > >> > > >>>> > >> > >> On Mon, Nov 17, 2014 at 9:28 AM, Deven Phillips < > > >>>> > >> > [email protected] > > >>>> > >> > >> > wrote: > > >>>> > >> > >> > > >>>> > >> > >>> So, I just tried this: > > >>>> > >> > >>> > > >>>> > >> > >>> WebAppContext ctx = new > > >>>> WebAppContext("cc-backend-sungardas", > > >>>> > >> > "/"); > > >>>> > >> > >>> ctx.addFilter(ProxyAuthFilter.class, "/*", > > >>>> > >> > >>> EnumSet.allOf(DispatcherType.class)); > > >>>> > >> > >>> ctx.addServlet(new ServletHolder(new > > ServletContainer(new > > >>>> > >> > >>> PackagesResourceConfig(config.restPackage()))), "/*"); > > >>>> > >> > >>> ctx.addEventListener(new > > >>>> > BeanManagerResourceBindingListener()); > > >>>> > >> > >>> > > >>>> > >> > >>> and I got the following Exceptions: > > >>>> > >> > >>> > > >>>> > >> > >>> [DEBUG] 2014-11-17 09:25:44,821 [main] > > >>>> > >> > org.jboss.weld.Reflection:82 > > >>>> > >> > >>> - WELD-000620: interface javax.ws.rs.core.Context is not > > >>>> declared > > >>>> > >> > >>> @Target(METHOD, FIELD, PARAMETER, TYPE). Weld will use > this > > >>>> > >> annotation, > > >>>> > >> > >>> however this may make the application unportable. > > >>>> > >> > >>> Exception in thread "main" > > >>>> > >> > >>> org.jboss.weld.exceptions.DefinitionException: Exception > > List > > >>>> > with 1 > > >>>> > >> > >>> exceptions: > > >>>> > >> > >>> Exception 0 : > > >>>> > >> > >>> javax.enterprise.event.ObserverException > > >>>> > >> > >>> 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:379) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.security.NewInstanceAction.run( > > >>>> > >> > NewInstanceAction.java:33) > > >>>> > >> > >>> at java.security.AccessController.doPrivileged(Native > > >>>> Method) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.injection.Exceptions.rethrowException( > > >>>> > >> > Exceptions.java:40) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.injection.Exceptions.rethrowException( > > >>>> > >> > Exceptions.java:78) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.injection.MethodInjectionPoint. > > >>>> > >> > > invokeOnInstanceWithSpecialValue(MethodInjectionPoint.java:98) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.event.ObserverMethodImpl.sendEvent( > > >>>> > >> > ObserverMethodImpl.java:271) > > >>>> > >> > >>> at > > >>>> > >> > >>> > org.jboss.weld.event.ExtensionObserverMethodImpl.sendEvent( > > >>>> > >> > ExtensionObserverMethodImpl.java:121) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.event.ObserverMethodImpl.sendEvent( > > >>>> > >> > ObserverMethodImpl.java:258) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.event.ObserverMethodImpl.notify( > > >>>> > >> > ObserverMethodImpl.java:237) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.event.ObserverNotifier.notifyObserver( > > >>>> > >> > ObserverNotifier.java:174) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.event.ObserverNotifier.notifyObservers( > > >>>> > >> > ObserverNotifier.java:133) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.event.ObserverNotifier.fireEvent( > > >>>> > >> > ObserverNotifier.java:107) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.bootstrap.events.AbstractContainerEvent. > > >>>> > >> > fire(AbstractContainerEvent.java:54) > > >>>> > >> > >>> at > > >>>> > >> > >>> > > >>>> > >> > > >>>> > org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire( > > >>>> > >> > AbstractDefinitionContainerEvent.java:42) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl. > > >>>> > >> > fire(AfterBeanDiscoveryImpl.java:59) > > >>>> > >> > >>> at > > >>>> > >> > >>> > > >>>> > >> > > >>>> > org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:412) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.bootstrap.WeldBootstrap.deployBeans( > > >>>> > >> > WeldBootstrap.java:83) > > >>>> > >> > >>> at > > >>>> > >> > >>> > > >>>> > >> > > >>>> > org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans( > > >>>> > >> > ForwardingBootstrap.java:63) > > >>>> > >> > >>> at > > >>>> > org.jboss.weld.environment.se.Weld.initialize(Weld.java:133) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.apache.deltaspike.cdise.weld.WeldContainerControl. > > >>>> > >> > boot(WeldContainerControl.java:65) > > >>>> > >> > >>> at com.sungardas.cc.edison.Main.start(Main.java:171) > > >>>> > >> > >>> at com.sungardas.cc.edison.Main.main(Main.java:68) > > >>>> > >> > >>> Caused by: java.lang.NoSuchMethodError: > > >>>> > >> > >>> org.jboss.weld.context.AbstractUnboundContext.<init>(Z)V > > >>>> > >> > >>> at > > >>>> > >> > >>> > > org.jboss.weld.environment.se.contexts.ThreadContext.<init>( > > >>>> > >> > ThreadContext.java:40) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.environment.se.WeldSEBeanRegistrant. > > >>>> > >> > registerWeldSEContexts(WeldSEBeanRegistrant.java:49) > > >>>> > >> > >>> 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:90) > > >>>> > >> > >>> ... 17 more > > >>>> > >> > >>> > > >>>> > >> > >>> at > > >>>> > >> > >>> > > >>>> > >> > > >>>> > org.jboss.weld.bootstrap.events.AbstractDefinitionContainerEvent.fire( > > >>>> > >> > AbstractDefinitionContainerEvent.java:44) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.bootstrap.events.AfterBeanDiscoveryImpl. > > >>>> > >> > fire(AfterBeanDiscoveryImpl.java:59) > > >>>> > >> > >>> at > > >>>> > >> > >>> > > >>>> > >> > > >>>> > org.jboss.weld.bootstrap.WeldStartup.deployBeans(WeldStartup.java:412) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.jboss.weld.bootstrap.WeldBootstrap.deployBeans( > > >>>> > >> > WeldBootstrap.java:83) > > >>>> > >> > >>> at > > >>>> > >> > >>> > > >>>> > >> > > >>>> > org.jboss.weld.bootstrap.api.helpers.ForwardingBootstrap.deployBeans( > > >>>> > >> > ForwardingBootstrap.java:63) > > >>>> > >> > >>> at > > >>>> > org.jboss.weld.environment.se.Weld.initialize(Weld.java:133) > > >>>> > >> > >>> at > > >>>> > >> > >>> org.apache.deltaspike.cdise.weld.WeldContainerControl. > > >>>> > >> > boot(WeldContainerControl.java:65) > > >>>> > >> > >>> at com.sungardas.cc.edison.Main.start(Main.java:171) > > >>>> > >> > >>> at com.sungardas.cc.edison.Main.main(Main.java:68) > > >>>> > >> > >>> > > >>>> > >> > >>> On Mon, Nov 17, 2014 at 9:09 AM, Deven Phillips < > > >>>> > >> > >>> [email protected]> wrote: > > >>>> > >> > >>> > > >>>> > >> > >>>> This is embedded Jetty 9.2.x and Weld version > 1.1.9.Final > > >>>> booted > > >>>> > >> using > > >>>> > >> > >>>> DeltaSpike 1.0.2... I have seen that linked document, > but > > I > > >>>> don't > > >>>> > >> see > > >>>> > >> > how > > >>>> > >> > >>>> to translate that to embedded Jetty's startup... > > Normally, I > > >>>> > would > > >>>> > >> do > > >>>> > >> > >>>> something like: > > >>>> > >> > >>>> > > >>>> > >> > >>>> ServletContextHandler ctx = new > > >>>> ServletContextHandler("/"); > > >>>> > >> > >>>> ctx.addFilter(AuthFilter.class, "/*", > > >>>> > >> > >>>> EnumSet.allOf(DispatcherType.class) > > >>>> > >> > >>>> ctx.addServlet(new ServletContainer(new > > >>>> > >> > >>>> PackagesResourceConfig(restPackage)); > > >>>> > >> > >>>> ctx.addEventListener(new CdiRequestListener()) > > >>>> > >> > >>>> > > >>>> > >> > >>>> Where in there would I put in the BeanManager and the > > >>>> > >> > >>>> ManagerObjectFactory? Or should I follow the lines below > > >>>> that > > >>>> > where > > >>>> > >> > they > > >>>> > >> > >>>> talk about using a listener to automatically bind the > > >>>> > BeanManager? > > >>>> > >> > >>>> > > >>>> > >> > >>>> Thanks in advance!! > > >>>> > >> > >>>> > > >>>> > >> > >>>> Deven > > >>>> > >> > >>>> > > >>>> > >> > >>>> On Sun, Nov 16, 2014 at 10:39 PM, Jason Porter < > > >>>> > >> > [email protected] > > >>>> > >> > >>>> > wrote: > > >>>> > >> > >>>> > > >>>> > >> > >>>>> Which version of weld? > > >>>> > >> > >>>>> > > >>>> > >> > >>>>> > https://docs.jboss.org/weld/reference/latest/en-US/html/ > > >>>> > >> > environments.html#_jetty > > >>>> > >> > >>>>> should be all you need for weld in jetty. > > >>>> > >> > >>>>> On Sun, Nov 16, 2014 at 20:28 Deven Phillips < > > >>>> > >> > [email protected] > > >>>> > >> > >>>>> > > > >>>> > >> > >>>>> wrote: > > >>>> > >> > >>>>> > > >>>> > >> > >>>>> > Hi all, > > >>>> > >> > >>>>> > > > >>>> > >> > >>>>> > > > >>>> > >> > >>>>> > I'm trying really hard to figure out how to make > > >>>> > >> > DeltaSpike/Weld > > >>>> > >> > >>>>> work > > >>>> > >> > >>>>> > with Jetty and Jersey... I can get the Jersey servlet > > to > > >>>> load, > > >>>> > >> but > > >>>> > >> > I > > >>>> > >> > >>>>> cannot > > >>>> > >> > >>>>> > get any of the dependencies to be injected... My goal > > is > > >>>> to > > >>>> > >> replace > > >>>> > >> > >>>>> > Google's Guice DI framework so that I can achieve > > better > > >>>> test > > >>>> > >> > >>>>> coverage and > > >>>> > >> > >>>>> > decoupling... I'm having a very hard time finding any > > >>>> > >> documentation > > >>>> > >> > >>>>> for > > >>>> > >> > >>>>> > wiring this up.. > > >>>> > >> > >>>>> > > > >>>> > >> > >>>>> > Any help would be appreciated! > > >>>> > >> > >>>>> > > > >>>> > >> > >>>>> > Deven > > >>>> > >> > >>>>> > > > >>>> > >> > >>>>> > > >>>> > >> > >>>> > > >>>> > >> > >>>> > > >>>> > >> > >>> > > >>>> > >> > >> > > >>>> > >> > > > > >>>> > >> > > > >>>> > >> > > >>>> > > > > >>>> > > > > >>>> > > > >>>> > > >>>> > > >>>> > > >>>> -- > > >>>> Jason Porter > > >>>> http://en.gravatar.com/lightguardjp > > >>>> > > >>> > > >>> > > >> > > > > > > > > > -- > Jason Porter > http://en.gravatar.com/lightguardjp >
