Hi, Sergio,
The message is claiming there are duplicate keys out there.
You should check your SQL statements (if you can dump them from JPA's EntityManager), or just think about what keys are being used. If they are based on some coarse
unit of time, you might have a clash for that reason.
Also, if it were me (and I don't know anything about your design), I would be thinking about how the servlet is getting its EJB proxy and how long it is keeping that open. Is it injected, for instance? If your two messages are not necessarily paired (they occur separately), this could explain the "undeployed" part.
Further, the 3.1 EJB standard allows for a singleton, and the singleton can be hooked up to a timer. EJBs are never supposed to read or write directly to the filesystem, according to the spec, but people have been known to do that (shhh! ;-)). But that's just a design suggestion.