0

My application is based on OSGi (Equinox). A OSGi service binds another service by defining a Component XML and bind / unbind methods in the appropriate class.

In the unbind method the value of a global String variable (same class like unbind method) should be retrivied.

Strangely the String attribute is null there, although the attribute was definitely set before. What's the reason for that? How can I get the value that I have set?

user1056903
  • 921
  • 9
  • 26

1 Answers1

1

Likely causes are that you have a different instance or class than you think. Just set a breakpoint on writing and reading that variable or make a set/get method that prints it out with some debug info.

Did you actually debug this problem before asking?

Peter Kriens
  • 15,196
  • 1
  • 37
  • 55
  • For debugging I've printed the variable value in the setter and getter. Now it's fixed. The reason for this problem was that I instantiated the class which has the bind/unbind methods and the String variable manually with new beside the automatically instantation by OSGi. I've made the String variable static and it works. – user1056903 Apr 10 '13 at 14:03