That said, I do find plenty of posts where they say it does work:

For example:
http://stackoverflow.com/questions/30332043/inject-an-application-scoped-managed-bean-in-a-websocket


On Thu, Jul 30, 2015 at 3:24 PM, Tom Barber <[email protected]> wrote:

> Thanks Jens
>
> When I figured it wasn't CDI at complete fault I went googling and came
> across a bunch of similar stuff, which is nuts. If you want to run
> websockets and have some system beans, how on earth do you communicate with
> them?! :)
>
> Tom
>
> On Thu, Jul 30, 2015 at 3:00 PM, Jens J Parappallil <
> [email protected]> wrote:
>
>>  Hi Tom,
>>
>>
>>
>> You may find this interesting
>>
>>
>>
>> https://dzone.com/articles/integrating-cdi-and-websockets
>>
>>
>>
>> Regards
>>
>> Jens
>>
>>
>>
>> *From:* Tom Barber [mailto:[email protected]]
>> *Sent:* Thursday, July 30, 2015 4:52 PM
>> *To:* [email protected]
>> *Subject:* Re: PAX CDI not bootstrapping
>>
>>
>>
>> You'll cringe when you see this but I've been hacking around a bit to see
>> whats broken:
>>
>>
>>
>>
>> https://github.com/buggtb/broken-cdi-example/blob/master/src/main/java/com/mytool/filemanager/websocket/FileManagerEndpoint.java
>>
>>
>>
>> So I made my endpoint multipurpose and it now doubles up as a Servlet.
>>
>>
>>
>> Anyway, the get works and responds correctly with my injected CDI object,
>> the Web socket endpoint still bombs with an NPE. I'm gonna guess its some
>> weird Web Socket classloading issue, but I have absolutely no clue.
>>
>>
>>
>> tom
>>
>>
>>
>> On Thu, Jul 30, 2015 at 12:03 PM, Tom Barber <[email protected]>
>> wrote:
>>
>> Thanks Andreas,
>>
>>
>>
>> That was a hangover from when I tried it without an interface.
>>
>>
>>
>> I've checked it and its still not firing.
>>
>>
>>
>> Tom
>>
>>
>>
>> On Thu, Jul 30, 2015 at 11:54 AM, Andreas Kuhtz <[email protected]>
>> wrote:
>>
>> Hi,
>>
>> Might be a problem of injecting the impl instead of the interface in
>> FileManagerEndpoint:
>>
>> @OsgiService
>> private FileManagerClientImpl fileManagerClient;
>>
>> .. the same in the setter. Try change to FileManagerClient and see if
>> this helps.
>>
>> Regards,
>>
>> Andreas
>>
>>
>>
>> 2015-07-30 12:48 GMT+02:00 Tom Barber <[email protected]>:
>>
>> Okay gang,
>>
>>
>>
>> I've tried 0.13.0-SNAPSHOT and I still can't for the life of me figure
>> out why I don't get my dependency injected.
>>
>>
>>
>> Here is a stripped out version:
>> https://github.com/buggtb/broken-cdi-example I'm sure its something
>> obvious but I can't figure it out.
>>
>>
>>
>> Thanks
>>
>>
>>
>> Tom
>>
>>
>>
>> On Wed, Jul 29, 2015 at 11:47 PM, Tom Barber <[email protected]>
>> wrote:
>>
>> Knowing my coding prowess, i wouldn't say nicely, but i'll give it a shot
>> and ask questions another day!
>>
>>
>>
>> Thanks Achim!
>>
>>
>>
>>
>>
>> On Wed, Jul 29, 2015 at 11:42 PM, Achim Nierbeck <[email protected]>
>> wrote:
>>
>> If you switch to use pax-cdi 0.13.0-SNAPSHOT it'll work nicely with
>> Pax-Web 4.x and Karaf 4.
>>
>> I just pushed the changes and deployed the snapshot to the ops4j snapshot
>> repo.
>>
>>
>>
>> regards, Achim
>>
>>
>>
>> 2015-07-30 0:02 GMT+02:00 Tom Barber <[email protected]>:
>>
>> Boo, actually I resolved that weirdness, that was due to me overriding
>> the default classpath, but when it starts I don't get any beans injected
>> which gives me a sad face.......
>>
>>
>>
>> Tom
>>
>>
>>
>> On Wed, Jul 29, 2015 at 10:38 PM, Achim Nierbeck <[email protected]>
>> wrote:
>>
>> Hi Tom,
>>
>>
>>
>> I'm not sure what happened to your setup,
>>
>> but actually that shouldn't be of an issue.
>>
>> I just tested it and stumbled over another thing.
>>
>> The latest pax-cdi bundles aren't compatible with Jetty 9.1 and Servlet
>> 3.1
>>
>>
>>
>> I'm gonna look at it.
>>
>>
>>
>> regards, Achim
>>
>>
>>
>>
>>
>>
>>
>> 2015-07-29 18:04 GMT+02:00 Tom Barber <[email protected]>:
>>
>> Hello chaps
>>
>>
>>
>> Running Karaf 4 and PAX CDI I'm running into an issue wiring it all up. I
>> have
>>
>>
>>
>> Require-Capability: org.ops4j.pax.cdi.extension; filter:="(&(extension=p
>>
>>  ax-cdi-extension)(version>=0.12)(!(version>=0.13)))",osgi.extender; fil
>>
>>  ter:="(osgi.extender=pax.cdi)"
>>
>>
>>
>> In my Manifest but when it starts it complains of stuff like:
>>
>>
>>
>> Caused by: java.lang.ClassNotFoundException:
>> WEB-INFes.com.mytool.filemanager.websocket.FileManagerObj not found by
>> com.mytool.filemanager-client
>>
>>
>>
>> Which is weird, mostly because where does WEB-IFes come from?
>>
>>
>>
>> Anyway I can't work it out, where those errors come from and whilst my
>> bundle does come up my beans aren't injected, does anyone have a good idea?
>>
>>
>>
>> Thanks
>>
>>
>>
>> Tom
>>
>>
>>
>>
>>
>> --
>>
>>
>> Apache Member
>>
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
>> & Project Lead
>> blog <http://notizblog.nierbeck.de/>
>>
>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>
>>
>>
>> Software Architect / Project Manager / Scrum Master
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> --
>>
>>
>> Apache Member
>>
>> Apache Karaf <http://karaf.apache.org/> Committer & PMC
>> OPS4J Pax Web <http://wiki.ops4j.org/display/paxweb/Pax+Web/> Committer
>> & Project Lead
>> blog <http://notizblog.nierbeck.de/>
>>
>> Co-Author of Apache Karaf Cookbook <http://bit.ly/1ps9rkS>
>>
>>
>>
>> Software Architect / Project Manager / Scrum Master
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>>
>> DISCLAIMER: "The information in this e-mail and any attachment is
>> intended only for the person to whom it is addressed and may contain
>> confidential and/or privileged material. If you have received this e-mail
>> in error, kindly contact the sender and destroy all copies of the original
>> communication. IBS makes no warranty, express or implied, nor guarantees
>> the accuracy, adequacy or completeness of the information contained in this
>> email or any attachment and is not liable for any errors, defects,
>> omissions, viruses or for resultant loss or damage, if any, direct or
>> indirect."
>>
>
>

Reply via email to