Reputation: 2284
I have created a felix gogo custom command using information from the bndtoools tutorial (http://bndtools.org/tutorial.html#write-a-command-component).
The code used is below:
@Component(properties = {
CommandProcessor.COMMAND_SCOPE + ":String=texter",
CommandProcessor.COMMAND_FUNCTION + ":String=text"
},
provide = Object.class
)
public class SocketUser
{
private ActualUser aUser = new ActualUser();
public SocketUser()
{
// TODO Auto-generated constructor stub
}
public void text(String aMessage)
{
aUser.textClients(aMessage);
}
}
Note that the ActualUser class has a method called textClient() which, for now, just prints out a message.
I set the appropriate things in the build and run bnd files, including the Bnd Annotations declarative services. I also have all the necessary Gogo bundles in the runtime.
Doing a "help" causes a list of commands to display, which includes the following:
felix:bundlelevel
felix:cd
felix:frameworklevel
felix:headers
felix:help
.
.
.
scr:list
texter:text
where "texter:text" is my added command.
All seems well, except that when I try to use the text command I get the following failure messages:
g! text hello!
gogo: InvocationTargetException: null
g! text
gogo: IllegalArgumentException: Cannot coerce text() to any of [(String)]
g!
I think I understand the second failure message: the command needs a string in order to work. I do not understand the first failure, though.
Does anyone know why this command is not working? What is causing these InvocationTargetExceptions?
More importantly, how can I make them go away?
Someone please advise...
Upvotes: 3
Views: 1544
Reputation: 390
I just had this error because the version of the org.apache.felix.gogo.runtime bundle calculated to be in my Run Bundles was not good. It was 0.11.0 when I had the error.
I removed the bundle and clicked "resolve" again. It found another version of the bundle 0.14.0 as you see in the Figure, and it works well now.
Upvotes: 1