Friday, June 27, 2008

jBoss deployment error message

When you deploy, jBoss automatically checks the structural integrity and Specification compliance of the JAR file. If this check fails, the JAR has not been deployed. The error messages are relatively helpful; for example:
Bean   : SomeEJB
Method : public abstract returnType methodName(parameters)
         throws RemoteException,...
Section: 7.10.5
Warning: The methods defined in the remote interface must
         have a matching method in the bean's class with
         the same name and same number and types of
         arguments.
Not only has jBoss detected a violation of the EJB Specification, it has indicated which section of the Specification to look at (7.10.5 in this case). If you see messages like this, you need to correct the code. However, jBoss doesn't say what is the exact difference between the remote interface (usually called SomeService.java) and the bean definition (usually called SomeBean.java). Check all of the following: the method name, the type of its parameters, the list of exceptions it throws and its scope. Here is how it should be usually:

Thursday, January 3, 2008

C++ operator< implementation

class Foo
{
  int         a;
  float       b;
  std::string c;

  /* ... */

  bool operator<(const Foo& foo) const
  {
     if (a != foo.a) return a < foo.a;
     if (b != foo.b) return b < foo.b;
     if (c != foo.c) return c < foo.c;
     return false;
  }
}