I am experiencing a strange error in a Spring project that looks like this:
SEVERE: Servlet.service () for the servlet [calzoneServlet] in the context of the path [/ calzone] threw an exception [Request processing failed; The nested exception is org.springframework.dao.InvalidDataAccessApiUsageException: the name must not be empty or empty !; The nested exception is java.lang.IllegalArgumentException: the name must not be empty or empty!] With the root cause java.lang.IllegalArgumentException: the name must not be empty or empty!
In this project, all models are mapped to the database using hibernate and jpa. The interface uses Twitter Bootstrap (with Spring form validation, etc.)
The error occurs in different parts of the program, one of which is a controller for activating a user account (code below). For me, this seems like some kind of validation error, but it is not the error I have ever identified. Since I cannot pinpoint the exact location of the error, I only provide the controller below. It should be noted that any debugging messages (whether through the logger or just the old sysout) are activateUsernot displayed in the method .
All dependencies (pom.xml) can be found here: http://pastebin.com/fs7SG0W2
Web.xml here: http://pastebin.com/vAJh29Aw
Here you can find the full stack: http://codepad.org/p0Yt5hi2 ( on the code as it has horizontal scrolling)
- , , - , , ?
@Controller
public class ActivateAccountController {
final Logger logger = LoggerFactory.getLogger(getClass());
@RequestMapping(value = "/activate/{keyString}", method = RequestMethod.GET)
public String activateUser(@PathVariable String keyString) {
ConfigurableApplicationContext context = new ClassPathXmlApplicationContext("applicationContext.xml");
KeyService keyService = (KeyService) context.getBean("keyService");
UserService userService = (UserService) context.getBean("userService");
User user;
try {
logger.error("DID I GET HERE?");
user = keyService.findUserByKey(keyString);
} catch (KeyNotFoundException ex) {
return "ActivatedNotAccount";
} finally {
context.close();
}
userService.activateUser(user);
keyService.deleteKey(keyString);
userService.updateUser(user);
logger.info("Acticated user with ID \"{}\", First name: \"{}\", Last name: \"{}\" and username: \"{}\"",
user.getId(), user.getPerson().getFirstName(), user.getPerson().getLastName(), user.getUsername());
return "ActivatedAccount";
}
}