users@glassfish.java.net

Re: How to call OSGI service from managed bean?

From: <forums_at_java.net>
Date: Thu, 19 Jan 2012 04:44:42 -0600 (CST)

There are two issues with your app:

a) in line #54 of userCheck.java, you have:

String test_var = this.hello.sayHello("Duke");

This will always cause NPE, as this code gets executed by constructor and
this.hello would never have been injected by then. 

b) I don't see any beans.xml, so CDI is not enabled for your app. Add an
empty WEB-INF/beans.xml.

By the way, since you are using NetBeans to do OSGi development, I suggest
you take a look at our video tutorial if you have not:

http://blogs.sun.com/arungupta/entry/screencast_32_osgi_enabled_java

HTH,

Sahoo


--
[Message sent by forum member 'ss141213']
View Post: http://forums.java.net/node/882760